Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run single-file tests on Mac and Windows #144

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions .github/workflows/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,49 @@ pushd build
popd


case "$(uname)" in
"MINGW"*|"MSYS_NT"*)
# The following single-file tests give different expected results on Windows
# due to differences in how certain builtin types, such as size_t and
# uint64_t, expand. For simplicity, remove them before running single-file
# tests on Windows.
rm test/single_file/initializer_list.cc
rm test/single_file/initializer_list.cc.expected
rm test/single_file/initializer_list.cc.noopt.expected
rm test/single_file/add_type_aliases.c
rm test/single_file/add_type_aliases.c.expected
rm test/single_file/add_type_aliases.c.noopt.expected
rm test/single_file/add_type_aliases.cc
rm test/single_file/add_type_aliases.cc.expected
rm test/single_file/add_type_aliases.cc.noopt.expected
rm test/single_file/positive_int_as_minus_one.c
rm test/single_file/positive_int_as_minus_one.c.expected
rm test/single_file/positive_int_as_minus_one.c.noopt.expected
rm test/single_file/positive_int_as_minus_one.cc
rm test/single_file/positive_int_as_minus_one.cc.expected
rm test/single_file/positive_int_as_minus_one.cc.noopt.expected
;;

*)
;;
esac


case "$(uname)" in
"Linux")
# On Linux, run a few extra analyzes using the compile_commands.json file.
check_compile_commands.sh build/compile_commands.json
;;

"Darwin")
;;

"MINGW"*|"MSYS_NT"*)
"Darwin"|"MINGW"*|"MSYS_NT"*)
# On Mac and Windows, run the single-file tests
cp build/src/dredd/dredd third_party/clang+llvm/bin/
export DREDD_REPO_ROOT=$(pwd)
export PATH=${PATH}:${DREDD_REPO_ROOT}/scripts
export PATH=${DREDD_REPO_ROOT}/third_party/clang+llvm/bin:${PATH}
export CC=clang
export CXX=clang++
DREDD_SKIP_COPY_EXECUTABLE=1 ./scripts/check_single_file_tests.sh
;;

*)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ jobs:
# Manually list various Linux configurations.
include:
# gcc-10
- os: ubuntu-20.04
- os: ubuntu-18.04
config: Debug
linux_cc: gcc-10
linux_cxx: g++-10
- os: ubuntu-20.04
- os: ubuntu-18.04
config: Release
linux_cc: gcc-10
linux_cxx: g++-10
# clang-12
- os: ubuntu-20.04
- os: ubuntu-22.04
config: Debug
linux_cc: clang-12
linux_cxx: clang++-12
- os: ubuntu-20.04
- os: ubuntu-22.04
config: Release
linux_cc: clang-12
linux_cxx: clang++-12
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/c_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DREDD_LLVM_TAG=$(./scripts/llvm_tag.sh)

# Install clang.
pushd ./third_party/clang+llvm
curl -fsSL -o clang+llvm.zip "https://github.com/mc-imperial/build-clang/releases/download/llvmorg-${DREDD_LLVM_TAG}/build-clang-llvmorg-${DREDD_LLVM_TAG}-ubuntu-20.04_x64_Release.zip"
curl -fsSL -o clang+llvm.zip "https://github.com/mc-imperial/build-clang/releases/download/llvmorg-${DREDD_LLVM_TAG}/build-clang-llvmorg-${DREDD_LLVM_TAG}-ubuntu-22.04_x64_Release.zip"
unzip clang+llvm.zip
rm clang+llvm.zip
popd
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/c_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: cancel_previous
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cxx_apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DREDD_LLVM_TAG=$(./scripts/llvm_tag.sh)

# Install clang.
pushd ./third_party/clang+llvm
curl -fsSL -o clang+llvm.zip "https://github.com/mc-imperial/build-clang/releases/download/llvmorg-${DREDD_LLVM_TAG}/build-clang-llvmorg-${DREDD_LLVM_TAG}-ubuntu-20.04_x64_Release.zip"
curl -fsSL -o clang+llvm.zip "https://github.com/mc-imperial/build-clang/releases/download/llvmorg-${DREDD_LLVM_TAG}/build-clang-llvmorg-${DREDD_LLVM_TAG}-ubuntu-22.04_x64_Release.zip"
unzip clang+llvm.zip
rm clang+llvm.zip
popd
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cxx_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: cancel_previous
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ DREDD_LLVM_TAG=$(./scripts/llvm_tag.sh)

# Install clang.
pushd ./third_party/clang+llvm
curl -fsSL -o clang+llvm.zip "https://github.com/mc-imperial/build-clang/releases/download/llvmorg-${DREDD_LLVM_TAG}/build-clang-llvmorg-${DREDD_LLVM_TAG}-ubuntu-20.04_x64_Release.zip"
curl -fsSL -o clang+llvm.zip "https://github.com/mc-imperial/build-clang/releases/download/llvmorg-${DREDD_LLVM_TAG}/build-clang-llvmorg-${DREDD_LLVM_TAG}-ubuntu-22.04_x64_Release.zip"
unzip clang+llvm.zip
rm clang+llvm.zip
popd
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: cancel_previous
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_one_single_file_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ do
if [ -z "${DREDD_REGENERATE_TEST_CASE+x}" ]
then
# Check that the mutated test case is as expected
diff "${copy_of_f}" "${DREDD_EXPECTED_FILE}"
diff --strip-trailing-cr "${copy_of_f}" "${DREDD_EXPECTED_FILE}"
fi

# Check that the mutated file compiles
Expand Down
11 changes: 7 additions & 4 deletions scripts/check_single_file_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ then
DREDD_INSTALLED_EXECUTABLE="${DREDD_REPO_ROOT}/third_party/clang+llvm/bin/dredd"

cd "${DREDD_REPO_ROOT}"

# Ensure that Dredd is in its installed location. This depends on a
# debug build being available
cp temp/build-Debug/src/dredd/dredd "${DREDD_INSTALLED_EXECUTABLE}"

if [ -z "${DREDD_SKIP_COPY_EXECUTABLE+x}" ]
then
# Ensure that Dredd is in its installed location. This depends on a
# debug build being available
cp temp/build-Debug/src/dredd/dredd "${DREDD_INSTALLED_EXECUTABLE}"
fi

# Avoid copying Dredd to its installed location when invoking the script that
# checks a single test.
Expand Down