tools: Fix syntax error caused by "; ; " in create_dmesg_entry awk script
PATCH 1/1 tools: Fix syntax error caused by "; ; " in create_dmesg_entry awk script
When running runltp with both -S and -K provided, tests that are supposed to be "skipped" and report TCONF results were failing due to an unexpected semicolon at the end of the constructed command.
-S replace the test command with exit 32;-K appends another semicolon to the command then we get exit 32;;
For example:
Quoted 1 line
Quoted 1 line
Quoted 1 line
780:madvise06__with_dmesg_entry BROK <<<
1 <<<test_start>>>
2 tag=madvise06__with_dmesg_entry stime=1703556061
3 cmdline="dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log"
4 contacts=""
5 analysis=exit
6 <<<test_output>>>
7 sh: -c: line 1: syntax error near unexpected token `;;'
8 sh: -c: line 1: `dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log'
9 <<<execution_status>>>
10 initiation_status="ok"
11 duration=0 termination_type=exited termination_id=2 corefile=no
12 cutime=0 cstime=1
13 <<<test_end>>>--- tools/create_dmesg_entries_for_each_test.awk | 1 + 1 file changed, 1 insertion(+)
tools/create_dmesg_entries_for_each_test.awk +1 -0
@@ -27,6 +27,7 @@ NF && ! /^#/ { for (i = 2; i <= NF; i++) { s = s " " $i } + sub(/;$/, "", s) s = s "; dmesg > " DMESG_DIR "/" $1 ".dmesg.log" print s }
Signature · 5 lines
2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Shizhao,
Quoted 35 lines
When running runltp with both -S and -K provided, tests that are supposed to be "skipped" and report TCONF results were failing due to an unexpected semicolon at the end of the constructed command.
-Sreplace the test command withexit 32;-Kappends another semicolon to the command then we getexit 32;;For example:
Quoted 1 line
Quoted 1 line
Quoted 1 line
780:madvise06__with_dmesg_entry BROK <<<
1 <<<test_start>>> 2 tag=madvise06__with_dmesg_entry stime=1703556061 3 cmdline="dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log" 4 contacts="" 5 analysis=exit 6 <<<test_output>>> 7 sh: -c: line 1: syntax error near unexpected token `;;' 8 sh: -c: line 1: `dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log' 9 <<<execution_status>>> 10 initiation_status="ok" 11 duration=0 termination_type=exited termination_id=2 corefile=no 12 cutime=0 cstime=1 13 <<<test_end>>>Signed-off-by Shizhao Chen <[email protected]>--- tools/create_dmesg_entries_for_each_test.awk | 1 + 1 file changed, 1 insertion(+)tools/create_dmesg_entries_for_each_test.awk +0
-0
tools/create_dmesg_entries_for_each_test.awk NF && ! /^#/ { · line 30
Quoted 4 lines
tools/create_dmesg_entries_for_each_test.awk +1
-0@@ -27,6 +27,7 @@ NF && ! /^#/ { for (i = 2; i <= NF; i++) { s = s " " $i } + sub(/;$/, "", s)
From the above context are you sure that there will not be missing semicolon? (e.g. between dmesg and exit)
Wouldn't it be safe to make sure there is only only single semicolon at the end?
sub(/[;]+$/, ";")
FYI: runltp has been deprecated, we suggest to use python based kirk.
https://github.com/linux-test-project/kirk
Kind regards,
Petr
Quoted 3 lines
tools/create_dmesg_entries_for_each_test.awk +0
-0s = s "; dmesg > " DMESG_DIR "/" $1 ".dmesg.log" print s }
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Li Wang
Reviewed-byHi Petr, Shizhao,
Quoted 53 lines · Petr Vorel
Hi Shizhao,
Quoted 1 line
When running runltp with both -S and -K provided, tests that are
supposed to be
Quoted 1 line
"skipped" and report TCONF results were failing due to an unexpected
semicolon
Quoted 5 lines
at the end of the constructed command.
-Sreplace the test command withexit 32;-Kappends another semicolon to the command then we getexit 32;;Quoted 7 lines
For example:
Quoted 1 line
Quoted 1 line
Quoted 1 line
780:madvise06__with_dmesg_entry BROK <<<
1 <<<test_start>>> 2 tag=madvise06__with_dmesg_entry stime=1703556061 3 cmdline="dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg >/mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log"
Quoted 5 lines
4 contacts="" 5 analysis=exit 6 <<<test_output>>> 7 sh: -c: line 1: syntax error near unexpected token `;;' 8 sh: -c: line 1: `dmesg -c 1>/dev/null 2>&1; exit 32;;dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log'
Quoted 3 lines
9 <<<execution_status>>> 10 initiation_status="ok" 11 duration=0 termination_type=exited termination_id=2corefile=no
Review
Quoted 9 lines
12 cutime=0 cstime=1
13 <<<test_end>>>Signed-off-by Shizhao Chen <[email protected]>--- tools/create_dmesg_entries_for_each_test.awk | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/tools/create_dmesg_entries_for_each_test.awktools/create_dmesg_entries_for_each_test.awk NF && ! /^#/ { · line 30
Quoted 8 lines
index
25d750a55..7a22bb4a6100644tools/create_dmesg_entries_for_each_test.awk +1
-0@@ -27,6 +27,7 @@ NF && ! /^#/ { for (i = 2; i <= NF; i++) { s = s " " $i } + sub(/;$/, "", s)From the above context are you sure that there will not be missing semicolon?
(e.g. between dmesg and exit)
Quoted 5 lines
Wouldn't it be safe to make sure there is only only single semicolon at the end?
sub(/[;]+$/, ";")
Hmm, that would not work as expected because in the next line forces adding a semicolon.
s = s "; dmesg > " DMESG_DIR "/" $1 ".dmesg.log"
Unless we make a minor adjustments to your version:
sub(/[;]+$/, "", s)
Otherwise LGTM:
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 64 lines
Hi Petr, Shizhao,
Quoted 53 lines · Petr Vorel
Hi Shizhao,
Quoted 1 line
When running runltp with both -S and -K provided, tests that are
supposed to be
Quoted 1 line
"skipped" and report TCONF results were failing due to an unexpected
semicolon
Quoted 5 lines
at the end of the constructed command.
-Sreplace the test command withexit 32;-Kappends another semicolon to the command then we getexit 32;;Quoted 7 lines
For example:
Quoted 1 line
Quoted 1 line
Quoted 1 line
780:madvise06__with_dmesg_entry BROK <<<
1 <<<test_start>>> 2 tag=madvise06__with_dmesg_entry stime=1703556061 3 cmdline="dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg >/mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log"
Quoted 5 lines
4 contacts="" 5 analysis=exit 6 <<<test_output>>> 7 sh: -c: line 1: syntax error near unexpected token `;;' 8 sh: -c: line 1: `dmesg -c 1>/dev/null 2>&1; exit 32;;dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log'
Quoted 3 lines
9 <<<execution_status>>> 10 initiation_status="ok" 11 duration=0 termination_type=exited termination_id=2corefile=no
Review
Quoted 9 lines
12 cutime=0 cstime=1
13 <<<test_end>>>Signed-off-by Shizhao Chen <[email protected]>--- tools/create_dmesg_entries_for_each_test.awk | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/tools/create_dmesg_entries_for_each_test.awktools/create_dmesg_entries_for_each_test.awk NF && ! /^#/ { · line 30
Quoted 8 lines
index
25d750a55..7a22bb4a6100644tools/create_dmesg_entries_for_each_test.awk +1
-0@@ -27,6 +27,7 @@ NF && ! /^#/ { for (i = 2; i <= NF; i++) { s = s " " $i } + sub(/;$/, "", s)From the above context are you sure that there will not be missing semicolon?
(e.g. between dmesg and exit)Quoted 5 lines
Wouldn't it be safe to make sure there is only only single semicolon at the end?
sub(/[;]+$/, ";")
Quoted 8 lines
Hmm, that would not work as expected because in the next line forces adding a semicolon.
s = s "; dmesg > " DMESG_DIR "/" $1 ".dmesg.log"Unless we make a minor adjustments to your version:
sub(/[;]+$/, "", s)
Ah, thanks Li!
I'm ok to merge your suggestion, just wait little longer for Shizhao, in case we overlooked something.
Kind regards,
Petr
Quoted 2 lines
Otherwise LGTM:
Reviewed-by Li Wang <[email protected]>
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Thanks for the review! I will send a v2 shortly.
Quoted 85 lines · Petr Vorel
Quoted 65 lines
Hi Petr, Shizhao,
Quoted 53 lines · Petr Vorel
Hi Shizhao,
Quoted 1 line
When running runltp with both -S and -K provided, tests that are
supposed to be
Quoted 1 line
"skipped" and report TCONF results were failing due to an unexpected
semicolon
Quoted 5 lines
at the end of the constructed command.
-Sreplace the test command withexit 32;-Kappends another semicolon to the command then we getexit 32;;Quoted 7 lines
For example:
Quoted 1 line
Quoted 1 line
Quoted 1 line
780:madvise06__with_dmesg_entry BROK <<<
1 <<<test_start>>> 2 tag=madvise06__with_dmesg_entry stime=1703556061 3 cmdline="dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg >/mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log"
Quoted 5 lines
4 contacts="" 5 analysis=exit 6 <<<test_output>>> 7 sh: -c: line 1: syntax error near unexpected token `;;' 8 sh: -c: line 1: `dmesg -c 1>/dev/null 2>&1; exit 32;;dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log'
Quoted 3 lines
9 <<<execution_status>>> 10 initiation_status="ok" 11 duration=0 termination_type=exited termination_id=2corefile=no
Review
Quoted 9 lines
12 cutime=0 cstime=1
13 <<<test_end>>>Signed-off-by Shizhao Chen <[email protected]>--- tools/create_dmesg_entries_for_each_test.awk | 1 + 1 file changed, 1 insertion(+)(quoted diff) +0
-0
b/tools/create_dmesg_entries_for_each_test.awktools/create_dmesg_entries_for_each_test.awk NF && ! /^#/ { · line 30
Quoted 8 lines
index
25d750a55..7a22bb4a6100644tools/create_dmesg_entries_for_each_test.awk +1
-0@@ -27,6 +27,7 @@ NF && ! /^#/ { for (i = 2; i <= NF; i++) { s = s " " $i } + sub(/;$/, "", s)From the above context are you sure that there will not be missing semicolon?
(e.g. between dmesg and exit)Quoted 5 lines
Wouldn't it be safe to make sure there is only only single semicolon at the end?
sub(/[;]+$/, ";")Quoted 8 lines
Hmm, that would not work as expected because in the next line forces adding a semicolon.
s = s "; dmesg > " DMESG_DIR "/" $1 ".dmesg.log"Unless we make a minor adjustments to your version:
sub(/[;]+$/, "", s)Ah, thanks Li!
I'm ok to merge your suggestion, just wait little longer for Shizhao, in case we overlooked something.
Kind regards,
PetrQuoted 2 lines
Otherwise LGTM:
Reviewed-by Li Wang <[email protected]>
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v2 1/1 tools: Fix syntax error caused by "; ; " in create_dmesg_entry awk script
In reply to Shizhao ChenWhen running runltp with both -S and -K provided, tests that are supposed to be "skipped" and report TCONF results were failing due to an unexpected semicolon at the end of the constructed command.
-S replace the test command with exit 32;-K appends another semicolon to the command then we get exit 32;;
For example:
Quoted 1 line
Quoted 1 line
Quoted 1 line
780:madvise06__with_dmesg_entry BROK <<<
1 <<<test_start>>>
2 tag=madvise06__with_dmesg_entry stime=1703556061
3 cmdline="dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log"
4 contacts=""
5 analysis=exit
6 <<<test_output>>>
7 sh: -c: line 1: syntax error near unexpected token `;;'
8 sh: -c: line 1: `dmesg -c 1>/dev/null 2>&1; exit 32;; dmesg > /mnt/testarea/ltp/output/DMESG_DIR_RHELKT1LITE.FILTERED-dmesg-output-53127-08:48:23PM/madvise06.dmesg.log'
9 <<<execution_status>>>
10 initiation_status="ok"
11 duration=0 termination_type=exited termination_id=2 corefile=no
12 cutime=0 cstime=1
13 <<<test_end>>>--- tools/create_dmesg_entries_for_each_test.awk | 1 + 1 file changed, 1 insertion(+)
tools/create_dmesg_entries_for_each_test.awk +1 -0
@@ -27,6 +27,7 @@ NF && ! /^#/ { for (i = 2; i <= NF; i++) { s = s " " $i } + sub(/[;]+$/, "", s) s = s "; dmesg > " DMESG_DIR "/" $1 ".dmesg.log" print s }
Signature · 5 lines
2.43.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Pushed, thanks!
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp