Turn the comment on how to aquire cpuid into a runtime error message. Use "http" instead of "https" in the URL, as the latter is broken. Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- tests/cputestdata/cpu-gather.py | 25 +++++++++++++++++++++++++ tests/cputestdata/cpu-gather.sh | 7 ------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py index 4e8c72e4f4..97655399c8 100755 --- a/tests/cputestdata/cpu-gather.py +++ b/tests/cputestdata/cpu-gather.py @@ -18,6 +18,25 @@ def gather_name(args): "Use '--model' to set a model name.") +def gather_cpuid_leaves(): + try: + output = subprocess.check_output( + ["cpuid", "-1r"], + universal_newlines=True) + except FileNotFoundError as e: + exit("Error: '{}' not found.\n'cpuid' can be usually found in a " + "package named identically. If your distro does not provide such " + "package, you can find the sources or binary packages at " + "'http://www.etallen.com/cpuid.html'.".format(e.filename)) + + for line in output.split("\n"): + if not line: + continue + if line == "CPU:": + continue + yield line.strip() + + def main(): parser = argparse.ArgumentParser(description="Gather cpu test data") parser.add_argument( @@ -30,6 +49,12 @@ def main(): name = gather_name(args) print("model name\t: {}".format(name)) + leaves = gather_cpuid_leaves() + print("CPU:") + for leave in leaves: + print(" {}".format(leave)) + print() + print(end="", flush=True) os.environ["CPU_GATHER_PY"] = "true" subprocess.check_call("./cpu-gather.sh") diff --git a/tests/cputestdata/cpu-gather.sh b/tests/cputestdata/cpu-gather.sh index b671f223a5..f84215e777 100755 --- a/tests/cputestdata/cpu-gather.sh +++ b/tests/cputestdata/cpu-gather.sh @@ -1,17 +1,10 @@ #!/bin/bash -# -# The cpuid tool can be usually found in a package called "cpuid". If your -# distro does not provide such package, you can find the sources or binary -# packages at https://www.etallen.com/cpuid.html if [ -z "${CPU_GATHER_PY}" ]; then echo >&2 "Do not call this script directly. Use 'cpu-gather.py' instead." exit 1 fi -cpuid -1r -echo - python3 <<EOF from struct import pack, unpack from fcntl import ioctl -- 2.26.2