Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- tests/cputestdata/cpu-gather.py | 13 ++++++++++--- tests/cputestdata/cpu-gather.sh | 5 ----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py index e4a82fc949..0c8d8e93d0 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -91,7 +91,9 @@ def call_qemu(qemu, qmp_cmds): except FileNotFoundError: exit("Error: File not found: '{}'.".format(qemu)) - return output + for line in output.split("\n"): + if line: + yield json.loads(line) def gather_static_model(args): @@ -105,7 +107,12 @@ def gather_static_model(args): }, "id": "model-expansion" }]) - return output + + for o in output: + if o.get("id") == "model-expansion": + return o["return"]["model"] + + return None def main(): @@ -158,7 +165,7 @@ def main(): print(end="", flush=True) os.environ["CPU_GATHER_PY"] = "true" os.environ["qemu"] = args.path_to_qemu - os.environ["model"] = static_model + os.environ["model"] = json.dumps(static_model) if static_model else "" subprocess.check_call("./cpu-gather.sh") diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather.sh index af0f40b61c..726f013908 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -21,11 +21,6 @@ model_expansion() '{"type":"'"$mode"'","model":'"$model"'},"id":"model-expansion"}' } -model=$( - echo "$model" | \ - sed -ne 's/^{"return": {"model": {\(.*{.*}\)}}, .*/{\1}/p' -) - $qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <<EOF {"execute":"qmp_capabilities"} $( -- 2.26.2