Skip to content

Commit e1ce469

Browse files
committed
9pm.py: add new flag --no-exec
Add a flag which doesn't execute any test case or onfail. This is useful when checking what will be executed and when elaborating with test specifications for the test report. Signed-off-by: Richard Alpe <[email protected]>
1 parent b758cf1 commit e1ce469

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

9pm.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
SCRATCHDIR = ""
2222
LOGDIR = None
2323
VERBOSE = False
24+
NOEXEC = False
2425

2526
if "TCLLIBPATH" in os.environ:
2627
os.environ["TCLLIBPATH"] = os.environ["TCLLIBPATH"] + " " + LIB_TCL_PATH
@@ -134,7 +135,8 @@ def run_onfail(args, test):
134135

135136
with open(os.path.join(LOGDIR, "on-fail.log"), 'a') as log:
136137
log.write(f"\n\nON FAIL START")
137-
execute(opts, onfail, log)
138+
if not NOEXEC:
139+
execute(opts, onfail, log)
138140

139141
def run_test(args, test):
140142
opts = []
@@ -155,7 +157,11 @@ def run_test(args, test):
155157
vcprint(pcolor.faint, f"Test Cmdl: {opts}")
156158

157159
with open(os.path.join(LOGDIR, test['outfile']), 'a') as output:
158-
skip_suite, skip, err = execute(opts, test, output)
160+
if NOEXEC:
161+
print("Skipped because --no-exec", file=output)
162+
return False, True, False
163+
else:
164+
skip_suite, skip, err = execute(opts, test, output)
159165

160166
if 'plan' not in test:
161167
print("test error, no plan")
@@ -618,6 +624,8 @@ def parse_cmdline():
618624
parser = argparse.ArgumentParser()
619625
parser.add_argument('-a', '--abort', action='store_true',
620626
help='(9PM) Abort execution if test fails')
627+
parser.add_argument('--no-exec', action='store_true',
628+
help='(9PM) Do not execute any tests')
621629
parser.add_argument('-p', '--proj', metavar='FILE', action='store',
622630
help='(9PM) Path to project configuration')
623631
parser.add_argument('-v', '--verbose', action='store_true',
@@ -703,6 +711,7 @@ def main():
703711
global SCRATCHDIR
704712
global LOGDIR
705713
global VERBOSE
714+
global NOEXEC
706715

707716
sha = ""
708717
if (sha := run_git_cmd(ROOT_PATH, ['rev-parse', 'HEAD'])):
@@ -711,6 +720,7 @@ def main():
711720

712721
args = parse_cmdline()
713722
VERBOSE = args.verbose
723+
NOEXEC = args.no_exec
714724

715725
rc = parse_rc(ROOT_PATH, args)
716726

0 commit comments

Comments
 (0)