diff options
author | 2015-09-09 22:15:21 -0700 | |
---|---|---|
committer | 2015-09-09 22:15:21 -0700 | |
commit | 13d05bc8458758ee39cb829098241e89616717ee (patch) | |
tree | 22a4d1ce65f15952f07a3df5af4b462b4697cb3a /framework/src/onos/tools/test/bin/onos-check-logs | |
parent | 6139282e1e93c2322076de4b91b1c85d0bc4a8b3 (diff) |
ONOS checkin based on commit tag e796610b1f721d02f9b0e213cf6f7790c10ecd60
Change-Id: Ife8810491034fe7becdba75dda20de4267bd15cd
Diffstat (limited to 'framework/src/onos/tools/test/bin/onos-check-logs')
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-check-logs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/framework/src/onos/tools/test/bin/onos-check-logs b/framework/src/onos/tools/test/bin/onos-check-logs new file mode 100755 index 00000000..ec1013ab --- /dev/null +++ b/framework/src/onos/tools/test/bin/onos-check-logs @@ -0,0 +1,60 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Checks the logs of the remote ONOS instance and makes sure they are clean. +# ----------------------------------------------------------------------------- + +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 +. $ONOS_ROOT/tools/build/envDefaults + +remote=$ONOS_USER@${1:-$OCI} + +LOG=$ONOS_INSTALL_DIR/log/karaf.log* + +aux=/tmp/log.$$ + +if [ "$2" = "old" ]; then + ssh $remote "egrep 'ERROR|Exception|Error' $LOG" + +else + ssh $remote " + tac $LOG | awk ' + BEGIN { off = 0; fail = 0; } + / org.apache.karaf.main.lock.SimpleFileLock lock/ { + off = 1; + exit fail; + } + + / ERROR / { + if (!off) { + print \$0; + exc = 0; + fail = 1; + } + } + / WARN / { + if (!off && exc) { + print \$0; + exc = 0; + } + } + + /^[a-zA-Z0-9.]*(Exception|Error)/ { + if (!off) { + print \$0; + exc = 1; + fail = 1; + } + } + + / at / { + if (!off) { + print \$0; + } + } + END { exit fail; } + ' > $aux + status=\$? + tac $aux && rm $aux + exit \$status + " +fi |