Tests: Explicitly set permissions in CPack tests to avoid perimssions errors

When the user has the setgid bit is set on the parent directory of
the build directory, the setgid bit will be propagated throughout the
build tree.  Most tests do not care about permissions as long as they
can read and write the files the need.  The CPack tests, however, validate
that permissions match an expected set, and fail with the setgid bit set.

Explicitly set permissions on directories created in the CPackTestHelpers
to clear the setgid bit.

Signed-off-by: william.r.dieter <william.r.dieter@intel.com>
This commit is contained in:
william.r.dieter
2021-01-29 14:45:04 -05:00
parent c5691f03e5
commit f41d0e0c77
@@ -21,6 +21,12 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK
# TODO this should be executed only once per ctest run (not per generator)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
# Set permissions to those expected by the test
file(CHMOD "${RunCMake_TEST_BINARY_DIR}"
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
if(EXISTS "${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake")
include("${RunCMake_SOURCE_DIR}/tests/${TEST_NAME}/${GENERATOR_TYPE}-Prerequirements.cmake")