From 7edb9d258672896f80f772a268e0af620ff43c6a Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Wed, 25 Jul 2018 01:36:25 +0300 Subject: [PATCH] Improve the OR result calculation 1. don't duplicate opts[0].name in the successful output; 2. fix the bug with printing None state, just reuse the OptCheck.result. --- kconfig-hardened-check.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kconfig-hardened-check.py b/kconfig-hardened-check.py index 8d1ecdf..e8b846c 100755 --- a/kconfig-hardened-check.py +++ b/kconfig-hardened-check.py @@ -83,12 +83,15 @@ class OR: return self.opts[0].reason def check(self): - for opt in self.opts: + for i, opt in enumerate(self.opts): result, msg = opt.check() if result: - self.result = 'OK (CONFIG_{} {})'.format(opt.name, opt.state) - return result, self.result - self.result = 'FAIL: "{}"'.format(self.opts[0].state) + if i == 0: + self.result = opt.result + else: + self.result = 'CONFIG_{}: {} ("{}")'.format(opt.name, opt.result, opt.expected) + return True, self.result + self.result = self.opts[0].result return False, self.result -- 2.31.1