[hawkmoth] [PATCH 4/8] test: clean up parser options

  • From: Jani Nikula <jani@xxxxxxxxxx>
  • To: hawkmoth@xxxxxxxxxxxxx
  • Date: Thu, 13 Dec 2018 23:11:29 +0200

Rename .stdin to .options. Remove -- prefix from option lines.
---
 doc/update-examples                 | 6 ++++--
 test/compat-javadoc-basic.options   | 1 +
 test/compat-javadoc-basic.stdin     | 1 -
 test/compat-javadoc-liberal.options | 1 +
 test/compat-javadoc-liberal.stdin   | 1 -
 test/compat-kernel-doc.options      | 1 +
 test/compat-kernel-doc.stdin        | 1 -
 test/example-80-compat.options      | 1 +
 test/example-80-compat.stdin        | 1 -
 test/testenv.py                     | 9 ++-------
 10 files changed, 10 insertions(+), 13 deletions(-)
 create mode 100644 test/compat-javadoc-basic.options
 delete mode 100644 test/compat-javadoc-basic.stdin
 create mode 100644 test/compat-javadoc-liberal.options
 delete mode 100644 test/compat-javadoc-liberal.stdin
 create mode 100644 test/compat-kernel-doc.options
 delete mode 100644 test/compat-kernel-doc.stdin
 create mode 100644 test/example-80-compat.options
 delete mode 100644 test/example-80-compat.stdin

diff --git a/doc/update-examples b/doc/update-examples
index 9dee2a6fdaad..9f0c50dd4f94 100755
--- a/doc/update-examples
+++ b/doc/update-examples
@@ -1,4 +1,6 @@
 #!/bin/bash
+# Copyright (c) 2017-2018, Jani Nikula <jani@xxxxxxxxxx>
+# Licensed under the terms of BSD 2-Clause, see LICENSE for details.
 
 TESTDIR=test
 
@@ -29,12 +31,12 @@ EOF
 read_options()
 {
        if [ -e "$1" ]; then
-               sed -n "s/ 
/\n/g;s/--\(compat\|clang\)=\([a-zA-Z0-9_,-]\+\)/:\1: \2/gp" < $1
+               sed -n "s/ /\n/g;s/\(compat\|clang\)=\([a-zA-Z0-9_,-]\+\)/:\1: 
\2/gp" < $1
        fi
 }
 
 for f in $(find "$TESTDIR" -maxdepth 1 -name "example-*.c" | sort); do
-       options=$(read_options ${f/.c/.stdin})
+       options=$(read_options ${f/.c/.options})
        input=examples/$(basename $f)
        static_output=${input/.c/.stdout}
        title=$(basename $f .c)
diff --git a/test/compat-javadoc-basic.options 
b/test/compat-javadoc-basic.options
new file mode 100644
index 000000000000..cf3f7f8633c7
--- /dev/null
+++ b/test/compat-javadoc-basic.options
@@ -0,0 +1 @@
+compat=javadoc-basic
diff --git a/test/compat-javadoc-basic.stdin b/test/compat-javadoc-basic.stdin
deleted file mode 100644
index d3b9a5042bf4..000000000000
--- a/test/compat-javadoc-basic.stdin
+++ /dev/null
@@ -1 +0,0 @@
---compat=javadoc-basic
diff --git a/test/compat-javadoc-liberal.options 
b/test/compat-javadoc-liberal.options
new file mode 100644
index 000000000000..2c2e473e8afe
--- /dev/null
+++ b/test/compat-javadoc-liberal.options
@@ -0,0 +1 @@
+compat=javadoc-liberal
diff --git a/test/compat-javadoc-liberal.stdin 
b/test/compat-javadoc-liberal.stdin
deleted file mode 100644
index 578c5b83f8f7..000000000000
--- a/test/compat-javadoc-liberal.stdin
+++ /dev/null
@@ -1 +0,0 @@
---compat=javadoc-liberal
diff --git a/test/compat-kernel-doc.options b/test/compat-kernel-doc.options
new file mode 100644
index 000000000000..7ca6284152b6
--- /dev/null
+++ b/test/compat-kernel-doc.options
@@ -0,0 +1 @@
+compat=kernel-doc
diff --git a/test/compat-kernel-doc.stdin b/test/compat-kernel-doc.stdin
deleted file mode 100644
index 0bab7d4132b4..000000000000
--- a/test/compat-kernel-doc.stdin
+++ /dev/null
@@ -1 +0,0 @@
---compat=kernel-doc
diff --git a/test/example-80-compat.options b/test/example-80-compat.options
new file mode 100644
index 000000000000..2c2e473e8afe
--- /dev/null
+++ b/test/example-80-compat.options
@@ -0,0 +1 @@
+compat=javadoc-liberal
diff --git a/test/example-80-compat.stdin b/test/example-80-compat.stdin
deleted file mode 100644
index 578c5b83f8f7..000000000000
--- a/test/example-80-compat.stdin
+++ /dev/null
@@ -1 +0,0 @@
---compat=javadoc-liberal
diff --git a/test/testenv.py b/test/testenv.py
index 43998801a499..e6810e5d91bc 100644
--- a/test/testenv.py
+++ b/test/testenv.py
@@ -15,19 +15,14 @@ def get_testcases(path):
             if f.endswith(testext)]
 
 def get_testcase_options(testcase):
-    options_filename = modify_filename(testcase, ext='stdin')
+    options_filename = modify_filename(testcase, ext='options')
 
     # options are optional
     options = {}
     if os.path.isfile(options_filename):
         with open(options_filename, 'r') as file:
             for line in file.readlines():
-                line = line.strip()
-                # legacy
-                if line.startswith('--'):
-                    line = line[2:]
-
-                opt = line.split('=', 1)
+                opt = line.strip().split('=', 1)
                 options[opt[0]] = opt[1]
 
     return options
-- 
2.19.2


Other related posts:

  • » [hawkmoth] [PATCH 4/8] test: clean up parser options - Jani Nikula