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:
Anna Schumaker 2022-01-20 16:58:36 -05:00
parent 4a498d92c5
commit 1e4ac2972d
2 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -16,6 +16,7 @@ tags=($(python $BIN/colors/vm.py $CLIENT $SERVER))
$BIN/rdma.zsh $RDMA $CLIENT $SERVER
ssh $SERVER "rping -s -C 1 -v 2>&1" | sed "s/^/${tags[2]} /" &
sleep 1
ssh $CLIENT "rping -c -C 1 -S 40 -v -a $SERVER 2>&1" | sed "s/^/${tags[1]} /"
wait $(jobs -pr)