File: run_all_tests.sh

package info (click to toggle)
mailsync 5.2.7-3.1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 916 kB
  • sloc: sh: 3,519; cpp: 2,199; ansic: 107; makefile: 89
file content (42 lines) | stat: -rwxr-xr-x 899 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

help() {
  echo "usage: run_all_tests.sh [--quiet] [--help]"
  echo
  echo "    run all test_*.sh tests found in scenario_* directories"
  echo
  echo "    --help  - show this help"
  echo "    --quiet - don't show test output, only whether it succeede"
  echo
  exit 1
}

[ "$1" == "--help"  ] && help
[ "$1" == "--quiet" ] && QUIET=true

RED='\033[0;31m'
GRN='\033[0;32m'
NC='\033[0m' # No Color

echo

for scenario in scenario_* ; do
  echo "*************************** Running tests in scenario '$scenario'"
  cd "$scenario"
  for tst in test_*.sh; do
    echo "================= Running tests '$tst'"

    if [ "$QUIET" == "true" ]; then
      ./$tst > /dev/null
    else
      ./$tst
    fi

    if [ "$?" == "0" ]; then
      printf "================= ${GRN}Success${NC}: '$tst'\n"
    else
      printf "================= ${RED}Failed${NC}: '$tst'\n"
    fi
  done
  cd ..
done