pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40383?usp=email )
Change subject: log_merge.sh: Merge all logs if no test cases are found
......................................................................
log_merge.sh: Merge all logs if no test cases are found
This can happen for instance if titan exits with an error during startup
even before starting any test.
In that scenario, titan still writes stuff to a file (eg.
C5G_Tests--efc28eab6a6d-hc-1305.log).
Let's try to make everything logged available in that case, so user can
debug what went wrong.
Change-Id: Ifc68e42022e8b2990d3c5221b3901f255e4e759b
---
M log_merge.sh
1 file changed, 15 insertions(+), 10 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, approved
diff --git a/log_merge.sh b/log_merge.sh
index 65a3003..85ec0c3 100755
--- a/log_merge.sh
+++ b/log_merge.sh
@@ -51,16 +51,21 @@
TEST_CASES=$(ls -1 $LOG_FILES | awk 'BEGIN { FS = "-" } { print $2 }' |
sort | uniq)
-for t in $TEST_CASES; do
- PREFIX="$BASE_NAME-$t"
- OUTPUT="$(get_new_prefix "$PREFIX").merged"
- if [ -e "$OUTPUT" ]; then
- >&2 echo "log_merge: ERROR: file already exists: $OUTPUT"
- exit 1
- fi
- ttcn3_logmerge $PREFIX-*.log > "$OUTPUT"
- echo "Generated $OUTPUT"
-done
+if [ -n "$TEST_CASES" ]; then
+ for t in $TEST_CASES; do
+ PREFIX="$BASE_NAME-$t"
+ OUTPUT="$(get_new_prefix "$PREFIX").merged"
+ if [ -e "$OUTPUT" ]; then
+ >&2 echo "log_merge: ERROR: file already exists: $OUTPUT"
+ exit 1
+ fi
+ ttcn3_logmerge $PREFIX-*.log > "$OUTPUT"
+ echo "Generated $OUTPUT"
+ done
+else
+ >&2 echo "log_merge: WARNING: Couldn't find logs for test cases! Merging
everything"
+ ttcn3_logmerge $LOG_FILES > "$BASE_NAME.merged"
+fi
if [ "$2" = "--rm" ]; then
echo "Removing Input log files !!!"
--
To view, visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40383?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ifc68e42022e8b2990d3c5221b3901f255e4e759b
Gerrit-Change-Number: 40383
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>