X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=kconfig-hardened-check.py;h=f39995deb4a449f674680301324feede187b9f69;hb=d9aca2d28e9f95266bca2da09625d7d2c885a6b2;hp=5ef937ceb9754aef2e60ace7e51dc19123941bdf;hpb=c83dc6c7c804987999296afba385b2349bdda9ac;p=kconfig-hardened-check.git diff --git a/kconfig-hardened-check.py b/kconfig-hardened-check.py index 5ef937c..f39995d 100755 --- a/kconfig-hardened-check.py +++ b/kconfig-hardened-check.py @@ -128,8 +128,8 @@ class AND(ComplexOptCheck): self.result = opt.result return ret, self.result elif not ret: - # The requirement is not met. Skip the check. - return False, '' + self.result = 'FAIL: CONFIG_{} is needed'.format(opt.name) + return False, self.result sys.exit('[!] ERROR: invalid AND check') @@ -344,9 +344,8 @@ def print_check_results(): 'option name', 'desired val', 'decision', 'reason', 'check result')) print(' ' + '=' * 115) for opt in checklist: - if opt.result: - print(' CONFIG_{:<32}|{:^13}|{:^10}|{:^20}||{:^28}'.format( - opt.name, opt.expected, opt.decision, opt.reason, opt.result)) + print(' CONFIG_{:<32}|{:^13}|{:^10}|{:^20}||{:^28}'.format( + opt.name, opt.expected, opt.decision, opt.reason, opt.result)) print() @@ -422,14 +421,12 @@ 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))) + error_count = len(list(filter(lambda opt: opt.result.startswith('FAIL'), checklist))) + ok_count = len(list(filter(lambda opt: 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