add log_merge.sh script to generate per-testcase merged logs
Change-Id: Ife6153d2cc10f85e79e8df7a0e34a44648618976
diff --git a/log_merge.sh b/log_merge.sh
new file mode 100755
index 0000000..d57ab99
--- /dev/null
+++ b/log_merge.sh
@@ -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