makekconfig.py: Exit with an error if there was a compile error
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
4a498d92c5
commit
1e4ac2972d
|
@ -16,7 +16,7 @@ Args = parser.parse_args()
|
|||
Kconfig = pathlib.Path(Args.kconfig[0])
|
||||
Config = pathlib.Path("scripts/config").absolute()
|
||||
Make = pathlib.Path("~/bin/makelinux.zsh").expanduser()
|
||||
MakeArg = Args.makeargs + ([ f"{str(Kconfig.parent)}/" ] if Args.quick else [ ])
|
||||
MakeArg = Args.makeargs + ([ f"{str(Kconfig)}/" ] if Args.quick else [ ])
|
||||
Options = dict()
|
||||
Colors = { "n" : "grey", "y" : "green", "m" : "cyan" }
|
||||
Attrs = { "y" : [ "bold" ], "m" : [ "bold" ] }
|
||||
|
@ -80,7 +80,10 @@ class Option:
|
|||
termcolor.cprint(self.state, Colors.get(self.state), attrs=["bold", "dark"])
|
||||
|
||||
def print_result(self):
|
||||
result = ("Success", "green") if self.res == True else ("Failed", "red")
|
||||
match self.res:
|
||||
case True: result = ("Success", "green")
|
||||
case False: result = ("Failed", "red")
|
||||
case _: result = ("Not Run", "yellow")
|
||||
termcolor.cprint(" " + self.name + " ", Colors.get(self.state), attrs=["bold", "dark"], end="")
|
||||
termcolor.cprint(" " * (NameLen - len(self.name)), "grey", attrs=["underline"], end="")
|
||||
termcolor.cprint(" " + result[0], result[1], attrs=["bold", "dark"])
|
||||
|
@ -97,6 +100,7 @@ def make_opt(option):
|
|||
option.enable()
|
||||
print()
|
||||
for o in options: o.print()
|
||||
option.res = False
|
||||
subprocess.run([ Make ] + [ "olddefconfig" ]).check_returncode()
|
||||
subprocess.run([ Make ] + MakeArg).check_returncode()
|
||||
option.res = True
|
||||
|
@ -110,3 +114,4 @@ except Exception as e:
|
|||
finally:
|
||||
termcolor.cprint(f"\nKconfig Results:", "yellow", attrs=["bold", "underline"])
|
||||
for opt in options: opt.print_result()
|
||||
if False in [ opt.res for opt in options ]: sys.exit(1)
|
||||
|
|
Loading…
Reference in New Issue