aboutsummaryrefslogtreecommitdiff
path: root/tests/qapi-schema
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-15 13:56:51 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-16 07:13:01 +0100
commitbc52d03ff589a033843b4603cfdfd1518867c626 (patch)
tree8196974ce1a4777947853ad331a97e5834bb19fc /tests/qapi-schema
parente04dea88727c2ac97091333ac8be6af5952634a7 (diff)
downloadqemu-bc52d03ff589a033843b4603cfdfd1518867c626.zip
qemu-bc52d03ff589a033843b4603cfdfd1518867c626.tar.gz
qemu-bc52d03ff589a033843b4603cfdfd1518867c626.tar.bz2
qapi: Make doc comments optional where we don't need them
Since we added the documentation generator in commit 3313b61, doc comments are mandatory. That's a very good idea for a schema that needs to be documented, but has proven to be annoying for testing. Make doc comments optional again, but add a new directive { 'pragma': { 'doc-required': true } } to let a QAPI schema require them. Add test cases for the new pragma directive. While there, plug a minor hole in includ directive test coverage. Require documentation in the schemas we actually want documented: qapi-schema.json and qga/qapi-schema.json. We could probably make qapi2texi.py cope with incomplete documentation, but for now, simply make it refuse to run unless the schema has 'doc-required': true. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1489582656-31133-3-git-send-email-armbru@redhat.com> [qapi-code-gen.txt wording tweaked] Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/qapi-schema')
-rw-r--r--tests/qapi-schema/doc-missing.err1
-rw-r--r--tests/qapi-schema/doc-missing.exit1
-rw-r--r--tests/qapi-schema/doc-missing.json5
-rw-r--r--tests/qapi-schema/doc-missing.out0
-rw-r--r--tests/qapi-schema/include-extra-junk.err1
-rw-r--r--tests/qapi-schema/include-extra-junk.exit1
-rw-r--r--tests/qapi-schema/include-extra-junk.json3
-rw-r--r--tests/qapi-schema/include-extra-junk.out0
-rw-r--r--tests/qapi-schema/pragma-doc-required-crap.err1
-rw-r--r--tests/qapi-schema/pragma-doc-required-crap.exit1
-rw-r--r--tests/qapi-schema/pragma-doc-required-crap.json3
-rw-r--r--tests/qapi-schema/pragma-doc-required-crap.out0
-rw-r--r--tests/qapi-schema/pragma-extra-junk.err1
-rw-r--r--tests/qapi-schema/pragma-extra-junk.exit1
-rw-r--r--tests/qapi-schema/pragma-extra-junk.json3
-rw-r--r--tests/qapi-schema/pragma-extra-junk.out0
-rw-r--r--tests/qapi-schema/pragma-non-dict.err1
-rw-r--r--tests/qapi-schema/pragma-non-dict.exit1
-rw-r--r--tests/qapi-schema/pragma-non-dict.json3
-rw-r--r--tests/qapi-schema/pragma-non-dict.out0
20 files changed, 27 insertions, 0 deletions
diff --git a/tests/qapi-schema/doc-missing.err b/tests/qapi-schema/doc-missing.err
new file mode 100644
index 0000000..7f2f326
--- /dev/null
+++ b/tests/qapi-schema/doc-missing.err
@@ -0,0 +1 @@
+tests/qapi-schema/doc-missing.json:5: Expression missing documentation comment
diff --git a/tests/qapi-schema/doc-missing.exit b/tests/qapi-schema/doc-missing.exit
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/qapi-schema/doc-missing.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/doc-missing.json b/tests/qapi-schema/doc-missing.json
new file mode 100644
index 0000000..5956709
--- /dev/null
+++ b/tests/qapi-schema/doc-missing.json
@@ -0,0 +1,5 @@
+# Expression documentation required
+
+{ 'pragma': { 'doc-required': true } }
+
+{ 'command': 'undocumented' }
diff --git a/tests/qapi-schema/doc-missing.out b/tests/qapi-schema/doc-missing.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/qapi-schema/doc-missing.out
diff --git a/tests/qapi-schema/include-extra-junk.err b/tests/qapi-schema/include-extra-junk.err
new file mode 100644
index 0000000..e6ef2a3
--- /dev/null
+++ b/tests/qapi-schema/include-extra-junk.err
@@ -0,0 +1 @@
+tests/qapi-schema/include-extra-junk.json:3: Invalid 'include' directive
diff --git a/tests/qapi-schema/include-extra-junk.exit b/tests/qapi-schema/include-extra-junk.exit
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/qapi-schema/include-extra-junk.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/include-extra-junk.json b/tests/qapi-schema/include-extra-junk.json
new file mode 100644
index 0000000..25fe850
--- /dev/null
+++ b/tests/qapi-schema/include-extra-junk.json
@@ -0,0 +1,3 @@
+# 'include' must be the sole member
+
+{ 'include': 'comments.json', 'junk': true }
diff --git a/tests/qapi-schema/include-extra-junk.out b/tests/qapi-schema/include-extra-junk.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/qapi-schema/include-extra-junk.out
diff --git a/tests/qapi-schema/pragma-doc-required-crap.err b/tests/qapi-schema/pragma-doc-required-crap.err
new file mode 100644
index 0000000..39cd56c
--- /dev/null
+++ b/tests/qapi-schema/pragma-doc-required-crap.err
@@ -0,0 +1 @@
+tests/qapi-schema/pragma-doc-required-crap.json:3: Pragma 'doc-required' must be boolean
diff --git a/tests/qapi-schema/pragma-doc-required-crap.exit b/tests/qapi-schema/pragma-doc-required-crap.exit
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/qapi-schema/pragma-doc-required-crap.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/pragma-doc-required-crap.json b/tests/qapi-schema/pragma-doc-required-crap.json
new file mode 100644
index 0000000..ed763c5
--- /dev/null
+++ b/tests/qapi-schema/pragma-doc-required-crap.json
@@ -0,0 +1,3 @@
+# 'doc-required' must be bool
+
+{ 'pragma': { 'doc-required': {} } }
diff --git a/tests/qapi-schema/pragma-doc-required-crap.out b/tests/qapi-schema/pragma-doc-required-crap.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/qapi-schema/pragma-doc-required-crap.out
diff --git a/tests/qapi-schema/pragma-extra-junk.err b/tests/qapi-schema/pragma-extra-junk.err
new file mode 100644
index 0000000..4481688
--- /dev/null
+++ b/tests/qapi-schema/pragma-extra-junk.err
@@ -0,0 +1 @@
+tests/qapi-schema/pragma-extra-junk.json:3: Invalid 'pragma' directive
diff --git a/tests/qapi-schema/pragma-extra-junk.exit b/tests/qapi-schema/pragma-extra-junk.exit
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/qapi-schema/pragma-extra-junk.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/pragma-extra-junk.json b/tests/qapi-schema/pragma-extra-junk.json
new file mode 100644
index 0000000..ba38ef2
--- /dev/null
+++ b/tests/qapi-schema/pragma-extra-junk.json
@@ -0,0 +1,3 @@
+# 'pragma' must be the sole member
+
+{ 'pragma': { 'doc-required': true }, 'junk': true }
diff --git a/tests/qapi-schema/pragma-extra-junk.out b/tests/qapi-schema/pragma-extra-junk.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/qapi-schema/pragma-extra-junk.out
diff --git a/tests/qapi-schema/pragma-non-dict.err b/tests/qapi-schema/pragma-non-dict.err
new file mode 100644
index 0000000..75bc335
--- /dev/null
+++ b/tests/qapi-schema/pragma-non-dict.err
@@ -0,0 +1 @@
+tests/qapi-schema/pragma-non-dict.json:3: Value of 'pragma' must be a dictionary
diff --git a/tests/qapi-schema/pragma-non-dict.exit b/tests/qapi-schema/pragma-non-dict.exit
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/qapi-schema/pragma-non-dict.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/pragma-non-dict.json b/tests/qapi-schema/pragma-non-dict.json
new file mode 100644
index 0000000..60fcc79
--- /dev/null
+++ b/tests/qapi-schema/pragma-non-dict.json
@@ -0,0 +1,3 @@
+# Value of 'pragma' must be a dictionary
+
+{ 'pragma': [] }
diff --git a/tests/qapi-schema/pragma-non-dict.out b/tests/qapi-schema/pragma-non-dict.out
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/qapi-schema/pragma-non-dict.out