projects
/
kconfig-hardened-check.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c69de43
)
Turn some error conditions into assertions (part 4)
author
Alexander Popov
<alex.popov@linux.com>
Wed, 8 Jun 2022 22:03:19 +0000
(
01:03
+0300)
committer
Alexander Popov
<alex.popov@linux.com>
Wed, 8 Jun 2022 22:03:19 +0000
(
01:03
+0300)
kconfig_hardened_check/__init__.py
patch
|
blob
|
history
diff --git
a/kconfig_hardened_check/__init__.py
b/kconfig_hardened_check/__init__.py
index 0ed7dd349ff4370d947e81390f0815be8c29d466..fea82724f2aa54ae19bb0bd799ed28ff34ec58b9 100644
(file)
--- a/
kconfig_hardened_check/__init__.py
+++ b/
kconfig_hardened_check/__init__.py
@@
-747,10
+747,10
@@
def populate_simple_opt_with_data(opt, data, data_type):
if data_type in ('kconfig', 'cmdline'):
opt.state = data.get(opt.name, None)
if data_type in ('kconfig', 'cmdline'):
opt.state = data.get(opt.name, None)
- elif data_type == 'version':
- opt.ver = data
else:
else:
- sys.exit('[!] ERROR: unexpected data type "{}"'.format(data_type))
+ assert(data_type == 'version'), \
+ 'unexpected data type "{}"'.format(data_type)
+ opt.ver = data
def populate_opt_with_data(opt, data, data_type):
def populate_opt_with_data(opt, data, data_type):
@@
-762,8
+762,8
@@
def populate_opt_with_data(opt, data, data_type):
else:
populate_simple_opt_with_data(o, data, data_type)
else:
else:
populate_simple_opt_with_data(o, data, data_type)
else:
- if opt.type not in ('kconfig', 'cmdline'):
-
sys.exit('[!] ERROR: bad type "{}" for a simple check {}'.format(opt.type, opt.name)
)
+ assert(opt.type in ('kconfig', 'cmdline')), \
+
'bad type "{}" for a simple check'.format(opt.type
)
populate_simple_opt_with_data(opt, data, data_type)
populate_simple_opt_with_data(opt, data, data_type)