Improve the final result output
authorAlexander Popov <alex.popov@linux.com>
Tue, 12 Mar 2019 14:29:20 +0000 (17:29 +0300)
committerAlexander Popov <alex.popov@linux.com>
Tue, 12 Mar 2019 14:29:20 +0000 (17:29 +0300)
Refers to issue #13.

kconfig-hardened-check.py

index 5ef937ceb9754aef2e60ace7e51dc19123941bdf..64f6efb5a94a0a63d006df94f47c0b7c061440b9 100755 (executable)
@@ -423,13 +423,11 @@ if __name__ == '__main__':
         construct_checklist(arch)
         check_config_file(args.config)
         error_count = len(list(filter(lambda opt: opt.result and opt.result.startswith('FAIL'), checklist)))
+        ok_count = len(list(filter(lambda opt: opt.result and opt.result.startswith('OK'), checklist)))
         if debug_mode:
             sys.exit(0)
-        if error_count == 0:
-            print('[+] config check is PASSED')
-            sys.exit(0)
-        else:
-            sys.exit('[-] config check is NOT PASSED: {} errors'.format(error_count))
+        print('[+] config check is finished: \'OK\' - {} / \'FAIL\' - {}'.format(ok_count, error_count))
+        sys.exit(0)
 
     if args.print:
         arch = args.print