Merge "ltp tests emit skip if filtered out"
diff --git a/testcases/kernel/ltp/KernelLtpTest.py b/testcases/kernel/ltp/KernelLtpTest.py
index c1cdedb..7ae3363 100644
--- a/testcases/kernel/ltp/KernelLtpTest.py
+++ b/testcases/kernel/ltp/KernelLtpTest.py
@@ -311,7 +311,7 @@
settings_multithread = []
settings_singlethread = []
for test_case in settings:
- if (test_case.note == 'staging' or test_case.testsuite in
+ if (test_case.is_staging or test_case.testsuite in
ltp_configs.TEST_SUITES_REQUIRE_SINGLE_THREAD_MODE):
settings_singlethread.append(test_case)
else:
@@ -376,8 +376,15 @@
test_name = name_func(test_case, *args)
+ # Check whether test case is filtered out by base_test's filtering method
+ if test_case.is_filtered:
+ self.InternalResultReportMultiThread(test_name, asserts.skipIf,
+ (False, test_case.note))
+ continue
logging.info("Worker {} starts checking requirement "
"for '{}'.".format(id, test_case))
+
+ # Check test requirements
requirement_satisfied = self._requirement.Check(test_case)
if not requirement_satisfied:
logging.info("Worker {} reports requirement "
@@ -436,6 +443,7 @@
def RunLtpOnce(self, test_case, n_bit):
"Run one LTP test case"
+ asserts.skipIf(test_case.is_filtered, test_case.note)
asserts.skipIf(not self._requirement.Check(test_case), test_case.note)
cmd = "export {envp} && {commands}".format(
diff --git a/testcases/kernel/ltp/environment_requirement_checker.py b/testcases/kernel/ltp/environment_requirement_checker.py
index ce0ab10..c9b12dd 100644
--- a/testcases/kernel/ltp/environment_requirement_checker.py
+++ b/testcases/kernel/ltp/environment_requirement_checker.py
@@ -137,7 +137,8 @@
test_case: list of TestCase objects.
"""
executables_generators = (test_case.GetRequiredExecutablePaths()
- for test_case in test_cases)
+ for test_case in test_cases
+ if not test_case.is_filtered)
executables = list(
set(itertools.chain.from_iterable(executables_generators)))
diff --git a/testcases/kernel/ltp/test_case.py b/testcases/kernel/ltp/test_case.py
index 9a3e669..6c9997f 100644
--- a/testcases/kernel/ltp/test_case.py
+++ b/testcases/kernel/ltp/test_case.py
@@ -38,6 +38,8 @@
check results
note: string, a place to store additional note for the test case
such as what environment requirement did not satisfy.
+ is_staging: bool, whether test case is a staging test
+ is_filtered: bool, whether test case is excluded by filter
"""
def __init__(self, testsuite, testname, command):
@@ -46,6 +48,8 @@
self._command = command
self.requirement_state = ltp_enums.RequirementState.UNCHECKED
self.note = ""
+ self.is_staging = False
+ self.is_filtered = False
@property
def note(self):
@@ -142,3 +146,23 @@
def __str__(self):
return self.fullname
+
+ @property
+ def is_staging(self):
+ '''Whether this test is a staging test.'''
+ return self._is_staging
+
+ @is_staging.setter
+ def is_staging(self, is_staging):
+ '''Set whether this test is a staging test.'''
+ self._is_staging = is_staging
+
+ @property
+ def is_filtered(self):
+ '''Whether this test has been filtered out.'''
+ return self._is_filtered
+
+ @is_filtered.setter
+ def is_filtered(self, is_filtered):
+ '''Set whether this test has been filtered out.'''
+ self._is_filtered = is_filtered
diff --git a/testcases/kernel/ltp/test_cases_parser.py b/testcases/kernel/ltp/test_cases_parser.py
index 5dea430..e17b1b7 100644
--- a/testcases/kernel/ltp/test_cases_parser.py
+++ b/testcases/kernel/ltp/test_cases_parser.py
@@ -95,7 +95,8 @@
except:
logging.info("[Parser] Skipping test case %s. Reason: "
"filtered" % testcase.fullname)
- continue
+ testcase.is_filtered = True
+ testcase.note = "filtered"
# For skipping tests that are not designed for Android
if test_display_name in self._disabled_tests:
@@ -110,6 +111,7 @@
"staging" % testcase.fullname)
continue
else:
+ testcase.is_staging = True
testcase.note = "staging"
logging.info("[Parser] Adding test case %s." % testcase.fullname)