Harald Welte | 5a78e10 | 2018-03-18 13:38:45 +0100 | [diff] [blame] | 1 | #!/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 Welte | 0cdf071 | 2019-06-19 18:15:38 +0200 | [diff] [blame] | 10 | # 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 Welte | b537461 | 2018-03-18 15:19:33 +0100 | [diff] [blame] | 25 | if [ "x$1" = "x" ]; then |
Harald Welte | 5a78e10 | 2018-03-18 13:38:45 +0100 | [diff] [blame] | 26 | echo "You have to specify the Test Suite prefix" |
| 27 | exit 2 |
| 28 | fi |
| 29 | |
| 30 | BASE_NAME="$1" |
| 31 | LOG_FILES="$BASE_NAME*.log" |
| 32 | |
Harald Welte | b537461 | 2018-03-18 15:19:33 +0100 | [diff] [blame] | 33 | TEST_CASES=$(ls -1 $LOG_FILES | awk 'BEGIN { FS = "-" } { print $2 }' | sort | uniq) |
Harald Welte | 5a78e10 | 2018-03-18 13:38:45 +0100 | [diff] [blame] | 34 | |
| 35 | for t in $TEST_CASES; do |
Harald Welte | e1f9b74 | 2018-03-18 15:13:09 +0100 | [diff] [blame] | 36 | PREFIX="$BASE_NAME-$t" |
| 37 | OUTPUT="$BASE_NAME.$t.merged" |
Harald Welte | b537461 | 2018-03-18 15:19:33 +0100 | [diff] [blame] | 38 | ttcn3_logmerge $PREFIX-*.log > "$OUTPUT" |
Harald Welte | 5a78e10 | 2018-03-18 13:38:45 +0100 | [diff] [blame] | 39 | echo "Generated $OUTPUT" |
| 40 | done |
| 41 | |
Harald Welte | b537461 | 2018-03-18 15:19:33 +0100 | [diff] [blame] | 42 | if [ "$2" = "--rm" ]; then |
Harald Welte | 5a78e10 | 2018-03-18 13:38:45 +0100 | [diff] [blame] | 43 | echo "Removing Input log files !!!" |
Pau Espin Pedrol | feb6fa4 | 2018-03-20 22:06:17 +0100 | [diff] [blame] | 44 | rm $LOG_FILES |
Harald Welte | 5a78e10 | 2018-03-18 13:38:45 +0100 | [diff] [blame] | 45 | fi |