Fix the test script a bit 49/244249/2
authorMateusz Majewski <m.majewski2@samsung.com>
Wed, 16 Sep 2020 09:01:33 +0000 (11:01 +0200)
committerMichal Bloch <m.bloch@partner.samsung.com>
Wed, 16 Sep 2020 12:29:36 +0000 (12:29 +0000)
Don't call the ok and fail functions in a subshell. Bad idea.

Change-Id: Ic8c1dd12620773c700d4200385def2983d5bd59e

tests/dlog_test.in

index e39cc9b..5284cac 100644 (file)
@@ -944,7 +944,6 @@ if [ "$quick" -ne 1 ]; then
                # collect data and analyze timestamps
                dlogutil -b main -d -v $format | (
                        prev_ts=0
-                       unsorted=""
                        prev_line=""
 
                        while read -r line; do
@@ -960,14 +959,12 @@ if [ "$quick" -ne 1 ]; then
                                if [ "$ts" -ge "$prev_ts" ]; then
                                        prev_ts=$ts
                                else
-                                       printf -v unsorted '%s\n\n%s\n%s' "$unsorted" "$prev_line" "$line"
-                                       break
+                                       printf "%s\n%s\n\n" "$prev_line" "$line" || break
                                fi
                                prev_line=$line
                        done
+               ) | grep -q ^ && fail || ok
 
-                       [ -z "$unsorted" ] && ok || fail
-               )
        done
 fi