@@ -98,9 +98,9 @@ class variables in the {"level name": ["call", ...]} format.
98
98
Attributes:
99
99
file_path: path of the file to be loaded.
100
100
"""
101
- def __init__ (self , file_path ):
101
+ def __init__ (self , file_path , elf_file ):
102
102
self .file_path = file_path
103
- self ._elf = ELFFile (open ( file_path , "rb" ) )
103
+ self ._elf = ELFFile (elf_file )
104
104
self ._load_objects ()
105
105
self ._load_level_addr ()
106
106
self ._process_initlevels ()
@@ -226,7 +226,7 @@ class Validator():
226
226
edt_pickle: name of the EDT pickle file
227
227
log: a logging.Logger object
228
228
"""
229
- def __init__ (self , elf_file_path , edt_pickle , log ):
229
+ def __init__ (self , elf_file_path , edt_pickle , log , elf_file ):
230
230
self .log = log
231
231
232
232
edt_pickle_path = pathlib .Path (
@@ -237,7 +237,7 @@ def __init__(self, elf_file_path, edt_pickle, log):
237
237
238
238
self ._ord2node = edt .dep_ord2node
239
239
240
- self ._obj = ZephyrInitLevels (elf_file_path )
240
+ self ._obj = ZephyrInitLevels (elf_file_path , elf_file )
241
241
242
242
self .errors = 0
243
243
@@ -344,17 +344,18 @@ def main(argv=None):
344
344
345
345
log .info (f"check_init_priorities: { args .elf_file } " )
346
346
347
- validator = Validator (args .elf_file , args .edt_pickle , log )
348
- if args .initlevels :
349
- validator .print_initlevels ()
350
- else :
351
- validator .check_edt ()
347
+ with open (args .elf_file , "rb" ) as elf_file :
348
+ validator = Validator (args .elf_file , args .edt_pickle , log , elf_file )
349
+ if args .initlevels :
350
+ validator .print_initlevels ()
351
+ else :
352
+ validator .check_edt ()
352
353
353
- if args .always_succeed :
354
- return 0
354
+ if args .always_succeed :
355
+ return 0
355
356
356
- if validator .errors :
357
- return 1
357
+ if validator .errors :
358
+ return 1
358
359
359
360
return 0
360
361
0 commit comments