testsuite: add more descriptive output 87/180087/5
authorMaciej Slodczyk <m.slodczyk2@partner.samsung.com>
Fri, 25 May 2018 19:41:29 +0000 (21:41 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Wed, 30 May 2018 11:38:25 +0000 (13:38 +0200)
Change-Id: I5d9555fa2f476f4f62da6cf9e5ee93ad17abaa7f
Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
tests/dlog_test_pipe.in

index 8d0fcab..b76d476 100644 (file)
@@ -4,6 +4,7 @@
 FAILS=0
 OKS=0
 TOTAL=0
+LOG_DETAILS=
 
 #relevant pids default vals
 UTIL_PID=-1
@@ -24,13 +25,15 @@ trap cleanup 0
 fail(){
        FAILS=$(($FAILS + 1))
        TOTAL=$(($TOTAL + 1))
-       echo "#$TOTAL: FAILED"
+       printf "[%02d] FAILED: %s\n" $TOTAL "$LOG_DETAILS"
+       LOG_DETAILS=
 }
 
 ok(){
        OKS=$(($OKS + 1))
        TOTAL=$(($TOTAL + 1))
-       echo "#$TOTAL: PASSED"
+       printf "[%02d] PASSED: %s\n" $TOTAL "$LOG_DETAILS"
+       LOG_DETAILS=
 }
 
 export DLOG_CONFIG_PATH="@datadir@/dlog.conf.test"
@@ -44,52 +47,77 @@ sleep 1
 test_libdlog 100
 sleep 1
 
-# 1-4: test -d and -t
+
+LOG_DETAILS="testing if dlogutil -d exits with success after printing logs"
 dlogutil -d &> /dev/null && ok || fail
+
+LOG_DETAILS="testing if limiting printed log entries to less than exists in the buffer returns proper value"
 if [ $(dlogutil -t  20 | wc -l) -eq  20 ]; then ok; else fail; fi # less logs than currently in buffer
+
+LOG_DETAILS="testing if limiting printed log entries to more than exists in the buffer returns proper value"
 if [ $(dlogutil -t 200 | wc -l) -eq 100 ]; then ok; else fail; fi # more
+
+LOG_DETAILS="testing if dlogutil returns exact amount of entries as there is in the buffer"
 if [ $(dlogutil -d     | wc -l) -eq 100 ]; then ok; else fail; fi # exactly
 
-# 5-6: test -b
+LOG_DETAILS="testing if reading from  dummy buffer returns an error as expected"
 dlogutil -b nonexistent_buffer &> /dev/null && fail || ok
-if [ $(dlogutil -d -b apps | wc -l) -eq 0 ]; then ok; else fail; fi # the logs should be in another buffer
 
-# 7-8: test -c
+LOG_DETAILS="testing if reading from \"apps\" buffer returns zero entries (logs are in the \"main\" buffer)"
+if [ $(dlogutil -d -b apps | wc -l) -eq 0 ]; then ok; else fail; fi
+
+LOG_DETAILS="testing if dlogutil -c empties all buffers"
 dlogutil -c && ok || fail
+
+LOG_DETAILS="testing if writing entries to empty buffer and reading them returns proper amount of entries"
 test_libdlog 10
 if [ $(dlogutil -d | wc -l) -eq 10 ]; then ok; else fail; fi # should be 10, not 110
 
-# 9: test filters
+LOG_DETAILS="testing if filters work"
 if [ $(dlogutil -d *:E | wc -l) -eq 5 ]; then ok; else fail; fi # half of current logs (test_libdlog alternates between error and info log levels)
 
-# 10: test -s
+LOG_DETAILS="testing if adding \"silent\" filter works"
 if [ $(dlogutil -s -d | wc -l) -eq 0 ]; then ok; else fail; fi
 
-# 11: test -g
+LOG_DETAILS="testing if reading buffer size returns proper exit code"
 dlogutil -g &> /dev/null && ok || fail
 
-# 12-19: test -f, -r and -n
+LOG_DETAILS="testing if writing all entries to single file works (-f)"
 dlogutil -f $TESTDIR/dlog_test_file -d &> /dev/null && ok || fail
+
+LOG_DETAILS="testing if writing entries to rotating files works (-r/-n)"
 dlogutil -f $TESTDIR/dlog_rotating_file -r 12 -n 3 & # 3 files at 12 KB each
 UTIL_PID=$!
 test_libdlog 100000
 sleep 1
+
+LOG_DETAILS="testing if single file is properly created"
 if [ -e $TESTDIR/dlog_test_file ]; then ok; else fail; fi
+
+LOG_DETAILS="testing if rotating file is properly created (1/4)"
 if [ -e $TESTDIR/dlog_rotating_file.1 ]; then ok; else fail; fi
+
+LOG_DETAILS="testing if rotating file is properly created (2/4)"
 if [ -e $TESTDIR/dlog_rotating_file.2 ]; then ok; else fail; fi
+
+LOG_DETAILS="testing if rotating file is properly created (3/4)"
 if [ -e $TESTDIR/dlog_rotating_file.3 ]; then ok; else fail; fi
+
+LOG_DETAILS="testing if rotating file is properly created (4/4)"
 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
 
-# 20: test library
+LOG_DETAILS="testing if the library works with multithreaded app"
 dlogutil -f $TESTDIR/dlog_mt_test &
 MT_TEST=$!
 test_libdlog && ok || fail
 
-# 21: test sorting
+LOG_DETAILS="testing if sorting by timestamp from random sources on heavy load works"
 dlogutil -c
 prev_ts=0
 unsorted=""