run-tests: prepare for new 'make test' output format
[msysgit.git] / share / msysGit / run-tests.sh
blob5ae4f37162155a5cc3b025151790f9485ff30439
1 #!/bin/sh
3 # This list was generated after a run of "make test" using generate_skip_list
5 export GIT_SKIP_TESTS='
8 #echo "$GIT_SKIP_TESTS" | tr '\n' ' '; exit
9 export NO_SVN_TESTS=t
10 case " $*" in
11 *' -j'*) ;;
12 *) PARALLEL_MAKE=-j5;;
13 esac
15 generate_skip_list () {
16 cd /git/t
17 for d in trash*
19 name=${d#trash directory.}
20 short=${name%%-*}
21 sh $name.sh |
22 sed -n "s/.*FAIL \([0-9]*\).*/$short.\1/p"
23 done
26 test generate_skip_list = "$1" && {
27 generate_skip_list
28 exit
31 get_test_name () {
32 echo "$*" | sed 's/.* \(t[0-9].*\)\.sh .*/\1/'
35 get_finished_tests () {
36 REMAINING_TESTS=
37 for t in $CURRENT_TESTS
39 f=$(grep failed t/test-results/${t%.sh}-[1-9]* 2> /dev/null)
40 if test ! -z "$f"
41 then
42 printf '%70s ' $(cd t && echo $t*.sh)
43 if test "failed 0" = "$f"
44 then
45 echo -e '\033[32mok\033[0m'
46 else
47 FAILED_TESTS="$FAILED_TESTS $t"
48 echo -e '\033[31mfailed\033[0m'
50 else
51 REMAINING_TESTS="$REMAINING_TESTS $t"
53 done
54 CURRENT_TESTS="$REMAINING_TESTS"
57 cd /git &&
58 echo make $PARALLEL_MAKE &&
59 (cd t &&
60 rm -rf test-results &&
61 time make $PARALLEL_MAKE -k "$@" < /dev/null) 2>&1 |
63 CURRENT_TESTS=
64 FAILED_TESTS=
65 while read line
67 case "$line" in
68 "*** t"*)
69 TEST_NAME=$(get_test_name "$line")
70 CURRENT_TESTS="$CURRENT_TESTS $TEST_NAME"
71 printf "Currently running $(echo "$CURRENT_TESTS" |
72 sed 's/-[^ ]*//g')\\r"
74 '* passed'*|'# passed'*)
75 get_finished_tests
77 esac
78 done
79 test -z "$FAILED_TESTS" || echo "These tests failed: $FAILED_TESTS"
80 test -z "$CURRENT_TESTS" || echo "Unfinished tests: $CURRENT_TESTS")