Skip to content

Commit 25f5c9e

Browse files
committed
[CI] run-tests.sh now allows each compiler config to exclude test files that it doesn't want to run
There are 2 macOS test configs which share the same expected results directory (to avoid duplication). This works great except for the new `pure2-expected-is-as` test. This new test code fails to compile (as expected) on both compilers, but produces a slightly different error diagnostic because the path is different. E.g. /Applications/Xcode_14.3.1.app/...etc.../math.h and /Library/Developer/CommandLineTools/...etc.../math.h One option would be to stop sharing the expected results for both of these compilers, but that seems wasteful since it's just one test which fails to compile. So instead the `run-tests` script has a new way to exclude a test from running.
1 parent c05cb15 commit 25f5c9e

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

regression-tests/run-tests.sh

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -135,28 +135,11 @@ if [ -z "$label" ]; then
135135
usage
136136
fi
137137

138-
tests=$(ls | grep ".cpp2$")
139-
if [[ -n "$chosen_tests" ]]; then
140-
for test in $chosen_tests; do
141-
if ! [[ -f "$test" ]]; then
142-
echo "Requested test ($test) not found"
143-
exit 1
144-
fi
145-
done
146-
echo "Performing tests:"
147-
for test in $chosen_tests; do
148-
echo " $test"
149-
done
150-
echo
151-
tests="$chosen_tests"
152-
else
153-
printf "Performing all regression tests\n\n"
154-
fi
155-
156-
expected_results_dir="test-results"
157-
158138
################
159139
# Get the directory with the exec outputs and compilation command
140+
# We also allow each compiler configuration to specify any test files(s) to exclude from running.
141+
expected_results_dir="test-results"
142+
exclude_test_filter=""
160143
if [[ "$cxx_compiler" == *"cl.exe"* ]]; then
161144
compiler_cmd="cl.exe -nologo -std:${cxx_std} -MD -EHsc -I ..\..\..\include -Fe:"
162145
exec_out_dir="$expected_results_dir/msvc-2022-${cxx_std}"
@@ -174,6 +157,12 @@ else
174157
if [[ "$compiler_version" == *"Apple clang version 14.0"* ||
175158
"$compiler_version" == *"Homebrew clang version 15.0"* ]]; then
176159
exec_out_dir="$expected_results_dir/apple-clang-14"
160+
# We share the expected results dir for these two compilers, but there is one
161+
# test which (as expected) fails to compile on both compilers, but has a slightly
162+
# different error diagnostic because the clang path differs. So we exclude it from
163+
# running. The alternative would be to duplicate the expected results files, which
164+
# seems wasteful for just one test (that doesn't even compile).
165+
exclude_test_filter="pure2-expected-is-as.cpp2"
177166
elif [[ "$compiler_version" == *"Apple clang version 15.0"* ]]; then
178167
exec_out_dir="$expected_results_dir/apple-clang-15"
179168
elif [[ "$compiler_version" == *"clang version 12.0"* ]]; then
@@ -236,6 +225,30 @@ else
236225
exit 2
237226
fi
238227

228+
################
229+
# Get the list of .cpp2 test files
230+
if [[ -n "$exclude_test_filter" ]]; then
231+
tests=$(ls | grep ".cpp2$" | grep -v $exclude_test_filter)
232+
else
233+
tests=$(ls | grep ".cpp2$")
234+
fi
235+
if [[ -n "$chosen_tests" ]]; then
236+
for test in $chosen_tests; do
237+
if ! [[ -f "$test" ]]; then
238+
echo "Requested test ($test) not found"
239+
exit 1
240+
fi
241+
done
242+
echo "Performing tests:"
243+
for test in $chosen_tests; do
244+
echo " $test"
245+
done
246+
echo
247+
tests="$chosen_tests"
248+
else
249+
printf "Performing all regression tests\n\n"
250+
fi
251+
239252
################
240253
cppfront_cmd="cppfront.exe"
241254
echo "Building cppfront"

0 commit comments

Comments
 (0)