all-tests to properly add '-pending' when needed
[nepi.git] / all-tests
index 0aa6370..419614a 100755 (executable)
--- a/all-tests
+++ b/all-tests
@@ -10,12 +10,13 @@ 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'
+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"
+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
@@ -37,14 +38,18 @@ function all_tests () {
     echo all-tests : end at; date; echo total duration $(($end-$begin)) seconds
 }
 
-all-tests >& $output
+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