engine: implement override_expected_value()
authorAlexander Popov <alex.popov@linux.com>
Sat, 22 Apr 2023 22:23:38 +0000 (01:23 +0300)
committerAlexander Popov <alex.popov@linux.com>
Sat, 22 Apr 2023 22:23:38 +0000 (01:23 +0300)
kconfig_hardened_check/engine.py

index e88781e5cfbf19f9c5ecd274bfa7a7e2d2d8171c..67912857e479792a2420133bb71ceb6df2ad7668 100644 (file)
@@ -283,6 +283,14 @@ def populate_with_data(checklist, data, data_type):
         populate_opt_with_data(opt, data, data_type)
 
 
+def override_expected_value(checklist, name, new_val):
+    for opt in checklist:
+        if opt.name == name:
+            assert(opt.type in ('kconfig', 'cmdline')), \
+                   f'overriding an expected value for "{opt.type}" checks is not supported yet'
+            opt.expected = new_val
+
+
 def perform_checks(checklist):
     for opt in checklist:
         opt.check()