Skip to content

Commit

Permalink
Be selective about where to run which apps.
Browse files Browse the repository at this point in the history
  • Loading branch information
afd committed Oct 12, 2022
1 parent 13c9314 commit 0c0d007
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 52 deletions.
117 changes: 66 additions & 51 deletions .github/workflows/c_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ case "$(uname)" in
"Darwin")
NINJA_OS="mac"
SDKROOT=$(xcrun --show-sdk-path)
export SDKROOT
;;

"MINGW"*|"MSYS_NT"*)
Expand Down Expand Up @@ -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
3 changes: 2 additions & 1 deletion .github/workflows/cxx_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ case "$(uname)" in
"Darwin")
NINJA_OS="mac"
SDKROOT=$(xcrun --show-sdk-path)
export SDKROOT
;;

"MINGW"*|"MSYS_NT"*)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0c0d007

Please sign in to comment.