tools_test: Clean up and fix sysfs_l3_parity
PATCH 1/1 tools_test: Clean up and fix sysfs_l3_parity
Multiple misunderstandings of the expectations of the test and some missed parts of the shell-to-c conversion caused a couple of issues to remain.
First, we need to actually disable a subbank before we check that a subbank is disabled (invoke the tool with -d).
Second, the original pipe to wc -l was to check that the tool prints only one line, not that it prints "at least" a line. Modify the last check to verify that an "is disabled" text is _not_ printed.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101650
--- tests/tools_test.c | 83 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 37 deletions(-)
tests/tools_test.c +46 -37
@@ -28,26 +28,31 @@#include <fcntl.h> struct line_check { -bool found; +int found;const char *substr; };/** * Our igt_log_buffer_inspect handler. Checks the output of the -* intel_l3_parity tool and returns line_check::found to true if -* a specific substring is found. +* intel_l3_parity tool and increments line_check::found if a specific +* substring is found. */ -static bool check_cmd_return_value (const char *line,void *data) +static bool check_cmd_output (const char *line,void *data) {struct line_check *check = data; -if (!strstr (line, check->substr)) { - check->found = false; -return false; +if (strstr (line, check->substr)) { + check->found++; } - check->found = true; -return true; +return false; +} + +static void assert_cmd_success (int exec_return) +{ +igt_skip_on_f (exec_return ==IGT_EXIT_SKIP , +"intel_l3_parity not supported\n" ); +igt_assert_eq (exec_return,IGT_EXIT_SUCCESS ); } igt_main
@@ -56,46 +61,50 @@ igt_main igt_subtest("sysfs_l3_parity") {int exec_return; +struct line_check line; +/* Sanity check that l3 parity tool is usable: Enable +* row,bank,subbank 0,0,0. +*/ igt_system_cmd (exec_return,"../tools/intel_l3_parity -r 0 -b 0 " "-s 0 -e" ); -igt_skip_on_f (exec_return ==IGT_EXIT_SKIP , -"intel_l3_parity not supported\n" ); -igt_assert_eq (exec_return,IGT_EXIT_SUCCESS ); +assert_cmd_success (exec_return); +/* Disable row,bank,subbank 0,0,0. */ +igt_system_cmd (exec_return,"../tools/intel_l3_parity -r 0 -b 0 " +"-s 0 -d" ); +assert_cmd_success (exec_return); + +/* Check that disabling was successful */ igt_system_cmd (exec_return,"../tools/intel_l3_parity -l" ); -if (exec_return ==IGT_EXIT_SUCCESS ) { -struct line_check line; - line.substr ="Row 0, Bank 0, Subbank 0 is disabled" ; -igt_log_buffer_inspect (check_cmd_return_value, - &line); -igt_assert_eq (line.found, true); - } +assert_cmd_success (exec_return); + line.substr ="Row 0, Bank 0, Subbank 0 is disabled" ; + line.found =0 ; +igt_log_buffer_inspect (check_cmd_output, + &line); +igt_assert_eq (line.found,1 ); +/* Re-enable row,bank,subbank 0,0,0 */ igt_system_cmd (exec_return,"../tools/intel_l3_parity -r 0 -b 0 " "-s 0 -e" ); -igt_skip_on_f (exec_return ==IGT_EXIT_SKIP , -"intel_l3_parity not supported\n" ); -igt_assert_eq (exec_return,IGT_EXIT_SUCCESS ); +assert_cmd_success (exec_return); -/* Check that we can clear remaps: -* In the original shell script, the output of intel_l3_parity -l -* was piped thru wc -l to check if the tool would at least -* return a line. Just watch for one of the expected output -* string as an alternative. -* ("is disabled" unique only to intel_l3_parity.c:dumpit()) +/* Check that re-enabling was successful: +* intel_l3_parity -l should now not print that Row 0, +* Bank 0, Subbank 0 is disabled. +* +* The previously printed line is already in the log +* buffer so we check for count 1. */ -igt_system_cmd (exec_return, -"../tools/intel_l3_parity -l" ); -if (exec_return ==IGT_EXIT_SUCCESS ) { -struct line_check line; - line.substr ="is disabled" ; -igt_log_buffer_inspect (check_cmd_return_value, - &line); -igt_assert_eq (line.found, true); - } +igt_system_cmd (exec_return,"../tools/intel_l3_parity -l" ); +assert_cmd_success (exec_return); + line.substr ="Row 0, Bank 0, Subbank 0 is disabled" ; + line.found =0 ; +igt_log_buffer_inspect (check_cmd_output, + &line); +igt_assert_eq (line.found,1 ); } igt_subtest("tools_test") {
Signature · 6 lines
2.14.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for tools_test: Clean up and fix sysfs_l3_parity
== Series Details ==
== Series Details ==
Series: tools_test: Clean up and fix sysfs_l3_parity
URL : https://patchwork.freedesktop.org/series/30583/
State : success
== Summary ==
IGT patchset tested on top of latest successful buildda197b5f3cb516aaaea72d0d60b0f5c1c81081dd igt/gem_eio: Add another variant of in-flight to avoid request coalescing
with latest DRM-Tip kernel build CI_DRM_3110bf6ecf6d25c1 drm-tip: 2017y-09m-19d-17h-23m-04s UTC integration manifest
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-atomic:
pass -> FAIL (fi-snb-2600) fdo#100215 +1
Test kms_frontbuffer_tracking:
Subgroup basic:
dmesg-warn -> PASS (fi-kbl-7500u)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
incomplete -> DMESG-WARN (fi-cfl-s) fdo#102294
Subgroup suspend-read-crc-pipe-a:
incomplete -> PASS (fi-kbl-7500u)fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:451s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:472s fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:423s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:524s fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:278s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:508s fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:500s fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:491s fi-cfl-s total:289 pass:222 dwarn:35 dfail:0 fail:0 skip:32 time:548s fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:424s fi-glk-1 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:574s fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:431s fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:406s fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:437s fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:483s fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:474s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:474s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:582s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:590s fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:542s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:458s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:761s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:497s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:486s fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:571s fi-snb-2600 total:289 pass:248 dwarn:0 dfail:0 fail:2 skip:39 time:420s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_229/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: failure for tools_test: Clean up and fix sysfs_l3_parity
In reply to Petri Latvala== Series Details ==
== Series Details ==
Series: tools_test: Clean up and fix sysfs_l3_parity
URL : https://patchwork.freedesktop.org/series/30583/
State : failure
== Summary ==
Test drv_hangman:
Subgroup error-state-capture-render:
pass -> SKIP (shard-hsw)
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-offscren-pri-shrfb-draw-mmap-wc:
pass -> FAIL (shard-hsw)
Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
pass -> FAIL (shard-hsw)
Test kms_setmode:
Subgroup basic:
pass -> FAIL (shard-hsw) fdo#99912
Test perf:
Subgroup polling:
fail -> PASS (shard-hsw) fdo#102252
Test kms_flip:
Subgroup rcs-wf_vblank-vs-dpms:
dmesg-warn -> PASS (shard-hsw)fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2317 pass:1242 dwarn:3 dfail:0 fail:14 skip:1058 time:10548s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_229/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Petri Latvala
Multiple misunderstandings of the expectations of the test and some missed parts of the shell-to-c conversion caused a couple of issues to remain.
First, we need to actually disable a subbank before we check that a subbank is disabled (invoke the tool with -d).
Quoted 7 lines
Second, the original pipe to wc -l was to check that the tool prints only one line, not that it prints "at least" a line. Modify the last check to verify that an "is disabled" text is _not_ printed.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101650
CC Abdiel Janulgue <[email protected]>Signed-off-by Petri Latvala <[email protected]>
Quoted 119 lines
--- tests/tools_test.c | 83 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 37 deletions(-)tests/tools_test.c +39
-37@@ -28,26 +28,31 @@#include <fcntl.h> struct line_check { -bool found; +int found;const char *substr; };/** * Our igt_log_buffer_inspect handler. Checks the output of the -* intel_l3_parity tool and returns line_check::found to true if -* a specific substring is found. +* intel_l3_parity tool and increments line_check::found if a specific +* substring is found. */ -static bool check_cmd_return_value (const char *line,void *data) +static bool check_cmd_output (const char *line,void *data) {struct line_check *check = data; -if (!strstr (line, check->substr)) { - check->found = false; -return false; +if (strstr (line, check->substr)) { + check->found++; } - check->found = true; -return true; +return false; +} + +static void assert_cmd_success (int exec_return) +{ +igt_skip_on_f (exec_return ==IGT_EXIT_SKIP , +"intel_l3_parity not supported\n" ); +igt_assert_eq (exec_return,IGT_EXIT_SUCCESS ); } igt_main@@ -56,46 +61,50 @@ igt_main igt_subtest("sysfs_l3_parity") {int exec_return; +struct line_check line; +/* Sanity check that l3 parity tool is usable: Enable +* row,bank,subbank 0,0,0. +*/ igt_system_cmd (exec_return,"../tools/intel_l3_parity -r 0 -b 0 " "-s 0 -e" ); -igt_skip_on_f (exec_return ==IGT_EXIT_SKIP , -"intel_l3_parity not supported\n" ); -igt_assert_eq (exec_return,IGT_EXIT_SUCCESS ); +assert_cmd_success (exec_return); +/* Disable row,bank,subbank 0,0,0. */ +igt_system_cmd (exec_return,"../tools/intel_l3_parity -r 0 -b 0 " +"-s 0 -d" ); +assert_cmd_success (exec_return); + +/* Check that disabling was successful */ igt_system_cmd (exec_return,"../tools/intel_l3_parity -l" ); -if (exec_return ==IGT_EXIT_SUCCESS ) { -struct line_check line; - line.substr ="Row 0, Bank 0, Subbank 0 is disabled" ; -igt_log_buffer_inspect (check_cmd_return_value, - &line); -igt_assert_eq (line.found, true); - } +assert_cmd_success (exec_return); + line.substr ="Row 0, Bank 0, Subbank 0 is disabled" ; + line.found =0 ; +igt_log_buffer_inspect (check_cmd_output, + &line); +igt_assert_eq (line.found,1 ); +/* Re-enable row,bank,subbank 0,0,0 */ igt_system_cmd (exec_return,"../tools/intel_l3_parity -r 0 -b 0 " "-s 0 -e" ); -igt_skip_on_f (exec_return ==IGT_EXIT_SKIP , -"intel_l3_parity not supported\n" ); -igt_assert_eq (exec_return,IGT_EXIT_SUCCESS ); +assert_cmd_success (exec_return); -/* Check that we can clear remaps: -* In the original shell script, the output of intel_l3_parity -l -* was piped thru wc -l to check if the tool would at least -* return a line. Just watch for one of the expected output -* string as an alternative. -* ("is disabled" unique only to intel_l3_parity.c:dumpit()) +/* Check that re-enabling was successful: +* intel_l3_parity -l should now not print that Row 0, +* Bank 0, Subbank 0 is disabled. +* +* The previously printed line is already in the log +* buffer so we check for count 1. */ -igt_system_cmd (exec_return, -"../tools/intel_l3_parity -l" ); -if (exec_return ==IGT_EXIT_SUCCESS ) { -struct line_check line; - line.substr ="is disabled" ; -igt_log_buffer_inspect (check_cmd_return_value, - &line); -igt_assert_eq (line.found, true); - }
tests/tools_test.c igt_main · line 110
Quoted 10 lines
tests/tools_test.c +7
-0+igt_system_cmd (exec_return,"../tools/intel_l3_parity -l" ); +assert_cmd_success (exec_return); + line.substr ="Row 0, Bank 0, Subbank 0 is disabled" ; + line.found =0 ; +igt_log_buffer_inspect (check_cmd_output, + &line); +igt_assert_eq (line.found,1 ); } igt_subtest("tools_test") {
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx