projects
/
kconfig-hardened-check.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test_engine: test the non-verbose output mode
[kconfig-hardened-check.git]
/
kconfig_hardened_check
/
test_engine.py
diff --git
a/kconfig_hardened_check/test_engine.py
b/kconfig_hardened_check/test_engine.py
index d04618d30b159042ae964a7e5197b89c3cb4742c..acb47b2544269bb20a36098b28ef7b8969df4279 100644
(file)
--- a/
kconfig_hardened_check/test_engine.py
+++ b/
kconfig_hardened_check/test_engine.py
@@
-79,7
+79,7
@@
class TestEngine(unittest.TestCase):
@staticmethod
def get_engine_result(checklist, result, result_type):
@staticmethod
def get_engine_result(checklist, result, result_type):
- assert(result_type in ('json', 'stdout')), \
+ assert(result_type in ('json', 'stdout'
, 'stdout_verbose'
)), \
f'invalid result type "{result_type}"'
if result_type == 'json':
f'invalid result type "{result_type}"'
if result_type == 'json':
@@
-91,7
+91,10
@@
class TestEngine(unittest.TestCase):
stdout_backup = sys.stdout
sys.stdout = captured_output
for opt in checklist:
stdout_backup = sys.stdout
sys.stdout = captured_output
for opt in checklist:
- opt.table_print('verbose', True) # verbose mode, with_results
+ if result_type == 'stdout_verbose':
+ opt.table_print('verbose', True) # verbose mode, with_results
+ else:
+ opt.table_print(None, True) # normal mode, with_results
sys.stdout = stdout_backup
result.append(captured_output.getvalue())
sys.stdout = stdout_backup
result.append(captured_output.getvalue())
@@
-303,7
+306,7
@@
class TestEngine(unittest.TestCase):
["CONFIG_NAME_4", "kconfig", "expected_4", "decision_4", "reason_4", "OK: version >= 42.43"]]
)
["CONFIG_NAME_4", "kconfig", "expected_4", "decision_4", "reason_4", "OK: version >= 42.43"]]
)
- def test_
verbose
(self):
+ def test_
stdout
(self):
# 1. prepare the checklist
config_checklist = []
config_checklist += [OR(KconfigCheck('reason_1', 'decision_1', 'NAME_1', 'expected_1'),
# 1. prepare the checklist
config_checklist = []
config_checklist += [OR(KconfigCheck('reason_1', 'decision_1', 'NAME_1', 'expected_1'),
@@
-334,6
+337,17
@@
class TestEngine(unittest.TestCase):
self.assertEqual(
stdout_result,
[
self.assertEqual(
stdout_result,
[
+"\
+CONFIG_NAME_1 |kconfig| expected_1 |decision_1| reason_1 | FAIL: is not found\
+name_4 |cmdline| expected_4 |decision_4| reason_4 | FAIL: is not found\
+" ]
+ )
+
+ stdout_result = []
+ self.get_engine_result(config_checklist, stdout_result, 'stdout_verbose')
+ self.assertEqual(
+ stdout_result,
+ [
"\
<<< OR >>> | FAIL: is not found\n\
CONFIG_NAME_1 |kconfig| expected_1 |decision_1| reason_1 | FAIL: is not found\n\
"\
<<< OR >>> | FAIL: is not found\n\
CONFIG_NAME_1 |kconfig| expected_1 |decision_1| reason_1 | FAIL: is not found\n\