From: Alexander Popov Date: Sat, 22 Apr 2023 22:23:38 +0000 (+0300) Subject: engine: implement override_expected_value() X-Git-Tag: v0.6.6~170 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=c1090722157b531261a7cf0257f2dccb744bd93d;p=kconfig-hardened-check.git engine: implement override_expected_value() --- diff --git a/kconfig_hardened_check/engine.py b/kconfig_hardened_check/engine.py index e88781e..6791285 100644 --- a/kconfig_hardened_check/engine.py +++ b/kconfig_hardened_check/engine.py @@ -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()