blob: 4b88501aa07d5f7095ac8512355ed481b0fbb35f [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
Oliver Smithb15f7502020-05-28 15:52:09 +02006# Environment variables:
7# * TTCN3_BIN_DIR: override where to look for ttcn3_start
8
Harald Welte0cdf0712019-06-19 18:15:38 +02009# Copyright 2017 Harald Welte
10# Copyright 2018 sysmocom - s.f.m.c. GmbH
11#
12# Licensed under the Apache License, Version 2.0 (the "License");
13# you may not use this file except in compliance with the License.
14# You may obtain a copy of the License at
15#
16# http://www.apache.org/licenses/LICENSE-2.0
17#
18# Unless required by applicable law or agreed to in writing, software
19# distributed under the License is distributed on an "AS IS" BASIS,
20# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21# See the License for the specific language governing permissions and
22# limitations under the License.
23
Harald Welte4d772292017-08-19 15:27:10 +020024if [ $# -lt 1 ]; then
25 echo "You have to specify the test suite name"
26 echo "Syntax example: $0 osmo-ttcn3-hacks/ggsn_tests/GGSN_Test ./GGSN_Test.cfg"
27 exit 1
28fi
29
30SUITE=$1
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020031SUITE_DIR="$(dirname "$SUITE")"
32SUITE_NAME="$(basename "$SUITE")"
33CFG="$SUITE_NAME.cfg"
Harald Welte4d772292017-08-19 15:27:10 +020034if [ $# -gt 1 ]; then
35 CFG=$2
36fi
37
Daniel Willmann47fb0f42018-02-02 20:09:00 +010038if [ $# -gt 2 ]; then
39 TEST=$3
40fi
41
Harald Welte97ae9722019-07-16 19:29:49 +090042# this is an example for using a non-installed custom (e.g. git master) TITAN
43#TTCN3_DIR="/home/laforge/projects/git/titan/titan.core/Install"
44#export TTCN3_DIR
45#TITAN_LIBRARY_PATH="$TTCN3_DIR/lib"
46#TTCN3_BIN_DIR="$TTCN3_DIR/bin"
47
Pau Espin Pedrolf4986e82023-03-01 19:02:48 +010048# Limit max num of open file descriptors to workaround titan.core bug:
49# https://gitlab.eclipse.org/eclipse/titan/titan.core/-/issues/690
50ulimit -n 100000
51
Harald Welte97ae9722019-07-16 19:29:49 +090052# below is for the debian packages
Oliver Smithb15f7502020-05-28 15:52:09 +020053TTCN3_BIN_DIR="${TTCN3_BIN_DIR:-/usr/bin}"
Vadim Yanitskiy02ad1912022-12-25 16:31:07 +070054TITAN_LIBRARY_PATH="${TITAN_LIBRARY_PATH:-/usr/lib/titan:/usr/ttcn3/lib}"
Harald Welte97ae9722019-07-16 19:29:49 +090055LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$SUITE_DIR:$TITAN_LIBRARY_PATH" "$TTCN3_BIN_DIR/ttcn3_start" $SUITE $CFG $TEST
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020056
Neels Hofmeyr1fd66792018-04-11 14:53:28 +020057expected="$SUITE_DIR/expected-results.xml"
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020058if [ ! -f "$expected" ]; then
59 echo "No expected results found, not comparing outcome. ($expected)"
60 exit 0
61fi
62
63# find the most recent junit output log here
64last_log="$(ls -1tr junit*.log | tail -n 1)"
65if [ ! -f "$last_log" ]; then
66 echo "No junit log found."
67 exit 1
68fi
69
Neels Hofmeyrb26196b2019-10-22 01:54:43 +020070compare="$SUITE_DIR/../compare-results.py"
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020071if [ ! -x "$compare" ]; then
72 echo "ERROR: cannot find $compare"
73 exit 1
74fi
75
Neels Hofmeyr3cf797d2018-04-05 16:56:38 +020076"$compare" "$expected" "$last_log" $OSMO_TTCN3_COMPARE_ARGS