From: Vitaly Prosyak <[email protected]>
Hook platform filtering into __igt_run_subtest() so tests automatically
skip subtests based on platform rules without requiring manual
igt_platform_require() calls in each subtest.
This means tests only need to call platform_filter_init() once in their
igt_fixture, and all subtests are automatically checked against the
platform filtering rules before execution.
Example test code:
igt_fixture {
amd_platform_filter_init(&gpu_info);
}
igt_subtest(my-test) {
// Automatic skip if platform rules match - no manual call needed!
test_code();
}
v3 changes:
- This is now patch 4/6 (was 5/7 in v2) due to squashing of patches 1+2
per Kamil Konieczny's review feedback
- No code changes from v2
Cc: Kamil Konieczny <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Jesse Zhang <[email protected]>
Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Vitaly Prosyak <[email protected]>
Reviewed-by: Krzysztof Karas <[email protected]>
Change-Id: I2a3b4c5d6e7f8g9h0i1j2k3l4m5n6o7p8q9r0s1t
---
lib/igt_core.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index a7c097d9e..60a432888 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -80,6 +80,7 @@
#include "igt_rc.h"
#include "igt_list.h"
#include "igt_map.h"
+#include "igt_platform_filter.h"
#include "igt_device_scan.h"
#include "igt_thread.h"
#include "igt_vec.h"
@@ -1572,7 +1573,6 @@ bool __igt_run_subtest(const char *subtest_name, const char *file, const int lin
return false;
}
-
if (skip_subtests_henceforth) {
_subtest_result_message(_SUBTEST_TYPE_NORMAL, subtest_name,
skip_subtests_henceforth == SKIP ? "SKIP" : "FAIL",
@@ -1580,6 +1580,22 @@ bool __igt_run_subtest(const char *subtest_name, const char *file, const int lin
return false;
}
+ /* Automatic platform filtering - if initialized, check if subtest should be skipped */
+ if (igt_platform_filter_is_initialized()) {
+ enum skip_source source;
+ const char *reason;
+
+ if (igt_platform_should_skip(igt_test_name(), subtest_name,
+ &source, &reason)) {
+ _subtest_result_message(_SUBTEST_TYPE_NORMAL, subtest_name,
+ "SKIP", 0.0);
+ igt_info("Platform filtering (%s): %s\n",
+ source == SKIP_SOURCE_BUILTIN ? "built-in" :
+ source == SKIP_SOURCE_CONFIG ? "config" : "env",
+ reason);
+ return false;
+ }
+ }
igt_kmsg(KMSG_INFO "%s: starting subtest %s\n",
command_str, subtest_name);
igt_trace("%s: starting subtest %s\n", command_str, subtest_name);
--
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.