blob: 54332bb49833e246bbd8b17f805a9005f7de4689 [file] [log] [blame]
Harald Welte4d772292017-08-19 15:27:10 +02001#!/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 Welte0cdf0712019-06-19 18:15:38 +02006# 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 Welte4d772292017-08-19 15:27:10 +020021if [ $# -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
25fi
26
27SUITE=$1
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020028SUITE_DIR="$(dirname "$SUITE")"
29SUITE_NAME="$(basename "$SUITE")"
30CFG="$SUITE_NAME.cfg"
Harald Welte4d772292017-08-19 15:27:10 +020031if [ $# -gt 1 ]; then
32 CFG=$2
33fi
34
Daniel Willmann47fb0f42018-02-02 20:09:00 +010035if [ $# -gt 2 ]; then
36 TEST=$3
37fi
38
Vadim Yanitskiyb3992812019-06-04 22:11:04 +070039TITAN_LIBRARY_PATH="/usr/lib/titan:/usr/ttcn3/lib"
40LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SUITE_DIR:$TITAN_LIBRARY_PATH" ttcn3_start $SUITE $CFG $TEST
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020041
Neels Hofmeyr1fd66792018-04-11 14:53:28 +020042expected="$SUITE_DIR/expected-results.xml"
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020043if [ ! -f "$expected" ]; then
44 echo "No expected results found, not comparing outcome. ($expected)"
45 exit 0
46fi
47
48# find the most recent junit output log here
49last_log="$(ls -1tr junit*.log | tail -n 1)"
50if [ ! -f "$last_log" ]; then
51 echo "No junit log found."
52 exit 1
53fi
54
55compare="$SUITE_DIR/../compare-results.sh"
56if [ ! -x "$compare" ]; then
57 echo "ERROR: cannot find $compare"
58 exit 1
59fi
60
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020061"$compare" "$expected" "$last_log" $OSMO_TTCN3_COMPARE_ARGS