Add tests to make check
[babeltrace.git] / tests / runall.sh
CommitLineData
607c826c
MD
1#!/bin/bash
2
3TESTDIR=$(dirname $0)
4DIR=$(readlink -f ${TESTDIR})
5BABELTRACE_BIN=${DIR}/../converter/babeltrace
6CTF_TRACES=${DIR}/ctf-traces
7
8function 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
18function 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
28function 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
39function 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
50function run_babeltrace ()
51{
52 ${BABELTRACE_BIN} $* > /dev/null 2>&1
53 return $?
54}
55
56echo -e "Running test-bitfield..."
57./test-bitfield
58test_check
59if [ $? -ne 0 ]; then
60 exit 1
61fi
62
63#run babeltrace expects success
64echo -e "Running babeltrace without argument..."
65run_babeltrace
66test_check
67if [ $? -ne 0 ]; then
68 exit 1
69fi
70
71for 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
78done
79
80#run babeltrace expects failure
81echo -e "Running babeltrace with bogus argument..."
82run_babeltrace --bogusarg
83test_check_fail
84if [ $? -ne 0 ]; then
85 exit 1
86fi
87
88for 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
95done
96
97exit 0
This page took 0.026292 seconds and 4 git commands to generate.