@@ -37,7 +37,9 @@ skip: A completely optional key, if the corresponding value is "yes"
then tdc will not execute the test case in question. However,
this test case will still appear in the results output but
marked as skipped. This key can be placed anywhere inside the
- test case at the top level.
+ test case at the top level. It's possible to specify a command
+ in the value of "skip": in this case, the test is skipped when
+ the return value is not zero.
category: A list of single-word descriptions covering what the command
under test is testing. Example: filter, actions, u32, gact, etc.
setup: The list of commands required to ensure the command under test
@@ -361,13 +361,22 @@ def run_one_test(pm, args, index, tidx):
print("Test " + tidx["id"] + ": " + tidx["name"])
if 'skip' in tidx:
+ if (args.verbose > 0):
+ print('probe command for test skip')
if tidx['skip'] == 'yes':
- res = TestResult(tidx['id'], tidx['name'])
- res.set_result(ResultState.skip)
- res.set_errormsg('Test case designated as skipped.')
- pm.call_pre_case(tidx, test_skip=True)
- pm.call_post_execute()
- return res
+ # 'yes' would block forever: preserve existing skipped test
+ # replacing 'yes' with 'false'
+ (p, procout) = exec_cmd(args, pm, 'execute', '/bin/false')
+ else:
+ (p, procout) = exec_cmd(args, pm, 'execute', tidx['skip'])
+ if p:
+ if (p.returncode != 0):
+ res = TestResult(tidx['id'], tidx['name'])
+ res.set_result(ResultState.skip)
+ res.set_errormsg('probe command failed: test skipped.')
+ pm.call_pre_case(tidx, test_skip=True)
+ pm.call_post_execute()
+ return res
# populate NAMES with TESTID for this test
NAMES['TESTID'] = tidx['id']
currently, users can skip individual test cases by means of writing "skip": "yes" in the scenario file. Extend this functionality by allowing the execution of a command, written in the "skip" property for a specific test case. If such property is present, tdc executes that command and skips the test if the return value is non-zero. Signed-off-by: Davide Caratti <dcaratti@redhat.com> --- .../creating-testcases/AddingTestCases.txt | 4 +++- tools/testing/selftests/tc-testing/tdc.py | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-)