[PATCH 07/14] cputest: Rename cpu-convert.py script as cpu-cpuid.py

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 tests/cputestdata/{cpu-convert.py => cpu-cpuid.py} | 17 ++++++++++++++++-
 tests/cputestdata/cpu-parse.sh                     |  2 +-
 2 files changed, 17 insertions(+), 2 deletions(-)
 rename tests/cputestdata/{cpu-convert.py => cpu-cpuid.py} (98%)

diff --git a/tests/cputestdata/cpu-convert.py b/tests/cputestdata/cpu-cpuid.py
similarity index 98%
rename from tests/cputestdata/cpu-convert.py
rename to tests/cputestdata/cpu-cpuid.py
index e069408c8..a4dc23378 100755
--- a/tests/cputestdata/cpu-convert.py
+++ b/tests/cputestdata/cpu-cpuid.py
@@ -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)
diff --git a/tests/cputestdata/cpu-parse.sh b/tests/cputestdata/cpu-parse.sh
index 86bcb030d..d823c399b 100755
--- a/tests/cputestdata/cpu-parse.sh
+++ b/tests/cputestdata/cpu-parse.sh
@@ -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
-- 
2.12.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux