Skip to content

Commit

Permalink
Add "--expected-fail" option to run_framework.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Hardcode84 committed Aug 20, 2022
1 parent d69692d commit 4efe9b2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
python -m pip install numba==0.54
- name: Test
run: |
python run_framework.py -f numba -r 1 --ignore-errors=0
python run_framework.py -f numba -r 1 --ignore-errors=0 --expected-fail=azimint_hist,contour_integral,correlation,covariance,durbin,mlp
23 changes: 21 additions & 2 deletions run_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,21 @@ def run_benchmark(benchname, fname, preset, validate, repeat, timeout,
type=util.str2bool,
nargs="?",
default=True)
parser.add_argument("--expected-fail",
type=str,
nargs="?",
default="")
args = vars(parser.parse_args())

parent_folder = pathlib.Path(__file__).parent.absolute()
bench_dir = parent_folder.joinpath("bench_info")
pathlist = pathlib.Path(bench_dir).rglob('*.json')
benchnames = [os.path.basename(path)[:-5] for path in pathlist]
benchnames.sort()

xfail = set(filter(None, args["expected_fail"].split(',')))
failed = []
xpassed = []
for benchname in benchnames:
p = Process(
target=run_benchmark,
Expand All @@ -63,10 +70,22 @@ def run_benchmark(benchname, fname, preset, validate, repeat, timeout,
p.start()
p.join()
exit_code = p.exitcode
if exit_code != 0:
failed.append(benchname)
if benchname in xfail:
if exit_code == 0:
xpassed.append(benchname)
else:
if exit_code != 0:
failed.append(benchname)

if len(failed) != 0:
print(f"Failed: {len(failed)} out of {len(benchnames)}")
for bench in failed:
print(bench)

if len(xpassed) != 0:
print(f"Unexpectedly passed: {len(xpassed)} out of {len(benchnames)}")
for bench in xpassed:
print(bench)

if len(failed) != 0 or len(xpassed) != 0:
sys.exit(1)

0 comments on commit 4efe9b2

Please sign in to comment.