Fix the bug in OptCheck.check() introduced in cb779a71bf57d95b
authorAlexander Popov <alex.popov@linux.com>
Sun, 5 Mar 2023 20:56:45 +0000 (23:56 +0300)
committerAlexander Popov <alex.popov@linux.com>
Mon, 6 Mar 2023 08:08:00 +0000 (11:08 +0300)
Use 'elif' instead of 'if' to avoid wrong self.result when
self.state is 'off'.

We need unit-tests for the engine checking the correctness: #79

kconfig_hardened_check/engine.py

index 0d27b775660d8f73a06f2537573dfcf4f29c4a30..63087400bb57b21dd160b78ab243c921b9ee930c 100644 (file)
@@ -62,7 +62,7 @@ class OptCheck:
         if self.expected == 'is not off':
             if self.state == 'off':
                 self.result = 'FAIL: is off'
-            if self.state == '0':
+            elif self.state == '0':
                 self.result = 'FAIL: is off, "0"'
             elif self.state is None:
                 self.result = 'FAIL: is off, not found'