examples_check: fix for meson-0.50

meson changed behaviour ... the json output is slightly different, the
paths are now absolut. This fixes the behaviour and makes it work with
new and old versions.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8327
This commit is contained in:
Marcel Hollerbach 2019-03-13 16:59:17 +01:00
parent c3f823418d
commit 5e4560c7cc
1 changed files with 17 additions and 2 deletions

View File

@ -105,7 +105,14 @@ def simulate_example(example):
args = []
if os.path.basename(example) in example_preparation:
args = example_preparation[os.path.basename(example)]()
run = subprocess.Popen([G.builddir + "/" + example] + args,
#meson changed behaviour from 0.49 to 0.50 so we need this:
if os.path.isabs(example):
example_dir = example
example_dir = os.path.join(G.builddir, example)
run = subprocess.Popen([example_dir] + args,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
@ -119,10 +126,18 @@ def simulate_example(example):
return (example, True if b'ERR' in outs or b'ERR' in errs else False, run.poll())
#meson changed behaviour from 0.49 to 0.50 so we need this:
def meson_fetch_filename(filename_object):
if isinstance(filename_object, str):
return filename_object
return filename_object[0]
parser = argparse.ArgumentParser(description='Run the examples of efl')
parser.add_argument('builddir', metavar='build', help='the path where to find the meson build directory')
G = parser.parse_args()
#Run meson to fetch all examples
meson_introspect = subprocess.Popen(["meson", "introspect", G.builddir, "--targets"],
@ -131,7 +146,7 @@ meson_introspect = subprocess.Popen(["meson", "introspect", G.builddir, "--targe
build_targets = json.loads(meson_introspect.stdout.read())
examples = [b["filename"] for b in build_targets if "examples" in b["filename"] and b["type"] == "executable"]
examples = [meson_fetch_filename(b["filename"]) for b in build_targets if "examples" in meson_fetch_filename(b["filename"]) and b["type"] == "executable"]
state = State(len(examples))
#simulate all examples in parallel with up to 5 runners
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor: