summaryrefslogtreecommitdiff
path: root/runner/runner_tests.c
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2018-11-09 13:13:03 +0200
committerPetri Latvala <petri.latvala@intel.com>2018-11-15 10:35:23 +0200
commit111593c49d812a4f4ff9ab0ef053a3ab88a6f73f (patch)
tree7f8a34859645b3972bc587af663c7530abdec24a /runner/runner_tests.c
parentcab148ca3ec904a94d0cd43476cf7e1f8663f906 (diff)
runner: Implement --abort-on-monitored-error
Deviating a bit from the piglit command line flag, igt_runner takes an optional comma-separated list as an argument to --abort-on-monitored-error for the list of conditions to abort on. Without a list all possible conditions will be checked. Two conditions implemented: - "taint" checks the kernel taint level for TAINT_PAGE, TAINT_DIE and TAINT_OOPS - "lockdep" checks the kernel lockdep status Checking is done after every test binary execution, and if an abort condition is met, the reason is printed to stderr (unless log level is quiet) and the runner doesn't execute any further tests. Aborting between subtests (when running in --multiple-mode) is not done. v2: - Remember to fclose - Taints are unsigned long (Chris) - Use getline instead of fgets (Chris) v3: - Fix brainfart with lockdep v4: - Rebase - Refactor the abort condition checking to pass down strings - Present the abort result in results.json as a pseudo test result - Unit tests for the pseudo result v5: - Refactors (Chris) - Don't claim lockdep was triggered if debug_locks is not on anymore. Just say it's not active. - Dump lockdep_stats when aborting due to lockdep (Chris) - Use igt@runner@aborted instead for the pseudo result (Martin) v6: - If aborting after a test, generate results.json. Like was already done for aborting at startup. - Print the test that would be executed next as well when aborting, as requested by Tomi. v7: - Remove the resolved TODO item from commit message Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com> Cc: Martin Peres <martin.peres@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'runner/runner_tests.c')
-rw-r--r--runner/runner_tests.c49
1 files changed, 44 insertions, 5 deletions
diff --git a/runner/runner_tests.c b/runner/runner_tests.c
index d07e6f37..6213b8e7 100644
--- a/runner/runner_tests.c
+++ b/runner/runner_tests.c
@@ -142,7 +142,7 @@ static void assert_settings_equal(struct settings *one, struct settings *two)
* Regex lists are not serialized, and thus won't be compared
* here.
*/
- igt_assert_eq(one->abort_on_error, two->abort_on_error);
+ igt_assert_eq(one->abort_mask, two->abort_mask);
igt_assert_eqstr(one->test_list, two->test_list);
igt_assert_eqstr(one->name, two->name);
igt_assert_eq(one->dry_run, two->dry_run);
@@ -208,7 +208,7 @@ igt_main
igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
- igt_assert(!settings.abort_on_error);
+ igt_assert_eq(settings.abort_mask, 0);
igt_assert(!settings.test_list);
igt_assert_eqstr(settings.name, "path-to-results");
igt_assert(!settings.dry_run);
@@ -323,7 +323,7 @@ igt_main
setenv("IGT_TEST_ROOT", testdatadir, 1);
igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
- igt_assert(!settings.abort_on_error);
+ igt_assert_eq(settings.abort_mask, 0);
igt_assert(!settings.test_list);
igt_assert_eqstr(settings.name, "path-to-results");
igt_assert(!settings.dry_run);
@@ -348,7 +348,7 @@ igt_main
igt_subtest("parse-all-settings") {
const char *argv[] = { "runner",
"-n", "foo",
- "--abort-on-monitored-error",
+ "--abort-on-monitored-error=taint,lockdep",
"--test-list", "path-to-test-list",
"--ignore-missing",
"--dry-run",
@@ -370,7 +370,7 @@ igt_main
igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
- igt_assert(settings.abort_on_error);
+ igt_assert_eq(settings.abort_mask, ABORT_TAINT | ABORT_LOCKDEP);
igt_assert(strstr(settings.test_list, "path-to-test-list") != NULL);
igt_assert_eqstr(settings.name, "foo");
igt_assert(settings.dry_run);
@@ -428,6 +428,45 @@ igt_main
igt_assert_eq(settings.log_level, LOG_LEVEL_VERBOSE);
}
+ igt_subtest("abort-conditions") {
+ const char *argv[] = { "runner",
+ "--abort-on-monitored-error=taint",
+ "test-root-dir",
+ "results-path",
+ };
+
+ igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+ igt_assert_eq(settings.abort_mask, ABORT_TAINT);
+
+ argv[1] = "--abort-on-monitored-error=lockdep";
+ igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+ igt_assert_eq(settings.abort_mask, ABORT_LOCKDEP);
+
+ argv[1] = "--abort-on-monitored-error=taint";
+ igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+ igt_assert_eq(settings.abort_mask, ABORT_TAINT);
+
+ argv[1] = "--abort-on-monitored-error=lockdep,taint";
+ igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+ igt_assert_eq(settings.abort_mask, ABORT_TAINT | ABORT_LOCKDEP);
+
+ argv[1] = "--abort-on-monitored-error=taint,lockdep";
+ igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+ igt_assert_eq(settings.abort_mask, ABORT_TAINT | ABORT_LOCKDEP);
+
+ argv[1] = "--abort-on-monitored-error=all";
+ igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+ igt_assert_eq(settings.abort_mask, ABORT_ALL);
+
+ argv[1] = "--abort-on-monitored-error=";
+ igt_assert(parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+ igt_assert_eq(settings.abort_mask, 0);
+
+ argv[1] = "--abort-on-monitored-error=doesnotexist";
+ igt_assert(!parse_options(ARRAY_SIZE(argv), (char**)argv, &settings));
+
+ }
+
igt_subtest("parse-clears-old-data") {
const char *argv[] = { "runner",
"-n", "foo",