From: Vladislav Shchapov Date: Sun, 26 Nov 2023 17:48:31 +0000 (+0500) Subject: Run OSB tests with readonly source directory. X-Git-Tag: 2.1.6~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d012acbc224cc9d43aed63bb5167ab1e28779cc;p=thirdparty%2Fzlib-ng.git Run OSB tests with readonly source directory. Signed-off-by: Vladislav Shchapov --- diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 80dc4bb3..dfda7367 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -51,6 +51,8 @@ jobs: cxx-compiler: g++ build-dir: ../build build-src-dir: ../zlib-ng + # Build with readonly project directory require CMake 3.19+ + readonly-project-dir: true codecov: ubuntu_gcc_osb cflags: -O3 @@ -60,6 +62,7 @@ jobs: cxx-compiler: g++ build-dir: ../build build-src-dir: ../zlib-ng/test/add-subdirectory-project + readonly-project-dir: true - name: Ubuntu GCC -O1 No Unaligned UBSAN os: ubuntu-latest @@ -598,6 +601,11 @@ jobs: CC: ${{ matrix.compiler }} CXX: ${{ matrix.cxx-compiler }} + - name: Make source tree read-only + shell: bash + run: chmod -R a-w . + if: matrix.readonly-project-dir + - name: Generate project files shell: bash # Shared libraries turned off for qemu ppc* and sparc & reduce code coverage sources @@ -630,6 +638,11 @@ jobs: LSAN_OPTIONS: ${{ matrix.lsan-options || 'verbosity=0' }}:abort_on_error=1:halt_on_error=1 UBSAN_OPTIONS: ${{ matrix.ubsan-options || 'verbosity=0' }}:print_stacktrace=1:abort_on_error=1:halt_on_error=1 + - name: Make source tree writable + shell: bash + run: chmod -R +w . + if: matrix.readonly-project-dir + - name: Generate coverage report if: matrix.codecov shell: bash diff --git a/test/cmake/compress-and-verify.cmake b/test/cmake/compress-and-verify.cmake index d2d9917a..2e6c37f1 100644 --- a/test/cmake/compress-and-verify.cmake +++ b/test/cmake/compress-and-verify.cmake @@ -138,7 +138,11 @@ set(COMPRESS_COMMAND ${COMPRESS_TARGET} ${COMPRESS_ARGS}) set(INPUT_FILE ${OUTPUT_BASE}) # Make CMake copy and rename file in one operation -configure_file(${INPUT} ${INPUT_FILE} COPYONLY) +# The copied file permissions is standard 644 (-rw-r--r--) +if(NOT CMAKE_VERSION VERSION_LESS "3.19") + set(CONFIGURE_NO_SOURCE_PERMISSIONS NO_SOURCE_PERMISSIONS) +endif() +configure_file(${INPUT} ${INPUT_FILE} COPYONLY ${CONFIGURE_NO_SOURCE_PERMISSIONS}) message(STATUS "Compress ${COMPRESS_COMMAND}") message(STATUS " Source file: ${INPUT}")