]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
cputest: Rename cpu-convert.py script as cpu-cpuid.py
authorJiri Denemark <jdenemar@redhat.com>
Wed, 15 Mar 2017 12:16:37 +0000 (13:16 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 27 Mar 2017 14:29:27 +0000 (16:29 +0200)
The new script is going to be more general and the original
functionality can be requested by "cpu-cpuid.py convert".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
tests/cputestdata/cpu-cpuid.py [moved from tests/cputestdata/cpu-convert.py with 98% similarity]
tests/cputestdata/cpu-parse.sh

similarity index 98%
rename from tests/cputestdata/cpu-convert.py
rename to tests/cputestdata/cpu-cpuid.py
index e069408c8cf698307c4a6f71605ecd262d69b739..a4dc233780378c46e73b8ef0c755f70a08b6d4e3 100755 (executable)
@@ -222,7 +222,7 @@ def propAdd(props, feature, value):
         props[name] = value
 
 
-for path in sys.argv[1:]:
+def convert(path):
     props, cpuid = parseFeatureWords(path)
 
     for feature in cpuidMap:
@@ -247,3 +247,18 @@ for path in sys.argv[1:]:
                    "id": "model-expansion"},
                   f, indent = 2, separators = (',', ': '))
         f.write("\n")
+
+
+if len(sys.argv) < 3:
+    print "Usage: %s convert json_file..." % sys.argv[0]
+    sys.exit(1)
+
+action = sys.argv[1]
+args = sys.argv[2:]
+
+if action == "convert":
+    for path in args:
+        convert(path)
+else:
+    print "Unknown action: " + action
+    sys.exit(1)
index 86bcb030d14839ed3c395af26170c455e606e595..d823c399b0f76b5218632fc3d529123d10861946 100755 (executable)
@@ -53,7 +53,7 @@ json <<<"$data" >$fname.json
 if [[ -s $fname.json ]]; then
     echo $fname.json
     if ! grep -q model-expansion $fname.json; then
-        $(dirname $0)/cpu-convert.py $fname.json
+        $(dirname $0)/cpu-cpuid.py convert $fname.json
     fi
 else
     rm $fname.json