#!/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 if [ "$retcod" != 0 ]; then touch $failure elif grep -q '^FAIL' $output; then touch $failure else touch $success fi