mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
KWSys 2021-04-19 (d6139c66)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit d6139c66c8760552ab6bc4a08401ae8105217469 (master). Upstream Shortlog ----------------- Orgad Shaneh (3): 17f4af9b SystemTools: Use octal base for error messages in permission test f00dd83e SystemTools: Avoid unnecessary assumption of working directory in test case 5b941f33 SystemTools: Adapt permissions test to MSYS
This commit is contained in:

committed by
Brad King

parent
a790167101
commit
d98342d868
@@ -290,15 +290,17 @@ static bool CheckFileOperations()
|
|||||||
res = false;
|
res = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cerr << std::oct;
|
||||||
// Reset umask
|
// Reset umask
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#ifdef __MSYS__
|
||||||
|
mode_t fullMask = S_IWRITE;
|
||||||
|
#elif defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
// NOTE: Windows doesn't support toggling _S_IREAD.
|
// NOTE: Windows doesn't support toggling _S_IREAD.
|
||||||
mode_t fullMask = _S_IWRITE;
|
mode_t fullMask = _S_IWRITE;
|
||||||
#else
|
#else
|
||||||
// On a normal POSIX platform, we can toggle all permissions.
|
// On a normal POSIX platform, we can toggle all permissions.
|
||||||
mode_t fullMask = S_IRWXU | S_IRWXG | S_IRWXO;
|
mode_t fullMask = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||||
#endif
|
#endif
|
||||||
mode_t orig_umask = umask(fullMask);
|
|
||||||
|
|
||||||
// Test file permissions without umask
|
// Test file permissions without umask
|
||||||
mode_t origPerm, thisPerm;
|
mode_t origPerm, thisPerm;
|
||||||
@@ -370,6 +372,7 @@ static bool CheckFileOperations()
|
|||||||
res = false;
|
res = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mode_t orig_umask = umask(fullMask);
|
||||||
// Test setting file permissions while honoring umask
|
// Test setting file permissions while honoring umask
|
||||||
if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask, true)) {
|
if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask, true)) {
|
||||||
std::cerr << "Problem with SetPermissions (3) for: " << testNewFile
|
std::cerr << "Problem with SetPermissions (3) for: " << testNewFile
|
||||||
@@ -496,6 +499,7 @@ static bool CheckFileOperations()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::cerr << std::dec;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1093,7 +1097,7 @@ static bool CheckCopyFileIfDifferent()
|
|||||||
ret = false;
|
ret = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string bdata = readFile("file_b");
|
std::string bdata = readFile(cptarget);
|
||||||
if (diff_test_cases[i].a != bdata) {
|
if (diff_test_cases[i].a != bdata) {
|
||||||
std::cerr << "Incorrect CopyFileIfDifferent file contents in test case "
|
std::cerr << "Incorrect CopyFileIfDifferent file contents in test case "
|
||||||
<< i + 1 << "." << std::endl;
|
<< i + 1 << "." << std::endl;
|
||||||
|
Reference in New Issue
Block a user