From 5e7ecb0746118946dd5b8ae877a33e671fdcfb9a Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sun, 1 Nov 2015 10:53:03 +0100 Subject: [PATCH] convenience script all-tests to run all available tests and store result --- Makefile | 3 +++ all-tests | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100755 all-tests diff --git a/Makefile b/Makefile index 1d47ef48..ed7f32d3 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,9 @@ test-one: all PYTHONPATH="$(PYPATH)" $(PYTHON) $(file) $(case) endif + +all-tests: test-app test-node + test-app: $(MAKE) test-one file=test/resources/linux/application.py case=$(case) test-node: diff --git a/all-tests b/all-tests new file mode 100755 index 00000000..0aa6370f --- /dev/null +++ b/all-tests @@ -0,0 +1,50 @@ +#!/bin/bash +# +# helper script to run some predefined set of tests +# store results in a file that contains the git hash +# and also shows differences if any +# + +targets="test-node test-app" + +hash=$(git log -n 1 | head -1 | sed -e 's,commit ,,' -e 's,\(........\).*,\1,') + +# compute output file name +output='all-tests.$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" + +function all_tests () { + echo all-tests : begin at; date + begin=$(date +%s) + echo ======================================== + echo status + echo ======================================== + echo ===== Current hash $hash + echo ===== Current branch + git branch + echo ===== Uncommitted changes + git diff HEAD + echo ======================================== + echo tests + echo ======================================== + make all-tests + echo ======================================== + end=$(date +%s) + echo all-tests : end at; date; echo total duration $(($end-$begin)) seconds +} + +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 + -- 2.43.0