On 12/15/20 5:24 PM, Tim Wiederhake wrote:
This series refactors the various scripts found in tests/cputestdata and adds support for CORE_CAPABILITY MSR, as found on e.g. SnowRidge. Acquiring test data on a new system is a two step process. "cpu-gather.sh" gathers information on the target machine and has as few dependencies as possible. "cpu-parse.sh" processes this information but requires access to a libvirt source tree and has more dependencies, e.g. "xmltodict". This series merges three of the four involved scripts (cpu-gather.sh, cpu-parse.sh and cpu-reformat.py) into a single python3 script. python3 already was a dependency for cpu-gather.sh and care has been taken to not depend on modules that are not installed by default [1]. Merging the fourth script, cpu-cpuid.py, will come in a seperate series. Patches 1 to 14 transform cpu-gather into a python script, preserving the format of the output (except for consistent "\n" line endings; previously the tool would output a mix of "\n" and "\r\n"). Patches 15 to 23 merge cpu-parse into the script. In this process, the format of the intermediary data is changed to json. Patches 24 to 29 add support for "all in one" operation and extracting IA32_CORE_CAPABILITY_MSR, which can be found on e.g. SnowRidge CPUs. Old usage: ./cpu-gather.sh | ./cpu-parse.sh New: ./cpu-gather.py [--gather] | ./cpu-gather.py --parse Alternative on single machine: ./cpu-gather.py --gather --parse [1] https://docs.python.org/3/py-modindex.html Tim Wiederhake (29): cpu-cpuid: Shorten overly long line cpu-gather: Create python wrapper for shell script cpu-gather: Move model_name to new script cpu-gather: Allow overwriting model name cpu-gather: Move cpuid call to new script cpu-gather: Allow overwriting cpuid binary location cpu-gather: Move msr decoding to new script cpu-gather: Move qemu detection to new script cpu-gather: Move static model expansion to new script cpu-gather: Move static model extraction to new script cpu-gather: Move simple model extraction to new script cpu-gather: Move full model extraction to new script cpu-gather: Merge model gathering logic cpu-gather: Delete old script cpu-gather: Separate data input and output cpu-parse: Wrap with python script cpu-gather: Transport data as json cpu-parse: Move model name detection to new script cpu-parse: Move file name generation to new script cpu-parse: Move xml output to new script cpu-parse: Move json output to new script cpu-parse: Move call to cpu-cpuid.py to new script cpu-parse: Delete old script cpu-gather: Ignore empty responses from qemu cpu-gather: Ignore shutdown messages from qemu cpu-gather: Parse cpuid leaves early cpu-gather: Allow gathering and parsing data in one step. cpu-gather: Prepare gather_msr for reading multiple msr cpu-gather: Add IA32_CORE_CAPABILITY_MSR tests/cputestdata/cpu-cpuid.py | 5 +- tests/cputestdata/cpu-gather.py | 365 ++++++++++++++++++++++++++++++ tests/cputestdata/cpu-gather.sh | 103 --------- tests/cputestdata/cpu-parse.sh | 65 ------ tests/cputestdata/cpu-reformat.py | 9 - 5 files changed, 368 insertions(+), 179 deletions(-) create mode 100755 tests/cputestdata/cpu-gather.py delete mode 100755 tests/cputestdata/cpu-gather.sh delete mode 100755 tests/cputestdata/cpu-parse.sh delete mode 100755 tests/cputestdata/cpu-reformat.py
Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx> and will push shortly. Michal