Skip to content

Commit

Permalink
replace |& which is not widely supported (#1399)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tim0s committed Oct 19, 2023
1 parent 0755385 commit 6f471cf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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() {
Expand All @@ -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
Expand Down

0 comments on commit 6f471cf

Please sign in to comment.