commit some improvements to the CI framework

This commit is contained in:
bunnie 2022-03-31 00:28:49 +08:00
parent ba18f3cbe2
commit 52f1afa780
2 changed files with 29 additions and 5 deletions

View file

@ -1,6 +1,7 @@
#! /usr/bin/env python3
import argparse
import os
import sys
import logging
import subprocess
import time
@ -14,6 +15,9 @@ def main():
parser.add_argument(
"--loglevel", required=False, help="set logging level (INFO/DEBUG/WARNING/ERROR)", type=str, default="INFO",
)
parser.add_argument(
"--runs", required=False, help="sets the number of runs", default='501'
)
args = parser.parse_args()
numeric_level = getattr(logging, args.loglevel.upper(), None)
@ -24,7 +28,14 @@ def main():
pass_log = {}
err_log = []
timeout = 240 # a bit longer to allow for a compilation to happen
for seed in range(0, 501):
for seed in range(0, int(args.runs)):
# remove the previous runs analysis file
try:
os.remove('./tools/pddb-images/{}.bin'.format(args.name))
os.remove('./tools/pddb-images/{}.key'.format(args.name))
except OSError as e:
print('Error removing previous run output: {}'.format(e.strerror))
err_log.append("Starting seed {}".format(seed))
seed_env = os.environ
seed_env["XOUS_SEED"] = str(seed)
@ -85,13 +96,14 @@ def main():
timeout = 20 # reset the timeout after the first run to something shorter, now that any potential compilation step is done
proc = subprocess.Popen(
['python', './tools/pddbdbg.py', '--name', args.name],
[sys.executable, './tools/pddbdbg.py', '--name', args.name],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding='utf-8',
errors='replace'
)
start_time = time.time()
script_success=False
while True:
realtime_output = proc.stdout.readline()
if (realtime_output == '' and proc.poll() is not None) or (time.time() - start_time > 45):
@ -111,6 +123,11 @@ def main():
err_log.append(realtime_output)
logging.debug("output contained warnings")
passing = 'FAIL CI WARNINGS'
if 'All dicts were found.' in realtime_output:
script_success=True
if passing == 'PASS' and script_success == False:
passing = 'FAIL CI COULD NOT RUN'
logging.info("Seed {} {}".format(seed, passing))
pass_log[seed] = passing
@ -120,10 +137,17 @@ def main():
err_log = []
# summary report
passing = True
for items in pass_log.items():
logging.info(items)
if items[1] != 'PASS':
passing = False
if passing:
logging.info("Overall pass, exiting with 0")
exit(0)
else:
logging.info("A failure was detected, exiting with 1")
exit(1)
if __name__ == "__main__":
main()
exit(0)

View file

@ -274,7 +274,7 @@ def main():
for bdict in basis_dicts.values():
bdict.ci_check()
if found_all_dicts:
logging.info("All dicts were found.")
logging.info("All dicts were found.") # this message is searched for in CI, don't change it
else:
logging.error("Missing dictionaries, something is wrong.")
else: