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 | |
Harald Welte | 0cdf071 | 2019-06-19 18:15:38 +0200 | [diff] [blame] | 6 | # Copyright 2017 Harald Welte |
| 7 | # Copyright 2018 sysmocom - s.f.m.c. GmbH |
| 8 | # |
| 9 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | # you may not use this file except in compliance with the License. |
| 11 | # You may obtain a copy of the License at |
| 12 | # |
| 13 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | # |
| 15 | # Unless required by applicable law or agreed to in writing, software |
| 16 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | # See the License for the specific language governing permissions and |
| 19 | # limitations under the License. |
| 20 | |
Harald Welte | 4d77229 | 2017-08-19 15:27:10 +0200 | [diff] [blame] | 21 | if [ $# -lt 1 ]; then |
| 22 | echo "You have to specify the test suite name" |
| 23 | echo "Syntax example: $0 osmo-ttcn3-hacks/ggsn_tests/GGSN_Test ./GGSN_Test.cfg" |
| 24 | exit 1 |
| 25 | fi |
| 26 | |
| 27 | SUITE=$1 |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 28 | SUITE_DIR="$(dirname "$SUITE")" |
| 29 | SUITE_NAME="$(basename "$SUITE")" |
| 30 | CFG="$SUITE_NAME.cfg" |
Harald Welte | 4d77229 | 2017-08-19 15:27:10 +0200 | [diff] [blame] | 31 | if [ $# -gt 1 ]; then |
| 32 | CFG=$2 |
| 33 | fi |
| 34 | |
Daniel Willmann | 47fb0f4 | 2018-02-02 20:09:00 +0100 | [diff] [blame] | 35 | if [ $# -gt 2 ]; then |
| 36 | TEST=$3 |
| 37 | fi |
| 38 | |
Harald Welte | 97ae972 | 2019-07-16 19:29:49 +0900 | [diff] [blame] | 39 | # this is an example for using a non-installed custom (e.g. git master) TITAN |
| 40 | #TTCN3_DIR="/home/laforge/projects/git/titan/titan.core/Install" |
| 41 | #export TTCN3_DIR |
| 42 | #TITAN_LIBRARY_PATH="$TTCN3_DIR/lib" |
| 43 | #TTCN3_BIN_DIR="$TTCN3_DIR/bin" |
| 44 | |
| 45 | # below is for the debian packages |
| 46 | TTCN3_BIN_DIR="/usr/bin" |
Vadim Yanitskiy | b399281 | 2019-06-04 22:11:04 +0700 | [diff] [blame] | 47 | TITAN_LIBRARY_PATH="/usr/lib/titan:/usr/ttcn3/lib" |
Harald Welte | 97ae972 | 2019-07-16 19:29:49 +0900 | [diff] [blame] | 48 | LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SUITE_DIR:$TITAN_LIBRARY_PATH" "$TTCN3_BIN_DIR/ttcn3_start" $SUITE $CFG $TEST |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 49 | |
Neels Hofmeyr | 1fd6679 | 2018-04-11 14:53:28 +0200 | [diff] [blame] | 50 | expected="$SUITE_DIR/expected-results.xml" |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 51 | if [ ! -f "$expected" ]; then |
| 52 | echo "No expected results found, not comparing outcome. ($expected)" |
| 53 | exit 0 |
| 54 | fi |
| 55 | |
| 56 | # find the most recent junit output log here |
| 57 | last_log="$(ls -1tr junit*.log | tail -n 1)" |
| 58 | if [ ! -f "$last_log" ]; then |
| 59 | echo "No junit log found." |
| 60 | exit 1 |
| 61 | fi |
| 62 | |
Neels Hofmeyr | b26196b | 2019-10-22 01:54:43 +0200 | [diff] [blame] | 63 | compare="$SUITE_DIR/../compare-results.py" |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 64 | if [ ! -x "$compare" ]; then |
| 65 | echo "ERROR: cannot find $compare" |
| 66 | exit 1 |
| 67 | fi |
| 68 | |
Neels Hofmeyr | 3cf797d | 2018-04-05 16:56:38 +0200 | [diff] [blame] | 69 | "$compare" "$expected" "$last_log" $OSMO_TTCN3_COMPARE_ARGS |