From: Matthias Kretz <kr...@kde.org>
libstdc++-v3/ChangeLog:
* testsuite/experimental/simd/driver.sh (verify_test): Print
test output on run xfail. Do not repeat lines from the log that
were already printed on stdout.
(test_selector): Make the compiler flags pattern usable as a
substring selector.
(toplevel): Trap on SIGINT and remove the log and sum files.
Call timout with --foreground to quickly terminate on SIGINT.
* testsuite/experimental/simd/generate_makefile.sh: Simplify run
targets via target patterns. Default DRIVEROPTS to -v for run
targets. Remove log and sum files after completion of the run
target (so that it's always recompiled).
Place help text into text file for reasonable 'make help'
performance.
---
.../testsuite/experimental/simd/driver.sh | 16 +++--
.../experimental/simd/generate_makefile.sh | 70 +++++++++----------
2 files changed, 44 insertions(+), 42 deletions(-)
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
std::experimental::simd https://github.com/VcDevel/std-simd
──────────────────────────────────────────────────────────────────────────
diff --git a/libstdc++-v3/testsuite/experimental/simd/driver.sh b/libstdc++-v3/testsuite/experimental/simd/driver.sh
index 84f3829c2d4..cf07ff9ad85 100755
--- a/libstdc++-v3/testsuite/experimental/simd/driver.sh
+++ b/libstdc++-v3/testsuite/experimental/simd/driver.sh
@@ -224,16 +224,17 @@ verify_test() {
fail "timeout: execution test"
elif [ "$xfail" = "run" ]; then
xfail "execution test"
- exit 0
else
fail "execution test"
fi
if $verbose; then
- if [ $(cat "$log"|wc -l) -gt 1000 ]; then
+ lines=$(wc -l < "$log")
+ lines=$((lines-3))
+ if [ $lines -gt 1000 ]; then
echo "[...]"
tail -n1000 "$log"
else
- cat "$log"
+ tail -n$lines "$log"
fi
elif ! $quiet; then
grep -i fail "$log" | head -n5
@@ -267,7 +268,7 @@ test_selector() {
[ -z "$target_triplet" ] && target_triplet=$($CXX -dumpmachine)
if matches "$target_triplet" "$pat_triplet"; then
pat_flags="${string#* }"
- if matches "$CXXFLAGS" "$pat_flags"; then
+ if matches "$CXXFLAGS" "*$pat_flags*"; then
return 0
fi
fi
@@ -276,6 +277,7 @@ test_selector() {
return 1
}
+trap "rm -f '$log' '$sum'; exit" INT
rm -f "$log" "$sum"
touch "$log" "$sum"
@@ -316,15 +318,15 @@ if [ -n "$xfail" ]; then
fi
write_log_and_verbose "$CXX $src $@ -D_GLIBCXX_SIMD_TESTTYPE=$type $abiflag -o $exe"
-timeout $timeout "$CXX" "$src" "$@" "-D_GLIBCXX_SIMD_TESTTYPE=$type" $abiflag -o "$exe" >> "$log" 2>&1
+timeout --foreground $timeout "$CXX" "$src" "$@" "-D_GLIBCXX_SIMD_TESTTYPE=$type" $abiflag -o "$exe" >> "$log" 2>&1
verify_compilation $?
if [ -n "$sim" ]; then
write_log_and_verbose "$sim ./$exe"
- timeout $timeout $sim "./$exe" >> "$log" 2>&1 <&-
+ timeout --foreground $timeout $sim "./$exe" >> "$log" 2>&1 <&-
else
write_log_and_verbose "./$exe"
timeout=$(awk "BEGIN { print int($timeout / 2) }")
- timeout $timeout "./$exe" >> "$log" 2>&1 <&-
+ timeout --foreground $timeout "./$exe" >> "$log" 2>&1 <&-
fi
verify_test $?
diff --git a/libstdc++-v3/testsuite/experimental/simd/generate_makefile.sh b/libstdc++-v3/testsuite/experimental/simd/generate_makefile.sh
index 553bc98f60b..8d642a2941a 100755
--- a/libstdc++-v3/testsuite/experimental/simd/generate_makefile.sh
+++ b/libstdc++-v3/testsuite/experimental/simd/generate_makefile.sh
@@ -240,7 +240,7 @@ EOF
%-$type.log: %-$type-0.log %-$type-1.log %-$type-2.log %-$type-3.log \
%-$type-4.log %-$type-5.log %-$type-6.log %-$type-7.log \
%-$type-8.log %-$type-9.log
- @cat $^ > \$@
+ @cat \$^ > \$@
@cat \$(^:log=sum) > \$(@:log=sum)${rmline}
EOF
@@ -252,47 +252,47 @@ EOF
EOF
done
done
- echo 'run-%: export GCC_TEST_RUN_EXPENSIVE=yes'
- all_tests | while read file && read name; do
- echo "run-$name: $name.log"
- all_types "$file" | while read t && read type; do
- echo "run-$name-$type: $name-$type.log"
- for i in $(seq 0 9); do
- echo "run-$name-$type-$i: $name-$type-$i.log"
- done
- done
- echo
- done
cat <<EOF
-help:
- @printf "use DRIVEROPTS=<options> to pass the following options:\n"\\
- "-q, --quiet Only print failures.\n"\\
- "-v, --verbose Print compiler and test output on failure.\n"\\
- "-k, --keep-failed Keep executables of failed tests.\n"\\
- "--sim <executable> Path to an executable that is prepended to the test\n"\\
- " execution binary (default: the value of\n"\\
- " GCC_TEST_SIMULATOR).\n"\\
- "--timeout-factor <x>\n"\\
- " Multiply the default timeout with x.\n"\\
- "--run-expensive Compile and run tests marked as expensive (default:\n"\\
- " true if GCC_TEST_RUN_EXPENSIVE is set, false otherwise).\n"\\
- "--only <pattern> Compile and run only tests matching the given pattern.\n\n"
- @echo "use TESTFLAGS=<flags> to pass additional compiler flags"
- @echo
- @echo "The following are some of the valid targets for this Makefile:"
- @echo "... all"
- @echo "... clean"
- @echo "... help"
+run-%: export GCC_TEST_RUN_EXPENSIVE=yes
+run-%: DRIVEROPTS=-v
+run-%: %.log
+ @rm \$^ \$(^:log=sum)
+
+help: .make_help.txt
+ @cat \$<
+
+EOF
+ dsthelp="${dst%Makefile}.make_help.txt"
+ cat <<EOF > "$dsthelp"
+use DRIVEROPTS=<options> to pass the following options:
+-q, --quiet Only print failures.
+-v, --verbose Print compiler and test output on failure.
+-k, --keep-failed Keep executables of failed tests.
+--sim <executable> Path to an executable that is prepended to the test
+ execution binary (default: the value of
+ GCC_TEST_SIMULATOR).
+--timeout-factor <x>
+ Multiply the default timeout with x.
+--run-expensive Compile and run tests marked as expensive (default:
+ true if GCC_TEST_RUN_EXPENSIVE is set, false otherwise).
+--only <pattern> Compile and run only tests matching the given pattern.
+
+use TESTFLAGS=<flags> to pass additional compiler flags
+
+The following are some of the valid targets for this Makefile:
+... all
+... clean
+... help"
EOF
all_tests | while read file && read name; do
- printf "\t@echo '... run-${name}'\n"
+ echo "... run-${name}"
all_types | while read t && read type; do
- printf "\t@echo '... run-${name}-${type}'\n"
+ echo "... run-${name}-${type}"
for i in $(seq 0 9); do
- printf "\t@echo '... run-${name}-${type}-$i'\n"
+ echo "... run-${name}-${type}-$i"
done
done
- done
+ done >> "$dsthelp"
cat <<EOF
clean: