From 6f471cf6bf6c1c915bdf57f94fdeadfa14215395 Mon Sep 17 00:00:00 2001 From: Timo Schneider Date: Thu, 19 Oct 2023 16:17:36 +0200 Subject: [PATCH] replace |& which is not widely supported (#1399) The test_all.sh script currently runs cpp tests using g++. This is not good for the following reasons: * During normal DaCe compilation we use cmake (and thus whatever compiler cmake picks up). * We don't check if g++ is available. This change uses whatever the user set as CXX env var. Cmake also uses CXX when it is set. Thus if a user sets CXX, he will use the same compiler for tests and during dace compilation. If CXX is not set we fall back to g++ as the hard-coded compiler. The test script also prints the current progress before each test now. --- test_all.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test_all.sh b/test_all.sh index c4240fa820..cc34b74b36 100755 --- a/test_all.sh +++ b/test_all.sh @@ -3,6 +3,12 @@ set -a +if [[ -z "${CXX}" ]]; then + CXX="g++" # I don't think that is a good default, but it was the hardcoded compiler before I made changes... +else + CXX="${CXX}" +fi + SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" PYTHONPATH=$SCRIPTPATH @@ -53,7 +59,7 @@ bail_skip() { test_start() { TESTS=`expr $TESTS + 1` CURTEST="$TESTPREFIX$1" - echo "---------- TEST: $TESTPREFIX$1 ----------" + echo "---------- TEST: $TESTPREFIX$1 ---------- [ This is test $TESTS of $TOTAL_TESTS ]" } testcmd() { @@ -64,14 +70,14 @@ testcmd() { #$* | tee -a test.log TESTCNT=`expr $TESTS - 1` MSG="($TESTCNT / $TOTAL_TESTS) $CURTEST (Fails: $ERRORS)" - ($* || echo "_TFAIL_ $?") |& awk "BEGIN{printf \"$MSG\r\"} /_TFAIL_/{printf \"$TGAP\r\"; exit \$NF} {printf \"$TGAP\r\"; print; printf \"$MSG\r\";} END{printf \"$TGAP\r\"}" + ($* || echo "_TFAIL_ $?") 2>&1 | awk "BEGIN{printf \"$MSG\r\"} /_TFAIL_/{printf \"$TGAP\r\"; exit \$NF} {printf \"$TGAP\r\"; print; printf \"$MSG\r\";} END{printf \"$TGAP\r\"}" } ################################################ runtest_cpp() { test_start $1 - testcmd g++ -std=c++14 -Wall -Wextra -O3 -march=native -ffast-math -fopenmp -fPIC \ + testcmd $CXX -std=c++14 -Wall -Wextra -O3 -march=native -ffast-math -fopenmp -fPIC \ -I $SCRIPTPATH/dace/runtime/include $1 -o ./$1.out if [ $? -ne 0 ]; then bail "$1 (compilation)"; fi testcmd ./$1.out