X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=all-tests;h=5c538542a164d0844e41c01d9e5f5415c45bf355;hb=e3ce3d767b284574087f630fb2a98d861811ced5;hp=0aa6370fcb6177c197483d072c960f10ed0fb60d;hpb=5e7ecb0746118946dd5b8ae877a33e671fdcfb9a;p=nepi.git diff --git a/all-tests b/all-tests index 0aa6370f..5c538542 100755 --- a/all-tests +++ b/all-tests @@ -4,18 +4,29 @@ # store results in a file that contains the git hash # and also shows differences if any # +# if this command is run as all-tests3, then we will just do +# make PYTHON=python3 +# +# xxx - WARNING : most likely the python2 and python3 tests +# cannot safely be run together; need to check the nepi exp_ids +# used more closely + +COMMAND=$(basename $0) -targets="test-node test-app" +PYTHON=python +version=2 +echo $COMMAND | grep -q 3 && { PYTHON=python3; version=3; } hash=$(git log -n 1 | head -1 | sed -e 's,commit ,,' -e 's,\(........\).*,\1,') # compute output file name -output='all-tests.$hash' +output="zz.py$version.$hash" # if there is any pending change, use another name is_pristine="" -git diff HEAD | cmp --quiet - /dev/zero && is_pristine=true -[ -n "is_pristine" ] || output="$output-pending" +changes=$(git diff HEAD | wc -l); changes=$(echo $changes) +[ "$changes" == 0 ] && is_pristine=true +[ -n "$is_pristine" ] || output="$output-pending" function all_tests () { echo all-tests : begin at; date @@ -31,20 +42,31 @@ function all_tests () { echo ======================================== echo tests echo ======================================== - make all-tests + make PYTHON=$PYTHON all-tests echo ======================================== end=$(date +%s) echo all-tests : end at; date; echo total duration $(($end-$begin)) seconds } -all-tests >& $output +# WARNING: the current code for analyzing the output is not quite right +# I've seen cases where the tests session goes very badly - with broken imports for example +# but it's considered OK though +# we mght wish to take the opposite angle : check we have as many OK as expected +# but then the list of default targets should be declared here and not in Makefile +# in any case this is good enough for now + +all_tests >& $output retcod=$? # analyze this output for success or not success=$output.success failure=$output.failed -[ "$retcod" != 0 ] && { touch $failure; exit; } -grep -q '^FAIL' $output && { touch $failure; exit; } -touch $success; exit +if [ "$retcod" != 0 ]; then + touch $failure +elif grep -q '^FAIL' $output; then + touch $failure +else + touch $success +fi