aboutsummaryrefslogtreecommitdiffstats
path: root/start-testsuite.sh
blob: 31bc891c2fe15d4a2b2d04036a8756aa02c3268a (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
44
45
46
#!/bin/sh

# Helper script to starte a TITAN-generated test suite, supporting
# dynamically linked suites to ensure JUNIT generation is possible.

if [ $# -lt 1 ]; then
	echo "You have to specify the test suite name"
	echo "Syntax example: $0 osmo-ttcn3-hacks/ggsn_tests/GGSN_Test ./GGSN_Test.cfg"
	exit 1
fi

SUITE=$1
SUITE_DIR="$(dirname "$SUITE")"
SUITE_NAME="$(basename "$SUITE")"
CFG="$SUITE_NAME.cfg"
if [ $# -gt 1 ]; then
	CFG=$2
fi

if [ $# -gt 2 ]; then
	TEST=$3
fi

TITAN_LIBRARY_PATH="/usr/lib/titan:/usr/ttcn3/lib"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SUITE_DIR:$TITAN_LIBRARY_PATH" ttcn3_start $SUITE $CFG $TEST

expected="$SUITE_DIR/expected-results.xml"
if [ ! -f "$expected" ]; then
  echo "No expected results found, not comparing outcome. ($expected)"
  exit 0
fi

# find the most recent junit output log here
last_log="$(ls -1tr junit*.log | tail -n 1)"
if [ ! -f "$last_log" ]; then
  echo "No junit log found."
  exit 1
fi

compare="$SUITE_DIR/../compare-results.sh"
if [ ! -x "$compare" ]; then
  echo "ERROR: cannot find $compare"
  exit 1
fi

"$compare" "$expected" "$last_log" $OSMO_TTCN3_COMPARE_ARGS