aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/testsuite.sh
blob: f4f938d3ed379ff11e168d27371cd313968f9884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash

cd "$(dirname $0)"
. ../utils.sh

run_suite () {
  . ../testenv.sh
  for d in */; do
      if [ -f $d/testsuite.sh ]; then
          printf "${ANSI_DARKCYAN}test $d ${ANSI_NOCOLOR}\n"
          cd $d
          if . ./testsuite.sh; then
              printf "${ANSI_GREEN}OK${ANSI_NOCOLOR}\n"
          else
              printf "${ANSI_RED}FAILED!${ANSI_NOCOLOR}\n"
              exit 1
          fi
          cd ..
      else
          printf "${ANSI_YELLOW}Skip $d (no testsuite.sh)${ANSI_NOCOLOR}\n"
      fi
      clean
  done
}

for d in */; do
    cd $d
    printf "${ANSI_CYAN}test $d ${ANSI_NOCOLOR}\n"
    if [ -f ./testsuite.sh ]; then
        if ./testsuite.sh; then
            printf "${ANSI_GREEN}OK${ANSI_NOCOLOR}\n"
        else
            printf "${ANSI_RED}FAILED!${ANSI_NOCOLOR}\n"
            exit 1
        fi
    else
        run_suite
    fi
    cd ..
done

printf "${ANSI_GREEN}All tests are OK${ANSI_NOCOLOR}\n"
exit 0