From: Mateusz Majewski Date: Wed, 17 Jun 2020 09:30:39 +0000 (+0200) Subject: Add padding tests for the pipe backend X-Git-Tag: accepted/tizen/unified/20200707.140855~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b6aed00cd2ff29a822eda2b31c331982b93dc8e;p=platform%2Fcore%2Fsystem%2Fdlog.git Add padding tests for the pipe backend Change-Id: I3ed63bf55e129f26af6a0418d3ea4a2390570686 --- diff --git a/tests/dlog_test.in b/tests/dlog_test.in index 10e07c4..687cfc7 100644 --- a/tests/dlog_test.in +++ b/tests/dlog_test.in @@ -573,6 +573,33 @@ dlogsend -b main -t DLOG_TESTSUITE rawformatTEST line=`$cmd_prefix $format` [[ "$line" == "rawformatTEST" ]] && ok || fail +if [ $type == "pipe" ]; then + for format in raw brief long; do + for i in {1..8} 10 15 20 25; do + LOG_DETAILS="testing if padding works correctly (format $format/count $i)" + log=$(printf '%0.s&' $(seq 1 $i)) # Print the '&' character $i times + + dlogutil -c + dlogsend -b main $log + line=$($cmd_prefix $format | tr '\n' '@') + + case $format in + raw) + REGEX="s/$log@/1/g" + ;; + brief) + REGEX="s/I\/DLOG_SEND\([0-9[:space:]]{5,}\):\s{1}$log@$/1/g" + ;; + long) + REGEX="s/\[\s{1}$regex_time.[0-9]{3,}\s{1}I\/DLOG_SEND\s{1}$regex_pidtid\]@$log@@/1/g" + ;; + esac + + [[ $(echo "$line" | sed -re $REGEX) == "1" ]] && ok || fail + done + done +fi + LOG_DETAILS="testing if KMSG works in the default format" # We check if the command returns at least 100 logs. This seems to be a safe value. # Feel free to change it to a reasonable yet lower value if the test happens to fail otherwise.