Tests: Split lib tests in multiple standalone test scripts
[babeltrace.git] / tests / runall.sh
... / ...
CommitLineData
1#!/bin/bash
2
3TESTDIR=$(dirname $0)
4DIR=$(readlink -f ${TESTDIR})
5BABELTRACE_BIN=${DIR}/../converter/babeltrace
6CTF_TRACES=${DIR}/ctf-traces
7
8function test_check_success ()
9{
10 if [ $? -ne 0 ] ; then
11 return 1
12 else
13 return 0
14 fi
15}
16
17function test_check_fail ()
18{
19 if [ $? -eq 0 ] ; then
20 return 1
21 else
22 return 0
23 fi
24}
25
26function run_babeltrace ()
27{
28 ${BABELTRACE_BIN} $* > /dev/null 2>&1
29 return $?
30}
31
32function print_test_result ()
33{
34 if [ $# -ne 3 ] ; then
35 echo "Invalid arguments provided"
36 exit 1
37 fi
38
39 if [ ${2} -eq 0 ] ; then
40 echo -n "ok"
41 else
42 echo -n "not ok"
43 fi
44 echo -e " "${1}" - "${3}
45}
46
47successTraces=(${CTF_TRACES}/succeed/*)
48failTraces=(${CTF_TRACES}/fail/*)
49testCount=$((2 + ${#successTraces[@]} + ${#failTraces[@]}))
50
51currentTestIndex=1
52echo -e 1..${testCount}
53
54#run babeltrace, expects success
55run_babeltrace
56test_check_success
57print_test_result $((currentTestIndex++)) $? "Running babeltrace without arguments"
58
59#run babeltrace with a bogus argument, expects failure
60run_babeltrace --bogusarg
61test_check_fail
62print_test_result $((currentTestIndex++)) $? "Running babeltrace with a bogus argument"
63
64for tracePath in ${successTraces[@]}; do
65 run_babeltrace ${tracePath}
66 test_check_success
67 print_test_result $((currentTestIndex++)) $? "Running babeltrace with trace ${tracePath}"
68done
69
70for tracePath in ${failTraces[@]}; do
71 run_babeltrace ${tracePath}
72 test_check_fail
73 print_test_result $((currentTestIndex++)) $? "Running babeltrace with trace ${tracePath}"
74done
75
76exit 0
This page took 0.023016 seconds and 4 git commands to generate.