blob: 886b7884fa9e152aa284f0a7ecd3df1b6bab68c4 [file] [log] [blame]
Harald Welte5a78e102018-03-18 13:38:45 +01001#!/bin/sh
2
3# This script generates per-testcase merged logs.
4# In order to work, you need to set the following test config:
5# [LOGGING]
6# LogFile := "%e-%c-%h-%r.%s"
7#
8# the output files will be called "Module-Testcase.merged"
9
Harald Welte0cdf0712019-06-19 18:15:38 +020010# Copyright 2018 Harald Welte
11# Copyright 2018 sysmocom - s.f.m.c. GmbH
12#
13# Licensed under the Apache License, Version 2.0 (the "License");
14# you may not use this file except in compliance with the License.
15# You may obtain a copy of the License at
16#
17# http://www.apache.org/licenses/LICENSE-2.0
18#
19# Unless required by applicable law or agreed to in writing, software
20# distributed under the License is distributed on an "AS IS" BASIS,
21# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22# See the License for the specific language governing permissions and
23# limitations under the License.
24
Harald Welteb5374612018-03-18 15:19:33 +010025if [ "x$1" = "x" ]; then
Harald Welte5a78e102018-03-18 13:38:45 +010026 echo "You have to specify the Test Suite prefix"
27 exit 2
28fi
29
30BASE_NAME="$1"
31LOG_FILES="$BASE_NAME*.log"
32
Harald Welteb5374612018-03-18 15:19:33 +010033TEST_CASES=$(ls -1 $LOG_FILES | awk 'BEGIN { FS = "-" } { print $2 }' | sort | uniq)
Harald Welte5a78e102018-03-18 13:38:45 +010034
35for t in $TEST_CASES; do
Harald Weltee1f9b742018-03-18 15:13:09 +010036 PREFIX="$BASE_NAME-$t"
37 OUTPUT="$BASE_NAME.$t.merged"
Harald Welteb5374612018-03-18 15:19:33 +010038 ttcn3_logmerge $PREFIX-*.log > "$OUTPUT"
Harald Welte5a78e102018-03-18 13:38:45 +010039 echo "Generated $OUTPUT"
40done
41
Harald Welteb5374612018-03-18 15:19:33 +010042if [ "$2" = "--rm" ]; then
Harald Welte5a78e102018-03-18 13:38:45 +010043 echo "Removing Input log files !!!"
Pau Espin Pedrolfeb6fa42018-03-20 22:06:17 +010044 rm $LOG_FILES
Harald Welte5a78e102018-03-18 13:38:45 +010045fi