From c0147f79d0c0b8d807de98701e5a0ce9ef80b6ed Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Tue, 11 Oct 2022 22:40:39 +0100 Subject: [PATCH 01/15] Run C/C++ application testing on Windows and Mac Related issue: #140. --- .github/workflows/c_apps.sh | 18 +++++++++++++++--- .github/workflows/c_apps.yml | 6 +++++- .github/workflows/cxx_apps.sh | 18 +++++++++++++++--- .github/workflows/cxx_apps.yml | 6 +++++- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/.github/workflows/c_apps.sh b/.github/workflows/c_apps.sh index d146c600..d47b888e 100755 --- a/.github/workflows/c_apps.sh +++ b/.github/workflows/c_apps.sh @@ -18,6 +18,8 @@ set -x set -e set -u +# Old bash versions can't expand empty arrays, so we always include at least this option. +CMAKE_OPTIONS=("-DCMAKE_OSX_ARCHITECTURES=x86_64") help | head @@ -38,6 +40,16 @@ case "$(uname)" in df -h ;; +"Darwin") + NINJA_OS="mac" + ;; + +"MINGW"*|"MSYS_NT"*) + NINJA_OS="win" + CMAKE_OPTIONS+=("-DCMAKE_C_COMPILER=cl.exe" "-DCMAKE_CXX_COMPILER=cl.exe") + choco install zip + ;; + *) echo "Unknown OS: only Linux is supported for the dev_build workflow" exit 1 @@ -68,9 +80,9 @@ which ${CXX} mkdir -p build pushd build - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug - cmake --build . --config Debug - cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE=Debug -P cmake_install.cmake + cmake -G Ninja .. -DCMAKE_BUILD_TYPE=${CONFIG} "${CMAKE_OPTIONS[@]}" + cmake --build . --config ${CONFIG} + cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE=${CONFIG} -P cmake_install.cmake popd # Check that dredd works on some projects diff --git a/.github/workflows/c_apps.yml b/.github/workflows/c_apps.yml index b70f57a6..430cc6b2 100644 --- a/.github/workflows/c_apps.yml +++ b/.github/workflows/c_apps.yml @@ -24,9 +24,13 @@ jobs: fail-fast: false matrix: os: - - ubuntu-22.04 + - macOS-latest + - windows-latest config: - Release + include: + - os: ubuntu-22.04 + config: Debug runs-on: ${{ matrix.os }} env: diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index 73204847..45345515 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -18,6 +18,8 @@ set -x set -e set -u +# Old bash versions can't expand empty arrays, so we always include at least this option. +CMAKE_OPTIONS=("-DCMAKE_OSX_ARCHITECTURES=x86_64") help | head @@ -38,6 +40,16 @@ case "$(uname)" in df -h ;; +"Darwin") + NINJA_OS="mac" + ;; + +"MINGW"*|"MSYS_NT"*) + NINJA_OS="win" + CMAKE_OPTIONS+=("-DCMAKE_C_COMPILER=cl.exe" "-DCMAKE_CXX_COMPILER=cl.exe") + choco install zip + ;; + *) echo "Unknown OS: only Linux is supported for the dev_build workflow" exit 1 @@ -68,9 +80,9 @@ which ${CXX} mkdir -p build pushd build - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Debug - cmake --build . --config Debug - cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE=Debug -P cmake_install.cmake + cmake -G Ninja .. -DCMAKE_BUILD_TYPE=${CONFIG} "${CMAKE_OPTIONS[@]}" + cmake --build . --config ${CONFIG} + cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE=${CONFIG} -P cmake_install.cmake popd # Check that dredd works on some projects diff --git a/.github/workflows/cxx_apps.yml b/.github/workflows/cxx_apps.yml index 85676d85..7c902fa1 100644 --- a/.github/workflows/cxx_apps.yml +++ b/.github/workflows/cxx_apps.yml @@ -24,9 +24,13 @@ jobs: fail-fast: false matrix: os: - - ubuntu-22.04 + - macOS-latest + - windows-latest config: - Release + include: + - os: ubuntu-22.04 + config: Debug runs-on: ${{ matrix.os }} env: From 00e849faa7678e5d8e4d575e6c12661334337508 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Tue, 11 Oct 2022 22:55:10 +0100 Subject: [PATCH 02/15] Fix. --- .github/workflows/c_apps.yml | 9 +++++++++ .github/workflows/cxx_apps.yml | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/c_apps.yml b/.github/workflows/c_apps.yml index 430cc6b2..62f51186 100644 --- a/.github/workflows/c_apps.yml +++ b/.github/workflows/c_apps.yml @@ -73,3 +73,12 @@ jobs: run: | .github/workflows/c_apps.sh shell: bash + if: | + !startsWith(matrix.os, 'windows') + - name: build_step_windows + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + "C:\Program Files\Git\bin\bash.EXE" --noprofile --norc -e -o pipefail .github/workflows/c_apps.sh + shell: cmd + if: | + startsWith(matrix.os, 'windows') diff --git a/.github/workflows/cxx_apps.yml b/.github/workflows/cxx_apps.yml index 7c902fa1..1bd3d975 100644 --- a/.github/workflows/cxx_apps.yml +++ b/.github/workflows/cxx_apps.yml @@ -73,3 +73,12 @@ jobs: run: | .github/workflows/cxx_apps.sh shell: bash + if: | + !startsWith(matrix.os, 'windows') + - name: build_step_windows + run: | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 + "C:\Program Files\Git\bin\bash.EXE" --noprofile --norc -e -o pipefail .github/workflows/cxx_apps.sh + shell: cmd + if: | + startsWith(matrix.os, 'windows') From 202441146d76650a39feab718845cda0d0a94b56 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Tue, 11 Oct 2022 23:11:13 +0100 Subject: [PATCH 03/15] Fix. --- .github/workflows/c_apps.sh | 26 ++++++++++++++++++++------ .github/workflows/cxx_apps.sh | 26 ++++++++++++++++++++------ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/.github/workflows/c_apps.sh b/.github/workflows/c_apps.sh index d47b888e..b06bc15c 100755 --- a/.github/workflows/c_apps.sh +++ b/.github/workflows/c_apps.sh @@ -51,7 +51,7 @@ case "$(uname)" in ;; *) - echo "Unknown OS: only Linux is supported for the dev_build workflow" + echo "Unknown OS" exit 1 ;; esac @@ -70,13 +70,27 @@ popd DREDD_ROOT=$(pwd) -export PATH="${DREDD_ROOT}/third_party/clang+llvm/bin:$PATH" +case "$(uname)" in +"Linux") + # On Linux, build Dredd using the prebuilt version of Clang that has been downloaded + export PATH="${DREDD_ROOT}/third_party/clang+llvm/bin:$PATH" + export CC=clang + export CXX=clang++ + which ${CC} + which ${CXX} + ;; + +"Darwin") + ;; -export CC=clang -export CXX=clang++ +"MINGW"*|"MSYS_NT"*) + ;; -which ${CC} -which ${CXX} +*) + echo "Unknown OS" + exit 1 + ;; +esac mkdir -p build pushd build diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index 45345515..e62b48ac 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -51,7 +51,7 @@ case "$(uname)" in ;; *) - echo "Unknown OS: only Linux is supported for the dev_build workflow" + echo "Unknown OS" exit 1 ;; esac @@ -70,13 +70,27 @@ popd DREDD_ROOT=$(pwd) -export PATH="${DREDD_ROOT}/third_party/clang+llvm/bin:$PATH" +case "$(uname)" in +"Linux") + # On Linux, build Dredd using the prebuilt version of Clang that has been downloaded + export PATH="${DREDD_ROOT}/third_party/clang+llvm/bin:$PATH" + export CC=clang + export CXX=clang++ + which ${CC} + which ${CXX} + ;; + +"Darwin") + ;; -export CC=clang -export CXX=clang++ +"MINGW"*|"MSYS_NT"*) + ;; -which ${CC} -which ${CXX} +*) + echo "Unknown OS" + exit 1 + ;; +esac mkdir -p build pushd build From 480f7534f14ffc008bd93b58490cc9dd83e1928e Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 08:49:10 +0100 Subject: [PATCH 04/15] Add SDKROOT. --- .github/workflows/c_apps.sh | 1 + .github/workflows/cxx_apps.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/c_apps.sh b/.github/workflows/c_apps.sh index b06bc15c..6e7548b8 100755 --- a/.github/workflows/c_apps.sh +++ b/.github/workflows/c_apps.sh @@ -42,6 +42,7 @@ case "$(uname)" in "Darwin") NINJA_OS="mac" + SDKROOT=$(xcrun --show-sdk-path) ;; "MINGW"*|"MSYS_NT"*) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index e62b48ac..1b5327ea 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -42,6 +42,7 @@ case "$(uname)" in "Darwin") NINJA_OS="mac" + SDKROOT=$(xcrun --show-sdk-path) ;; "MINGW"*|"MSYS_NT"*) From fdc9f4de38865bc72f98b87a726facebb015cc76 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 12:03:26 +0100 Subject: [PATCH 05/15] Be selective about where to run which apps. --- .github/workflows/c_apps.sh | 117 +++++++++++++++++++--------------- .github/workflows/cxx_apps.sh | 3 +- 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/.github/workflows/c_apps.sh b/.github/workflows/c_apps.sh index 6e7548b8..c02979b5 100755 --- a/.github/workflows/c_apps.sh +++ b/.github/workflows/c_apps.sh @@ -43,6 +43,7 @@ case "$(uname)" in "Darwin") NINJA_OS="mac" SDKROOT=$(xcrun --show-sdk-path) + export SDKROOT ;; "MINGW"*|"MSYS_NT"*) @@ -104,61 +105,75 @@ popd DREDD_EXECUTABLE="${DREDD_ROOT}/third_party/clang+llvm/bin/dredd" cp "${DREDD_ROOT}/build/src/dredd/dredd" "${DREDD_EXECUTABLE}" -echo "Curl" -date - -git clone https://github.com/curl/curl.git -pushd curl - git reset --hard curl-7_84_0 - mkdir build - pushd build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. - popd - FILES=() - for f in $(find src -name "*.c") - do - FILES+=("${f}") - done - - "${DREDD_EXECUTABLE}" --mutation-info-file temp.json -p "build/compile_commands.json" "${FILES[@]}" - pushd build - ninja - # TODO: run some tests - popd +case "$(uname)" in +"Linux"|"MINGW"*|"MSYS_NT"*) + ;; + echo "Curl" + date + + git clone https://github.com/curl/curl.git + pushd curl + git reset --hard curl-7_84_0 + mkdir build + pushd build + cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. + popd + FILES=() + for f in $(find src -name "*.c") + do + FILES+=("${f}") + done + + "${DREDD_EXECUTABLE}" --mutation-info-file temp.json -p "build/compile_commands.json" "${FILES[@]}" + pushd build + ninja + # TODO: run some tests + popd popd -echo "zstd" -date +*) + ;; +esac -git clone https://github.com/facebook/zstd.git -pushd zstd - git reset --hard v1.4.10 - mkdir temp - pushd temp - # Generate a compilation database - cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../build/cmake +case "$(uname)" in +"Linux"|"Darwin") + echo "zstd" + date + + git clone https://github.com/facebook/zstd.git + pushd zstd + git reset --hard v1.4.10 + mkdir temp + pushd temp + # Generate a compilation database + cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../build/cmake + popd + # Build non-mutated zstd + CFLAGS=-O0 make zstd-release + # Use the compiled zstd binary as a target for compression, and compress it. + cp ./programs/zstd tocompress + ./zstd tocompress -o normal + # Mutate all the source files in the lib directory of zstd + FILES=() + for f in $(find lib -name "*.c") + do + FILES+=("${f}") + done + "${DREDD_EXECUTABLE}" --mutation-info-file temp.json -p "temp/compile_commands.json" "${FILES[@]}" + # Build mutated zstd + make clean + CFLAGS=-O0 make zstd-release + # Use it to compress the original (non-mutated) zstd binary + ./zstd tocompress -o mutated + # The results obtained using the original and mutated versions of zstd should + # be identical, since no mutations were enabled. + diff normal mutated popd - # Build non-mutated zstd - CFLAGS=-O0 make zstd-release - # Use the compiled zstd binary as a target for compression, and compress it. - cp ./programs/zstd tocompress - ./zstd tocompress -o normal - # Mutate all the source files in the lib directory of zstd - FILES=() - for f in $(find lib -name "*.c") - do - FILES+=("${f}") - done - "${DREDD_EXECUTABLE}" --mutation-info-file temp.json -p "temp/compile_commands.json" "${FILES[@]}" - # Build mutated zstd - make clean - CFLAGS=-O0 make zstd-release - # Use it to compress the original (non-mutated) zstd binary - ./zstd tocompress -o mutated - # The results obtained using the original and mutated versions of zstd should - # be identical, since no mutations were enabled. - diff normal mutated -popd + ;; + +*) + ;; +esac echo "Finished" date diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index 1b5327ea..bf839754 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -43,6 +43,7 @@ case "$(uname)" in "Darwin") NINJA_OS="mac" SDKROOT=$(xcrun --show-sdk-path) + export SDKROOT ;; "MINGW"*|"MSYS_NT"*) @@ -109,7 +110,7 @@ date ${DREDD_EXECUTABLE} --mutation-info-file temp.json examples/simple/pi.cc clang++ examples/simple/pi.cc -o examples/simple/pi -diff <(./examples/simple/pi) <(echo "3.14159") +diff --strip-trailing-cr <(./examples/simple/pi) <(echo "3.14159") echo "examples/math: check that the tests pass after mutating the library" date From 9e7bc922920557ed30db62414d7df556a4195e8d Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 12:37:55 +0100 Subject: [PATCH 06/15] Fixes. --- .github/workflows/c_apps.sh | 10 +++++----- .github/workflows/cxx_apps.sh | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/c_apps.sh b/.github/workflows/c_apps.sh index c02979b5..ee8284ed 100755 --- a/.github/workflows/c_apps.sh +++ b/.github/workflows/c_apps.sh @@ -96,9 +96,9 @@ esac mkdir -p build pushd build - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=${CONFIG} "${CMAKE_OPTIONS[@]}" - cmake --build . --config ${CONFIG} - cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE=${CONFIG} -P cmake_install.cmake + cmake -G Ninja .. -DCMAKE_BUILD_TYPE="${CONFIG}" "${CMAKE_OPTIONS[@]}" + cmake --build . --config "${CONFIG}" + cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE="${CONFIG}" -P cmake_install.cmake popd # Check that dredd works on some projects @@ -107,7 +107,6 @@ cp "${DREDD_ROOT}/build/src/dredd/dredd" "${DREDD_EXECUTABLE}" case "$(uname)" in "Linux"|"MINGW"*|"MSYS_NT"*) - ;; echo "Curl" date @@ -129,7 +128,8 @@ case "$(uname)" in ninja # TODO: run some tests popd -popd + popd + ;; *) ;; diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index bf839754..004ababc 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -96,9 +96,9 @@ esac mkdir -p build pushd build - cmake -G Ninja .. -DCMAKE_BUILD_TYPE=${CONFIG} "${CMAKE_OPTIONS[@]}" - cmake --build . --config ${CONFIG} - cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE=${CONFIG} -P cmake_install.cmake + cmake -G Ninja .. -DCMAKE_BUILD_TYPE="${CONFIG}" "${CMAKE_OPTIONS[@]}" + cmake --build . --config "${CONFIG}" + cmake -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TYPE="${CONFIG}" -P cmake_install.cmake popd # Check that dredd works on some projects @@ -112,6 +112,24 @@ ${DREDD_EXECUTABLE} --mutation-info-file temp.json examples/simple/pi.cc clang++ examples/simple/pi.cc -o examples/simple/pi diff --strip-trailing-cr <(./examples/simple/pi) <(echo "3.14159") +case "$(uname)" in +"MINGW"*|"MSYS_NT"*) + # Dredd can lead to object files with many sections, which can be too much for MSVC's default settings. + # This switch enables a larger number of sections. + CXXFLAGS="/bigobj" + export CXXFLAGS + ;; + +"Darwin") + # The Apple compiler does not use C++11 by default; Dredd requires at least this language version. + CXXFLAGS="-std=c++11" + export CXXFLAGS + ;; + +*) + ;; +esac + echo "examples/math: check that the tests pass after mutating the library" date From 3251214690ad5ba961a16318b0435618ce059838 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 13:10:20 +0100 Subject: [PATCH 07/15] Fix. --- .github/workflows/cxx_apps.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index 004ababc..f2fe2dd7 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -105,38 +105,40 @@ popd DREDD_EXECUTABLE="${DREDD_ROOT}/third_party/clang+llvm/bin/dredd" cp "${DREDD_ROOT}/build/src/dredd/dredd" "${DREDD_EXECUTABLE}" -echo "examples/simple/pi.cc: check that we can build the simple example" -date - -${DREDD_EXECUTABLE} --mutation-info-file temp.json examples/simple/pi.cc -clang++ examples/simple/pi.cc -o examples/simple/pi -diff --strip-trailing-cr <(./examples/simple/pi) <(echo "3.14159") - case "$(uname)" in +"Linux") + CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="-w" + ;; + "MINGW"*|"MSYS_NT"*) # Dredd can lead to object files with many sections, which can be too much for MSVC's default settings. - # This switch enables a larger number of sections. - CXXFLAGS="/bigobj" - export CXXFLAGS + # The /bigobj switch enables a larger number of sections. + CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="/w /bigobj" ;; "Darwin") # The Apple compiler does not use C++11 by default; Dredd requires at least this language version. - CXXFLAGS="-std=c++11" - export CXXFLAGS + CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="-w -std=c++11" ;; *) ;; esac +echo "examples/simple/pi.cc: check that we can build the simple example" +date + +${DREDD_EXECUTABLE} --mutation-info-file temp.json examples/simple/pi.cc +clang++ -std=c++11 examples/simple/pi.cc -o examples/simple/pi +diff --strip-trailing-cr <(./examples/simple/pi) <(echo "3.14159") + echo "examples/math: check that the tests pass after mutating the library" date pushd examples/math mkdir build pushd build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. + cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS_FOR_COMPILING_MUTATED_CODE}" .. ../mutate.sh cmake --build . ./mathtest/mathtest @@ -152,7 +154,7 @@ pushd SPIRV-Tools python3 utils/git-sync-deps mkdir build pushd build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSPIRV_WERROR=OFF -DCMAKE_CXX_FLAGS="-w" .. + cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSPIRV_WERROR=OFF -DCMAKE_CXX_FLAGS="${CXX_FLAGS_FOR_COMPILING_MUTATED_CODE}" .. # Build something minimal to ensure all header files get generated. ninja SPIRV-Tools-static popd @@ -179,7 +181,7 @@ git clone --branch llvmorg-14.0.6 --depth 1 https://github.com/llvm/llvm-project pushd llvm-project mkdir build pushd build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS="-w" ../llvm + cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS_FOR_COMPILING_MUTATED_CODE}" ../llvm # Build something minimal to ensure all header files get generated. ninja LLVMCore popd From 10790d0c5a7be05cb665822b833ccf398fadfed1 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 14:10:06 +0100 Subject: [PATCH 08/15] Fix for Windows. --- .github/workflows/cxx_apps.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index f2fe2dd7..61b91ae9 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -129,7 +129,21 @@ echo "examples/simple/pi.cc: check that we can build the simple example" date ${DREDD_EXECUTABLE} --mutation-info-file temp.json examples/simple/pi.cc -clang++ -std=c++11 examples/simple/pi.cc -o examples/simple/pi +case "$(uname)" in +"Linux"|"Darwin") + clang++ -std=c++11 examples/simple/pi.cc -o examples/simple/pi + ;; + +"MINGW"*|"MSYS_NT"*) + cl /Fe"examples/simple/pi" examples/simple/pi.cc + ;; + +) + +*) + ;; +esac + diff --strip-trailing-cr <(./examples/simple/pi) <(echo "3.14159") echo "examples/math: check that the tests pass after mutating the library" From 75a199a5af971964352de1885c3f35576dfb9d2f Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 14:57:33 +0100 Subject: [PATCH 09/15] Fix. --- .github/workflows/cxx_apps.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index 61b91ae9..aedaefc8 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -138,8 +138,6 @@ case "$(uname)" in cl /Fe"examples/simple/pi" examples/simple/pi.cc ;; -) - *) ;; esac From 7939a2895b1f8b25928c34976075add40ae70fe0 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 15:16:18 +0100 Subject: [PATCH 10/15] Fix. --- .github/workflows/cxx_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index aedaefc8..bc6fa4c5 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -135,7 +135,7 @@ case "$(uname)" in ;; "MINGW"*|"MSYS_NT"*) - cl /Fe"examples/simple/pi" examples/simple/pi.cc + cl "examples\\simple\\pi.cc" /link /out:"examples\\simple\\pi.exe" ;; *) From 2a00828de3eab4cb883dd3e9ce2d76639ca7681b Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 15:52:37 +0100 Subject: [PATCH 11/15] Fix. --- .github/workflows/cxx_apps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index bc6fa4c5..5805a80c 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -135,7 +135,8 @@ case "$(uname)" in ;; "MINGW"*|"MSYS_NT"*) - cl "examples\\simple\\pi.cc" /link /out:"examples\\simple\\pi.exe" + cl examples/simple/pi.cc + mv pi.exe examples/simple/ ;; *) From 115ce1b79cafb1593e1142ab233ef74f91763b00 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 19:48:27 +0100 Subject: [PATCH 12/15] Fix. --- .github/workflows/cxx_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index 5805a80c..d10b276a 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -113,12 +113,12 @@ case "$(uname)" in "MINGW"*|"MSYS_NT"*) # Dredd can lead to object files with many sections, which can be too much for MSVC's default settings. # The /bigobj switch enables a larger number of sections. - CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="/w /bigobj" + CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="\"/w /bigobj\"" ;; "Darwin") # The Apple compiler does not use C++11 by default; Dredd requires at least this language version. - CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="-w -std=c++11" + CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="\"-w -std=c++11\"" ;; *) From 74d4080b8235bb1677326a7dd8fddebc543b7dff Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 20:26:46 +0100 Subject: [PATCH 13/15] Fix. --- .github/workflows/cxx_apps.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index d10b276a..4078f866 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -107,18 +107,18 @@ cp "${DREDD_ROOT}/build/src/dredd/dredd" "${DREDD_EXECUTABLE}" case "$(uname)" in "Linux") - CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="-w" + CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=-w") ;; "MINGW"*|"MSYS_NT"*) # Dredd can lead to object files with many sections, which can be too much for MSVC's default settings. # The /bigobj switch enables a larger number of sections. - CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="\"/w /bigobj\"" + CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=/w /bigobj") ;; "Darwin") # The Apple compiler does not use C++11 by default; Dredd requires at least this language version. - CXX_FLAGS_FOR_COMPILING_MUTATED_CODE="\"-w -std=c++11\"" + CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=-w -std=c++11") ;; *) @@ -151,7 +151,7 @@ date pushd examples/math mkdir build pushd build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS_FOR_COMPILING_MUTATED_CODE}" .. + cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "${CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE[@]}" .. ../mutate.sh cmake --build . ./mathtest/mathtest @@ -167,7 +167,7 @@ pushd SPIRV-Tools python3 utils/git-sync-deps mkdir build pushd build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSPIRV_WERROR=OFF -DCMAKE_CXX_FLAGS="${CXX_FLAGS_FOR_COMPILING_MUTATED_CODE}" .. + cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSPIRV_WERROR=OFF "${CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE[@]}" .. # Build something minimal to ensure all header files get generated. ninja SPIRV-Tools-static popd @@ -194,7 +194,7 @@ git clone --branch llvmorg-14.0.6 --depth 1 https://github.com/llvm/llvm-project pushd llvm-project mkdir build pushd build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS_FOR_COMPILING_MUTATED_CODE}" ../llvm + cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "${CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE[@]}" ../llvm # Build something minimal to ensure all header files get generated. ninja LLVMCore popd From 6f0df148e3202e10198b19ff163542535d35f030 Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 20:52:44 +0100 Subject: [PATCH 14/15] Fix. --- .github/workflows/cxx_apps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index 4078f866..c686f3b0 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -113,12 +113,12 @@ case "$(uname)" in "MINGW"*|"MSYS_NT"*) # Dredd can lead to object files with many sections, which can be too much for MSVC's default settings. # The /bigobj switch enables a larger number of sections. - CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=/w /bigobj") + CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=\"/w /bigobj\"") ;; "Darwin") # The Apple compiler does not use C++11 by default; Dredd requires at least this language version. - CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=-w -std=c++11") + CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=\"-w -std=c++11\"") ;; *) From a9ed16038e42286a130f9b889202e3093f2a4ddf Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 21:18:37 +0100 Subject: [PATCH 15/15] Fix. --- .github/workflows/cxx_apps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cxx_apps.sh b/.github/workflows/cxx_apps.sh index c686f3b0..020c1fbd 100755 --- a/.github/workflows/cxx_apps.sh +++ b/.github/workflows/cxx_apps.sh @@ -113,7 +113,7 @@ case "$(uname)" in "MINGW"*|"MSYS_NT"*) # Dredd can lead to object files with many sections, which can be too much for MSVC's default settings. # The /bigobj switch enables a larger number of sections. - CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=\"/w /bigobj\"") + CMAKE_OPTIONS_FOR_COMPILING_MUTATED_CODE=("-DCMAKE_CXX_FLAGS=\"/w /bigobj /EHsc\"") ;; "Darwin")