From 0c0d007ce0e8431c3e00e5604c250213bba64d0e Mon Sep 17 00:00:00 2001 From: "Alastair F. Donaldson" Date: Wed, 12 Oct 2022 12:03:26 +0100 Subject: [PATCH] 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