mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
commit some improvements to the CI framework
This commit is contained in:
parent
ba18f3cbe2
commit
52f1afa780
2 changed files with 29 additions and 5 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
@ -14,6 +15,9 @@ def main():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--loglevel", required=False, help="set logging level (INFO/DEBUG/WARNING/ERROR)", type=str, default="INFO",
|
"--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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
numeric_level = getattr(logging, args.loglevel.upper(), None)
|
numeric_level = getattr(logging, args.loglevel.upper(), None)
|
||||||
|
|
@ -24,7 +28,14 @@ def main():
|
||||||
pass_log = {}
|
pass_log = {}
|
||||||
err_log = []
|
err_log = []
|
||||||
timeout = 240 # a bit longer to allow for a compilation to happen
|
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))
|
err_log.append("Starting seed {}".format(seed))
|
||||||
seed_env = os.environ
|
seed_env = os.environ
|
||||||
seed_env["XOUS_SEED"] = str(seed)
|
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
|
timeout = 20 # reset the timeout after the first run to something shorter, now that any potential compilation step is done
|
||||||
|
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
['python', './tools/pddbdbg.py', '--name', args.name],
|
[sys.executable, './tools/pddbdbg.py', '--name', args.name],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
errors='replace'
|
errors='replace'
|
||||||
)
|
)
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
script_success=False
|
||||||
while True:
|
while True:
|
||||||
realtime_output = proc.stdout.readline()
|
realtime_output = proc.stdout.readline()
|
||||||
if (realtime_output == '' and proc.poll() is not None) or (time.time() - start_time > 45):
|
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)
|
err_log.append(realtime_output)
|
||||||
logging.debug("output contained warnings")
|
logging.debug("output contained warnings")
|
||||||
passing = 'FAIL CI 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))
|
logging.info("Seed {} {}".format(seed, passing))
|
||||||
pass_log[seed] = passing
|
pass_log[seed] = passing
|
||||||
|
|
@ -120,10 +137,17 @@ def main():
|
||||||
err_log = []
|
err_log = []
|
||||||
|
|
||||||
# summary report
|
# summary report
|
||||||
|
passing = True
|
||||||
for items in pass_log.items():
|
for items in pass_log.items():
|
||||||
logging.info(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__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
exit(0)
|
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ def main():
|
||||||
for bdict in basis_dicts.values():
|
for bdict in basis_dicts.values():
|
||||||
bdict.ci_check()
|
bdict.ci_check()
|
||||||
if found_all_dicts:
|
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:
|
else:
|
||||||
logging.error("Missing dictionaries, something is wrong.")
|
logging.error("Missing dictionaries, something is wrong.")
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue