#!/usr/bin/env bash # IMPORTANT NOTE: command-runner.sh must be in your path! # Without arguments, attempts to run tests for all .ind files in the current or sub-directories. # You can alternatively pass a directory; the script will search for .ind files in that dir # and try to run the tests for them. # Script tries to capture test output to a temp file and grep for errors. If there are errors, # script will try to notify user and save the test output to ~/tmp/. ind_files_dir=$1 temp_file="~temptestoutput" for f in $(find $ind_files_dir -name '*.ind'); do command-runner.sh test run $f 2>&1 | tee -a $temp_file done echo echo echo "*******************************************************" error=$(grep -B 8 -A 5 ERROR $temp_file) if [[ -n "$error" ]]; then echo "ERROR IN TEST RUN" echo "$error" if [[ -f "$temp_file" ]]; then if [[ ! -d ~/tmp/ ]]; then mkdir ~/tmp/ fi mv $temp_file ~/tmp/ fi else echo "ALL TESTS PASSED" if [[ -f "$temp_file" ]]; then rm $temp_file fi fi echo echo