diff --git a/tests/cputestdata/cpu-gather.py b/tests/cputestdata/cpu-gather.py
index 1a15cc1ff0..bc5c7dbb15 100755
--- a/tests/cputestdata/cpu-gather.py
+++ b/tests/cputestdata/cpu-gather.py
@@ -207,10 +207,50 @@ def parse_filename(data):
return "x86_64-cpuid-{}".format(filename)
+def output_xml(data, filename):
+ leave_pattern = re.compile(
+ "^\\s*"
+ "(0x[0-9a-f]+)\\s*"
+ "(0x[0-9a-f]+):\\s*"
+ "eax=(0x[0-9a-f]+)\\s*"
+ "ebx=(0x[0-9a-f]+)\\s*"
+ "ecx=(0x[0-9a-f]+)\\s*"
+ "edx=(0x[0-9a-f]+)\\s*$")
+
+ leave_template = \
+ " \n"
+
+ msr_template = " \n"
+
+ print(filename)
+ with open(filename, "wt") as f:
+ f.write("\n".format(data["name"]))
+ f.write("\n")
+ for line in data["leaves"]:
+ match = leave_pattern.match(line)
+ f.write(leave_template.format(*match.groups()))
+ for key, value in sorted(data["msr"].items()):
+ f.write(msr_template.format(
+ int(key),
+ 0xffffffff & (value >> 32),
+ 0xffffffff & (value >> 0)))
+ f.write("\n")
+
+
def parse(args):
data = json.load(sys.stdin)
filename = parse_filename(data)
+ filename_xml = "{}.xml".format(filename)
+
+ output_xml(data, filename_xml)
os.environ["CPU_GATHER_PY"] = "true"
os.environ["model"] = data["name"]
diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh
index 2a41897538..84d37d0df4 100755
--- a/tests/cputestdata/cpu-parse.sh
+++ b/tests/cputestdata/cpu-parse.sh
@@ -7,21 +7,6 @@ fi
data=`cat`
-xml()
-{
- hex='\(0x[0-9a-f]\+\)'
- matchCPUID="$hex $hex: eax=$hex ebx=$hex ecx=$hex edx=$hex"
- substCPUID=""
-
- matchMSR="$hex: $hex\(.......[0-9a-f]\)"
- substMSR=""
-
- echo ""
- echo ""
- sed -ne "s/^ *$matchCPUID$/ $substCPUID/p; s/^ *$matchMSR$/ $substMSR/p"
- echo ""
-}
-
json()
{
first=true
@@ -36,9 +21,6 @@ json()
done
}
-xml <<<"$data" >$fname.xml
-echo $fname.xml
-
json <<<"$data" >$fname.json
if [[ -s $fname.json ]]; then
echo $fname.json