add log_merge.sh script to generate per-testcase merged logs

Change-Id: Ife6153d2cc10f85e79e8df7a0e34a44648618976
This commit is contained in:
Harald Welte 2018-03-18 13:38:45 +01:00
parent 30010711f5
commit 5a78e109da
2 changed files with 32 additions and 0 deletions

View File

@ -6,6 +6,8 @@ TCPDUMP_START := $TTCN3_HACKS_PATH"/ttcn3-tcpdump-start.sh"
TCPDUMP_STOP := $TTCN3_HACKS_PATH"/ttcn3-tcpdump-stop.sh"
[LOGGING]
LogFile := "%e-%c-%h-%r.%s"
AppendFile := Yes;
SourceInfoFormat := Single;
LogSourceInfo := Yes;
LoggerPlugins := { JUnitLogger := "libjunitlogger2" }

30
log_merge.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/sh
# This script generates per-testcase merged logs.
# In order to work, you need to set the following test config:
# [LOGGING]
# LogFile := "%e-%c-%h-%r.%s"
#
# the output files will be called "Module-Testcase.merged"
if [ "x$1" == "x" ]; then
echo "You have to specify the Test Suite prefix"
exit 2
fi
BASE_NAME="$1"
LOG_FILES="$BASE_NAME*.log"
TEST_CASES=`ls -1 $LOG_FILES | awk 'BEGIN { FS = "-" } { print $2 }' | sort | uniq`
for t in $TEST_CASES; do
PREFIX="$BASE_NAME-$t"
OUTPUT="$PREFIX.merged"
ttcn3_logmerge $PREFIX-*.log > $OUTPUT
echo "Generated $OUTPUT"
done
if [ "$2" == "--rm" ]; then
echo "Removing Input log files !!!"
rm $LOG_FILES
fi