Harald Welte | 4d77229 | 2017-08-19 15:27:10 +0200 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Helper script to starte a TITAN-generated test suite, supporting |
| 4 | # dynamically linked suites to ensure JUNIT generation is possible. |
| 5 | |
| 6 | if [ $# -lt 1 ]; then |
| 7 | echo "You have to specify the test suite name" |
| 8 | echo "Syntax example: $0 osmo-ttcn3-hacks/ggsn_tests/GGSN_Test ./GGSN_Test.cfg" |
| 9 | exit 1 |
| 10 | fi |
| 11 | |
| 12 | SUITE=$1 |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 13 | SUITE_DIR="$(dirname "$SUITE")" |
| 14 | SUITE_NAME="$(basename "$SUITE")" |
| 15 | CFG="$SUITE_NAME.cfg" |
Harald Welte | 4d77229 | 2017-08-19 15:27:10 +0200 | [diff] [blame] | 16 | if [ $# -gt 1 ]; then |
| 17 | CFG=$2 |
| 18 | fi |
| 19 | |
Daniel Willmann | 47fb0f4 | 2018-02-02 20:09:00 +0100 | [diff] [blame] | 20 | if [ $# -gt 2 ]; then |
| 21 | TEST=$3 |
| 22 | fi |
| 23 | |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 24 | LD_LIBRARY_PATH="$SUITE_DIR:/usr/lib/titan:/usr/ttcn3/lib" ttcn3_start $SUITE $CFG $TEST |
| 25 | |
Neels Hofmeyr | 1fd6679 | 2018-04-11 14:53:28 +0200 | [diff] [blame] | 26 | expected="$SUITE_DIR/expected-results.xml" |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 27 | if [ ! -f "$expected" ]; then |
| 28 | echo "No expected results found, not comparing outcome. ($expected)" |
| 29 | exit 0 |
| 30 | fi |
| 31 | |
| 32 | # find the most recent junit output log here |
| 33 | last_log="$(ls -1tr junit*.log | tail -n 1)" |
| 34 | if [ ! -f "$last_log" ]; then |
| 35 | echo "No junit log found." |
| 36 | exit 1 |
| 37 | fi |
| 38 | |
| 39 | compare="$SUITE_DIR/../compare-results.sh" |
| 40 | if [ ! -x "$compare" ]; then |
| 41 | echo "ERROR: cannot find $compare" |
| 42 | exit 1 |
| 43 | fi |
| 44 | |
| 45 | set -e |
| 46 | "$compare" "$expected" "$last_log" $OSMO_TTCN3_COMPARE_ARGS |