From: Maciej Slodczyk Date: Fri, 25 May 2018 20:25:09 +0000 (+0200) Subject: testsuite: add util print formats tests X-Git-Tag: accepted/tizen/unified/20180619.142039~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F88%2F180088%2F7;p=platform%2Fcore%2Fsystem%2Fdlog.git testsuite: add util print formats tests Change-Id: Ia70b9a7be31e5eeecfc9506a24587993cdad2c43 Signed-off-by: Maciej Slodczyk --- diff --git a/tests/dlog_test_pipe.in b/tests/dlog_test_pipe.in index 4e99061..77fd0b5 100644 --- a/tests/dlog_test_pipe.in +++ b/tests/dlog_test_pipe.in @@ -115,8 +115,78 @@ if [ -e $TESTDIR/dlog_rotating_file.4 ]; then fail; else ok; fi LOG_DETAILS="testing the size of log files" if [ $(du $TESTDIR/dlog_rotating_file.3 | sed "s#$TESTDIR/dlog_rotating_file.3##g") -eq 16 ]; then ok; else fail; fi # the actual size is one sector more (so 12 -> 16) because the limit is checked after reaching it, not before -# Test -v -# TODO +cmd="dlogutil -t 1 -v " + +format="process" +regex_prio="[VDIWEFS]{1}" +regex_pidtid="P[0-9[:space:]]{5,},\s{1}T[0-9[:space:]]{5,}" +regex_time="[0-9]{2}-[0-9]{2}\s{1}[0-9]{2}:[0-9]{2}:[0-9]{2}" +regex_timezone="[\+-]{1}[0-9]{4}" + +REGEX="s/^$regex_prio\([0-9[:space:]]{5,}\)[[:print:]]*\([[:print:]]*\)$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="tag" +REGEX="s/^$regex_prio\/[[:print:]]{9,}:\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="thread" +REGEX="s/^$regex_prio\($regex_pidtid\)\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="time" +REGEX="s/^$regex_time.[0-9]{3}$regex_timezone\s{1}$regex_prio\/[[:print:]]{8,}\([0-9[:space:]]{5,}\):\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="threadtime" +REGEX="s/^$regex_time.[0-9]{3}$regex_timezone\s{1}$regex_prio\/[[:print:]]{8,}\($regex_pidtid\):\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="kerneltime" +REGEX="s/^[0-9[:space:]]{1,}.[0-9]{3,}\s{1}$regex_prio\/[[:print:]]{8,}\($regex_pidtid\):\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="recv_realtime" +REGEX="s/^$regex_time.[0-9]{3}\s{1}$regex_prio\/[[:print:]]{8,}\($regex_pidtid\):\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="rwtime" +REGEX="s/^$regex_time\s{1}\[[0-9[:space:]]{3,}.[0-9[:space:]]{3,}\]\s{1}$regex_prio\/[[:print:]]{8,}\($regex_pidtid\):\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="long" +REGEX="s/^\[\s{1}$regex_time.[0-9]{3,}\s{1}$regex_prio\/[[:print:]]{8,}\s{1}$regex_pidtid\]\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | tr '\n' ' ' | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="brief" +REGEX="s/^$regex_prio\/[[:print:]]{8,}\([0-9[:space:]]{5,}\):\s{1}[[:print:]]*$/1/g" +LOG_DETAILS="testing if \"$format\" print format works" +line=`$cmd $format` +if [[ `echo "$line" | sed -re $REGEX` == "1" ]]; then ok; else fail; fi + +format="raw" +LOG_DETAILS="testing if \"$format\" print format works" +dlogsend -b main -t DLOG_TESTSUITE rawformatTEST +line=`$cmd $format` +if [[ "$line" == "rawformatTEST" ]]; then ok; else fail; fi LOG_DETAILS="testing if the library works with multithreaded app" dlogutil -f $TESTDIR/dlog_mt_test &