Fix comment in context.h
[babeltrace.git] / tests / runall.sh
1 #!/bin/bash
2
3 TESTDIR=$(dirname $0)
4 DIR=$(readlink -f ${TESTDIR})
5 BABELTRACE_BIN=${DIR}/../converter/babeltrace
6 CTF_TRACES=${DIR}/ctf-traces
7
8 function print_ok ()
9 {
10 # Check if we are a terminal
11 if [ -t 1 ]; then
12 echo -e "\e[1;32mOK\e[0m"
13 else
14 echo -e "OK"
15 fi
16 }
17
18 function print_fail ()
19 {
20 # Check if we are a terminal
21 if [ -t 1 ]; then
22 echo -e "\e[1;31mFAIL\e[0m"
23 else
24 echo -e "FAIL"
25 fi
26 }
27
28 function test_check ()
29 {
30 if [ $? -ne 0 ] ; then
31 print_fail
32 return 1
33 else
34 print_ok
35 return 0
36 fi
37 }
38
39 function test_check_fail ()
40 {
41 if [ $? -ne 1 ] ; then
42 print_fail
43 return 1
44 else
45 print_ok
46 return 0
47 fi
48 }
49
50 function run_babeltrace ()
51 {
52 ${BABELTRACE_BIN} $* > /dev/null 2>&1
53 return $?
54 }
55
56 echo -e "Running test-bitfield..."
57 ./test-bitfield
58 test_check
59 if [ $? -ne 0 ]; then
60 exit 1
61 fi
62
63 #run babeltrace expects success
64 echo -e "Running babeltrace without argument..."
65 run_babeltrace
66 test_check
67 if [ $? -ne 0 ]; then
68 exit 1
69 fi
70
71 for a in ${CTF_TRACES}/succeed/*; do
72 echo -e "Running babeltrace for trace ${a}..."
73 run_babeltrace ${a}
74 test_check
75 if [ $? -ne 0 ]; then
76 exit 1
77 fi
78 done
79
80 #run babeltrace expects failure
81 echo -e "Running babeltrace with bogus argument..."
82 run_babeltrace --bogusarg
83 test_check_fail
84 if [ $? -ne 0 ]; then
85 exit 1
86 fi
87
88 for a in ${CTF_TRACES}/fail/*; do
89 echo -e "Running babeltrace for trace ${a}..."
90 run_babeltrace ${a}
91 test_check_fail
92 if [ $? -ne 0 ]; then
93 exit 1
94 fi
95 done
96
97 exit 0
This page took 0.031039 seconds and 4 git commands to generate.