]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
testing: Print the actual start time of a command for `do-tests -t`
authorTobias Brunner <tobias@strongswan.org>
Wed, 9 Feb 2022 17:54:23 +0000 (18:54 +0100)
committerTobias Brunner <tobias@strongswan.org>
Wed, 9 Feb 2022 17:58:08 +0000 (18:58 +0100)
Because the command line, together with the results, is printed after
executing it, there could have been weird delays between commands.

testing/do-tests

index 9e3b3464e69164aeea577f1cec7db78d60dd1444..ace12b86bd6bb09af933831b3f3bd2a77f93dc25 100755 (executable)
@@ -449,6 +449,7 @@ do
                }
                printf("cmd_err=\044(tempfile -p test -s err); ")
                printf("cmd_out=\044(tempfile -p test -s out); ")
+               printf("start_time=\044(print_time); ")
                if (command == "tcpdump")
                {
                        printf("if [ \044TDUP_%s == \"true\" ]; then stop_tcpdump %s; fi; \n", host, host)
@@ -475,11 +476,11 @@ do
                printf("if [ \044cmd_fail -ne 0 ]; then echo \"~~~~~~~ FAIL ~~~~~~~\"; fi; \n")
                if (command == "tcpdump")
                {
-                       printf("echo \"$(print_time)%s# cat /tmp/tcpdump.log | grep \047%s\047  [%s]\"; ", host, pattern, hit)
+                       printf("echo \"\044{start_time}%s# cat /tmp/tcpdump.log | grep \047%s\047  [%s]\"; ", host, pattern, hit)
                }
                else
                {
-                       printf("echo \"$(print_time)%s# %s | grep \047%s\047  [%s]\"; ", host, command, pattern, hit)
+                       printf("echo \"\044{start_time}%s# %s | grep \047%s\047  [%s]\"; ", host, command, pattern, hit)
                }
                printf("if [ -n \"\044cmd_res\" ]; then echo \"\044cmd_res\"; fi; \n")
                printf("cat \044cmd_err; \n")