diff mbox series

[for-2.13,v5,07/11] tests: add allowed-in-preconfig-test for qapi-schema

Message ID 1522919113-158775-8-git-send-email-imammedo@redhat.com
State New
Headers show
Series enable numa configuration before machine_init() from QMP | expand

Commit Message

Igor Mammedov April 5, 2018, 9:05 a.m. UTC
make sure the QAPISchema can parse allowed-in-preconfig correctly

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/Makefile.include                           | 1 +
 tests/qapi-schema/allowed-in-preconfig-test.err  | 1 +
 tests/qapi-schema/allowed-in-preconfig-test.exit | 1 +
 tests/qapi-schema/allowed-in-preconfig-test.json | 2 ++
 tests/qapi-schema/allowed-in-preconfig-test.out  | 0
 tests/qapi-schema/qapi-schema-test.json          | 3 +++
 tests/qapi-schema/qapi-schema-test.out           | 2 ++
 tests/test-qmp-cmds.c                            | 4 ++++
 8 files changed, 14 insertions(+)
 create mode 100644 tests/qapi-schema/allowed-in-preconfig-test.err
 create mode 100644 tests/qapi-schema/allowed-in-preconfig-test.exit
 create mode 100644 tests/qapi-schema/allowed-in-preconfig-test.json
 create mode 100644 tests/qapi-schema/allowed-in-preconfig-test.out
diff mbox series

Patch

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 3b9a5e3..4d2460d 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -524,6 +524,7 @@  qapi-schema += missing-type.json
 qapi-schema += nested-struct-data.json
 qapi-schema += non-objects.json
 qapi-schema += oob-test.json
+qapi-schema += allowed-in-preconfig-test.json
 qapi-schema += pragma-doc-required-crap.json
 qapi-schema += pragma-extra-junk.json
 qapi-schema += pragma-name-case-whitelist-crap.json
diff --git a/tests/qapi-schema/allowed-in-preconfig-test.err b/tests/qapi-schema/allowed-in-preconfig-test.err
new file mode 100644
index 0000000..2b0511b
--- /dev/null
+++ b/tests/qapi-schema/allowed-in-preconfig-test.err
@@ -0,0 +1 @@ 
+tests/qapi-schema/allowed-in-preconfig-test.json:2: 'allowed-in-preconfig' of command 'allowed-in-preconfig-test' should only use true value
diff --git a/tests/qapi-schema/allowed-in-preconfig-test.exit b/tests/qapi-schema/allowed-in-preconfig-test.exit
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/tests/qapi-schema/allowed-in-preconfig-test.exit
@@ -0,0 +1 @@ 
+1
diff --git a/tests/qapi-schema/allowed-in-preconfig-test.json b/tests/qapi-schema/allowed-in-preconfig-test.json
new file mode 100644
index 0000000..7e0e6cb
--- /dev/null
+++ b/tests/qapi-schema/allowed-in-preconfig-test.json
@@ -0,0 +1,2 @@ 
+# Check against allowed-in-preconfig illegal value
+{ 'command': 'allowed-in-preconfig-test', 'allowed-in-preconfig': 'some-string' }
diff --git a/tests/qapi-schema/allowed-in-preconfig-test.out b/tests/qapi-schema/allowed-in-preconfig-test.out
new file mode 100644
index 0000000..e69de29
diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json
index 06e30f4..608ca35 100644
--- a/tests/qapi-schema/qapi-schema-test.json
+++ b/tests/qapi-schema/qapi-schema-test.json
@@ -142,6 +142,9 @@ 
 # Smoke test on Out-Of-Band
 { 'command': 'an-oob-command', 'allow-oob': true }
 
+# test allowed-in-preconfig flag
+{ 'command': 'allowed-in-preconfig-test', 'allowed-in-preconfig': true }
+
 # For testing integer range flattening in opts-visitor. The following schema
 # corresponds to the option format:
 #
diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out
index 1f5038f..c955e2d 100644
--- a/tests/qapi-schema/qapi-schema-test.out
+++ b/tests/qapi-schema/qapi-schema-test.out
@@ -168,6 +168,8 @@  command boxed-union UserDefNativeListUnion -> None
    gen=True success_response=True boxed=True oob=False preconfig=False
 command an-oob-command None -> None
    gen=True success_response=True boxed=False oob=True preconfig=False
+command allowed-in-preconfig-test None -> None
+   gen=True success_response=True boxed=False oob=False preconfig=True
 object UserDefOptions
     member i64: intList optional=True
     member u64: uint64List optional=True
diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c
index db690cc..730476a 100644
--- a/tests/test-qmp-cmds.c
+++ b/tests/test-qmp-cmds.c
@@ -20,6 +20,10 @@  void qmp_an_oob_command(Error **errp)
 {
 }
 
+void qmp_allowed_in_preconfig_test(Error **errp)
+{
+}
+
 Empty2 *qmp_user_def_cmd0(Error **errp)
 {
     return g_new0(Empty2, 1);