Skip to content
Snippets Groups Projects
Commit 55e9bbc4 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

auto-cases: do not schedule benchmark for incompatible data-env

If the repository use requirements not understood by the revision we benchmark,
we can skip it.
parent 51d4b326
No related branches found
No related tags found
No related merge requests found
Pipeline #55408 passed
......@@ -5,6 +5,8 @@
import subprocess
import sys
import poulpe_helper as poulpe
TARGET_PYTHON_VERSIONS = [
"3.7"
]
......@@ -75,6 +77,24 @@
raws = [Path(l) for l in p.stdout.splitlines()]
return [Path(*p.parts[:-1]) for p in raws]
compat_cache = {}
def compatible_with(base_dir, data_env, changeset):
"""check if a data_env is compatible with the selected revision"""
path = base_dir / "data-envs" / data_env / "data-env.poulpe"
data_args = poulpe.get_data(path)
assert data_args is not None, path
ds2_key = "data-env-vars.mercurial.repo.format.dirstate-v2"
if poulpe.get_one_value(data_args, ds2_key) == "yes":
if "dirstate-v2" not in compat_cache:
revs = list_mercurial_hashes(base_dir, 'tagged("6.0")::')
compat_cache['dirstate-v2'] = set(revs)
return changeset in compat_cache['dirstate-v2']
return True
def list_benchmarks(base_dir):
"""return a list of possible benchmarks"""
bench_dir = base_dir / "benchmarks"
......@@ -100,4 +120,6 @@
datas = list_data_envs(base_dir)
benchmarks = list_benchmarks(base_dir)
for i in range(size):
h = random.choice(hashes)
compatible_datas = [d for d in datas if compatible_with(base_dir, d, h)]
yield Case(
......@@ -103,3 +125,3 @@
yield Case(
random.choice(hashes),
h,
random.choice(variants),
......@@ -105,5 +127,5 @@
random.choice(variants),
random.choice(datas),
random.choice(compatible_datas),
random.choice(benchmarks),
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment