From efb467ef6e5be401a83802c620dfafb71e2b4f04 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Mon, 21 Jan 2013 23:07:32 +0100 Subject: [PATCH] testsuite: Make target 3 to re-run tests 3 times. --- testsuite/Makefile | 6 +++++- testsuite/Start.sh | 23 +++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/testsuite/Makefile b/testsuite/Makefile index e7176fc2..37c12afe 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -2,6 +2,10 @@ testsuite: ../src/parallel tests-to-run/* wanted-results/* startdb prereqlocal p time sh Start.sh date +3: ../src/parallel tests-to-run/* wanted-results/* startdb prereqlocal prereqremote + TRIES=3 time sh Start.sh + date + testdb: ../src/parallel tests-to-run/*sql* wanted-results/*sql* prereqdb time sh Start.sh sql date @@ -52,7 +56,7 @@ portable: time bash Portable.sh timings: tests-to-run/* ../src/parallel - ls tests-to-run/*.sh | xargs -n1 echo /usr/bin/time -f %e bash >/tmp/timing.script + ls tests-to-run/*.sh | parallel echo /usr/bin/time -f %e bash >/tmp/timing.script stdout bash -x /tmp/timing.script | tee /tmp/timing.out echo usr.bin.time_END >>/tmp/timing.out perl -ne '/usr.bin.time/ and do { print $$last.$$h; $$h=$$_ }; chomp; $$last = $$_' /tmp/timing.out | sort -n >timings diff --git a/testsuite/Start.sh b/testsuite/Start.sh index 19647b7a..041f2497 100644 --- a/testsuite/Start.sh +++ b/testsuite/Start.sh @@ -5,16 +5,19 @@ export LANG=C SHFILE=/tmp/unittest-parallel.sh -# Run a failing test once -ls -t tests-to-run/*${1}*.sh \ -| perl -pe 's:(.*/(.*)).sh:bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 || touch $1.sh:' \ ->$SHFILE - -# Try a failing test thrice -# ls -t tests-to-run/*${1}*.sh \ -# | perl -pe 's:(.*/(.*)).sh:bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 >/dev/null || bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 >/dev/null || bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2: ' \ -# >$SHFILE - +if [ "$TRIES" = "3" ] ; then + # Try a failing test thrice + echo Retrying 3 times + ls -t tests-to-run/*${1}*.sh | + perl -pe 's:(.*/(.*)).sh:bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 >/dev/null || bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 >/dev/null || bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 || touch $1.sh: ' \ + >$SHFILE +else + # Run a failing test once + echo Not retrying + ls -t tests-to-run/*${1}*.sh | + perl -pe 's:(.*/(.*)).sh:bash $1.sh > actual-results/$2; diff -Naur wanted-results/$2 actual-results/$2 || touch $1.sh:' \ + >$SHFILE +fi mkdir -p actual-results stdout sh -x $SHFILE | tee testsuite.log