From 92a989b9d41655248b2a985d5f82d69fa7104da0 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Tue, 15 Dec 2020 17:24:57 +0100 Subject: [PATCH] cpu-gather: Move simple model extraction to new script Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- tests/cputestdata/cpu-gather.py | 60 +++++++++++++++++++++++++++++++++ tests/cputestdata/cpu-gather.sh | 13 ------- 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py index 0c8d8e93d0..5c03d226b6 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -115,6 +115,63 @@ def gather_static_model(args): return None +def gather_full_model(args, static_model): + if static_model: + return [] + else: + return call_qemu(args.path_to_qemu, [ + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "feature-words" + }, + "id": "feature-words" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "family" + }, + "id": "family" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "model" + }, + "id": "model" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "stepping" + }, + "id": "stepping" + }, + { + "execute": "qom-get", + "arguments": + { + "path": "/machine/unattached/device[0]", + "property": "model-id" + }, + "id": "model-id" + }, + { + "execute": "query-cpu-definitions", + "id": "definitions" + } + ]) + + def main(): parser = argparse.ArgumentParser(description="Gather cpu test data") parser.add_argument( @@ -161,6 +218,9 @@ def main(): print(" 0x{:x}: 0x{:016x}\n".format(int(key), value)) static_model = gather_static_model(args) + model = gather_full_model(args, static_model) + for o in model: + print(json.dumps(o)) print(end="", flush=True) os.environ["CPU_GATHER_PY"] = "true" diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather.sh index 726f013908..05faf14a96 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -5,13 +5,6 @@ if [ -z "${CPU_GATHER_PY}" ]; then exit 1 fi -qom_get() -{ - path='/machine/unattached/device[0]' - echo '{"execute":"qom-get","arguments":{"path":"'$path'",' \ - '"property":"'$1'"},"id":"'$1'"}' -} - model_expansion() { mode=$1 @@ -26,12 +19,6 @@ $qemu -machine accel=kvm -cpu host -nodefaults -nographic -qmp stdio <