Use None as state of the options which are not found
authorAlexander Popov <alex.popov@linux.com>
Fri, 20 Jul 2018 15:55:43 +0000 (18:55 +0300)
committerAlexander Popov <alex.popov@linux.com>
Fri, 20 Jul 2018 15:58:08 +0000 (18:58 +0300)
That will change the check result
  FAIL: "not found"
onto initial
  FAIL: not found

kconfig-hardened-check.py

index 3278376e634e0055fde5f1b11fc6f7f0b1af7723..a239836563ddf9d677f14732c0dd5a4a00677c01 100755 (executable)
@@ -36,11 +36,17 @@ class Opt:
 
     def check(self):
         global error_count
-        # check parsed state against expected state
+
         if self.expected == self.state:
             return True, 'OK'
-        if self.expected == 'is not set' and self.state == 'not found':
-            return True, 'OK: not found'
+
+        if self.state is None:
+            if self.expected == 'is not set':
+                return True, 'OK: not found'
+            else:
+                error_count += 1
+                return False, 'FAIL: not found'
+
         error_count += 1
         return False, 'FAIL: "' + self.state + '"'
 
@@ -173,7 +179,7 @@ def print_check_results():
 
 
 def get_option_state(options, name):
-    return options[name] if name in options else 'not found'
+    return options[name] if name in options else None
 
 
 def check_state(options):