[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 05/50] qapi: add tests for invalid 'if'
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v3 05/50] qapi: add tests for invalid 'if' |
Date: |
Mon, 11 Sep 2017 13:05:38 +0200 |
Signed-off-by: Marc-André Lureau <address@hidden>
---
tests/Makefile.include | 3 +++
tests/qapi-schema/bad-if-empty-list.err | 1 +
tests/qapi-schema/bad-if-empty-list.exit | 1 +
tests/qapi-schema/bad-if-empty-list.json | 3 +++
tests/qapi-schema/bad-if-empty-list.out | 0
tests/qapi-schema/bad-if-empty.err | 1 +
tests/qapi-schema/bad-if-empty.exit | 1 +
tests/qapi-schema/bad-if-empty.json | 3 +++
tests/qapi-schema/bad-if-empty.out | 0
tests/qapi-schema/bad-if.err | 1 +
tests/qapi-schema/bad-if.exit | 1 +
tests/qapi-schema/bad-if.json | 3 +++
tests/qapi-schema/bad-if.out | 0
13 files changed, 18 insertions(+)
create mode 100644 tests/qapi-schema/bad-if-empty-list.err
create mode 100644 tests/qapi-schema/bad-if-empty-list.exit
create mode 100644 tests/qapi-schema/bad-if-empty-list.json
create mode 100644 tests/qapi-schema/bad-if-empty-list.out
create mode 100644 tests/qapi-schema/bad-if-empty.err
create mode 100644 tests/qapi-schema/bad-if-empty.exit
create mode 100644 tests/qapi-schema/bad-if-empty.json
create mode 100644 tests/qapi-schema/bad-if-empty.out
create mode 100644 tests/qapi-schema/bad-if.err
create mode 100644 tests/qapi-schema/bad-if.exit
create mode 100644 tests/qapi-schema/bad-if.json
create mode 100644 tests/qapi-schema/bad-if.out
diff --git a/tests/Makefile.include b/tests/Makefile.include
index fae5715e9c..8dac7c9083 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -402,6 +402,9 @@ qapi-schema += args-unknown.json
qapi-schema += bad-base.json
qapi-schema += bad-data.json
qapi-schema += bad-ident.json
+qapi-schema += bad-if.json
+qapi-schema += bad-if-empty.json
+qapi-schema += bad-if-empty-list.json
qapi-schema += bad-type-bool.json
qapi-schema += bad-type-dict.json
qapi-schema += bad-type-int.json
diff --git a/tests/qapi-schema/bad-if-empty-list.err
b/tests/qapi-schema/bad-if-empty-list.err
new file mode 100644
index 0000000000..75fe6497bc
--- /dev/null
+++ b/tests/qapi-schema/bad-if-empty-list.err
@@ -0,0 +1 @@
+tests/qapi-schema/bad-if-empty-list.json:2: 'if' condition [] is useless
diff --git a/tests/qapi-schema/bad-if-empty-list.exit
b/tests/qapi-schema/bad-if-empty-list.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/bad-if-empty-list.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/bad-if-empty-list.json
b/tests/qapi-schema/bad-if-empty-list.json
new file mode 100644
index 0000000000..94f2eb8670
--- /dev/null
+++ b/tests/qapi-schema/bad-if-empty-list.json
@@ -0,0 +1,3 @@
+# check empty 'if' list
+{ 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
+ 'if': [] }
diff --git a/tests/qapi-schema/bad-if-empty-list.out
b/tests/qapi-schema/bad-if-empty-list.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/bad-if-empty.err
b/tests/qapi-schema/bad-if-empty.err
new file mode 100644
index 0000000000..358bdc3e51
--- /dev/null
+++ b/tests/qapi-schema/bad-if-empty.err
@@ -0,0 +1 @@
+tests/qapi-schema/bad-if-empty.json:2: 'if' condition '' makes no sense
diff --git a/tests/qapi-schema/bad-if-empty.exit
b/tests/qapi-schema/bad-if-empty.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/bad-if-empty.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/bad-if-empty.json
b/tests/qapi-schema/bad-if-empty.json
new file mode 100644
index 0000000000..fe1dd4eca6
--- /dev/null
+++ b/tests/qapi-schema/bad-if-empty.json
@@ -0,0 +1,3 @@
+# check empty 'if'
+{ 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
+ 'if': '' }
diff --git a/tests/qapi-schema/bad-if-empty.out
b/tests/qapi-schema/bad-if-empty.out
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qapi-schema/bad-if.err b/tests/qapi-schema/bad-if.err
new file mode 100644
index 0000000000..c2e3f5f44c
--- /dev/null
+++ b/tests/qapi-schema/bad-if.err
@@ -0,0 +1 @@
+tests/qapi-schema/bad-if.json:2: 'if' condition must be a string or a list of
strings
diff --git a/tests/qapi-schema/bad-if.exit b/tests/qapi-schema/bad-if.exit
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/qapi-schema/bad-if.exit
@@ -0,0 +1 @@
+1
diff --git a/tests/qapi-schema/bad-if.json b/tests/qapi-schema/bad-if.json
new file mode 100644
index 0000000000..3edd1a0bf2
--- /dev/null
+++ b/tests/qapi-schema/bad-if.json
@@ -0,0 +1,3 @@
+# check invalid 'if' type
+{ 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
+ 'if': { 'value': 'defined(TEST_IF_STRUCT)' } }
diff --git a/tests/qapi-schema/bad-if.out b/tests/qapi-schema/bad-if.out
new file mode 100644
index 0000000000..e69de29bb2
--
2.14.1.146.gd35faa819
- [Qemu-devel] [PATCH v3 00/50] Hi,, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 03/50] qapi2texi: minor python code simplification, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 02/50] qapi: generate a literal qobject for introspection, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit(), Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 04/50] qapi: add 'if' to top-level expressions, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 05/50] qapi: add tests for invalid 'if',
Marc-André Lureau <=
- [Qemu-devel] [PATCH v3 07/50] qapi: add 'ifcond' to visitor methods, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 06/50] qapi: pass 'if' condition into QAPISchemaEntity objects, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 08/50] qapi: mcgen() shouldn't indent # lines, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 10/50] qapi-introspect: modify to_qlit() to append ', ' on level > 0, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 11/50] qapi-introspect: modify to_qlit() to generate #if code, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 09/50] qapi: add #if/#endif helpers, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 12/50] qapi-introspect: add preprocessor conditions to generated QLit, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 13/50] qapi-commands: add #if conditions to commands, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 14/50] qapi-event: add #if conditions to events, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 17/50] qapi: do not define enumeration value explicitely, Marc-André Lureau, 2017/09/11