Rename tests/update-test-read-dwarf-output.py
authorDodji Seketeli <dodji@redhat.com>
Fri, 2 Dec 2016 11:54:49 +0000 (12:54 +0100)
committerDodji Seketeli <dodji@redhat.com>
Fri, 2 Dec 2016 11:59:32 +0000 (12:59 +0100)
Renamed tests/update-test-read-dwarf-output.py into
tests/update-test-output.py as it can be used for all tests that emit
an output and compare it against a reference output.

* tests/update-test-output.py: renamed
tests/update-test-read-dwarf-output.py into this.  Update its
comments.  Make this script executable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tests/update-test-output.py [new file with mode: 0755]
tests/update-test-read-dwarf-output.py [deleted file]

diff --git a/tests/update-test-output.py b/tests/update-test-output.py
new file mode 100755 (executable)
index 0000000..4017dd0
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/python
+
+# This program generates the copy commands you should use to update
+# the reference data for tests <build-dir>/tests/runtest* that emit an
+# output that is compared against a reference output.
+# 
+# It takes in argument the diff result emitted by
+# <build-dir>/tests/runtest*, and emits on standard output a series of
+# 'cp <src> <dest>' commands to execute to update reference data of
+# the test.
+
+import fileinput
+import re
+import sys
+import getopt
+
+
+def display_usage():
+    sys.stderr.write("usage: prog-name [options] <file-name|-->\n");
+    sys.stderr.write(" options:\n");
+    sys.stderr.write("  -h  display this help\n");
+    sys.stderr.write(" argument:\n");
+    sys.stderr.write("  <file-name>  the file to read from\n");
+    sys.stderr.write("  if no argument, then reads from stdin\n");
+
+    sys.exit(2)
+
+def main():
+    input_file = None
+
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], "hi", ["help"])
+    except getopt.GetoptError as err:
+        print str(err)
+        display_usage()
+
+    for opt, arg in opts:
+        if opt in ("-h", "--help"):
+            display_usage()
+        else:
+            # unknown option.
+            display_usage()
+
+    if input_file == None and len(args) and args[0] != None:
+        input_file = open(args[0], 'r')
+    elif input_file == None:
+        input_file = sys.stdin
+
+    if input_file != None:
+        process(input_file)
+    else:
+        display_usage()
+
+
+def process(input_file):
+    source = ""
+    dest = ""
+    for line in input_file:
+        m = re.match(r'^--- (.*?)\t', line)
+        if m:
+            dest = m.group(1)
+        else:
+            m = re.match(r'^\+\+\+ (.*?)\t', line)
+            if m:
+                source = m.group(1)
+                sys.stdout.write("cp " + source + " " + dest + "\n");
+
+if __name__ == "__main__":
+    main()
diff --git a/tests/update-test-read-dwarf-output.py b/tests/update-test-read-dwarf-output.py
deleted file mode 100644 (file)
index 871f3ef..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/python
-
-# This program generates the copy commands you should use to update
-# the reference data for test <build-dir>/tests/runtestreaddwarf,
-# which source code is test-read-dwarf.cc.  It takes in argument the
-# diff result emitted by <build-dir>/tests/runtestreaddwarf, and emits
-# on standard output a series of 'cp <src> <dest>' commands to execute
-# to update reference data of the test.
-
-import fileinput
-import re
-import sys
-import getopt
-
-
-def display_usage():
-    sys.stderr.write("usage: prog-name [options] <file-name|-->\n");
-    sys.stderr.write(" options:\n");
-    sys.stderr.write("  -h  display this help\n");
-    sys.stderr.write(" argument:\n");
-    sys.stderr.write("  <file-name>  the file to read from\n");
-    sys.stderr.write("  if no argument, then reads from stdin\n");
-
-    sys.exit(2)
-
-def main():
-    input_file = None
-
-    try:
-        opts, args = getopt.getopt(sys.argv[1:], "hi", ["help"])
-    except getopt.GetoptError as err:
-        print str(err)
-        display_usage()
-
-    for opt, arg in opts:
-        if opt in ("-h", "--help"):
-            display_usage()
-        else:
-            # unknown option.
-            display_usage()
-
-    if input_file == None and len(args) and args[0] != None:
-        input_file = open(args[0], 'r')
-    elif input_file == None:
-        input_file = sys.stdin
-
-    if input_file != None:
-        process(input_file)
-    else:
-        display_usage()
-
-
-def process(input_file):
-    source = ""
-    dest = ""
-    for line in input_file:
-        m = re.match(r'^--- (.*?)\t', line)
-        if m:
-            dest = m.group(1)
-        else:
-            m = re.match(r'^\+\+\+ (.*?)\t', line)
-            if m:
-                source = m.group(1)
-                sys.stdout.write("cp " + source + " " + dest + "\n");
-
-if __name__ == "__main__":
-    main()