From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fb2ri-0007Ri-JD for qemu-devel@nongnu.org; Thu, 05 Jul 2018 07:56:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fb2re-00071S-M4 for qemu-devel@nongnu.org; Thu, 05 Jul 2018 07:56:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33016 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fb2re-0006zO-GG for qemu-devel@nongnu.org; Thu, 05 Jul 2018 07:55:58 -0400 From: Markus Armbruster References: <20180326150916.9602-1-marcandre.lureau@redhat.com> <20180326150916.9602-11-marcandre.lureau@redhat.com> Date: Thu, 05 Jul 2018 13:55:51 +0200 In-Reply-To: <20180326150916.9602-11-marcandre.lureau@redhat.com> (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Mon, 26 Mar 2018 17:08:48 +0200") Message-ID: <87bmbl99rs.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 10/38] tests: add a few qemu-qmp tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: qemu-devel@nongnu.org, Eduardo Habkost , Juan Quintela , "Dr. David Alan Gilbert" , Gerd Hoffmann , Cleber Rosa , Michael Roth Marc-Andr=C3=A9 Lureau writes: > These 2 tests exhibited two qmp bugs that were fixed in 2.7 > (series from commit e64c75a9752c5d0fd64eb2e684c656a5ea7d03c6 to > commit 1382d4abdf9619985e4078e37e49e487cea9935e) > > Signed-off-by: Marc-Andr=C3=A9 Lureau Thanks for holding on to the test cases :) Needs a rebase. > --- > tests/qmp-test.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > > diff --git a/tests/qmp-test.c b/tests/qmp-test.c > index 07c0b87e27..642f46a332 100644 > --- a/tests/qmp-test.c > +++ b/tests/qmp-test.c > @@ -224,7 +224,50 @@ static void test_qmp_oob(void) > } > QDECREF(resp); > } > + qtest_end(); > +} > + > +static void test_object_add_without_props(void) > +{ > + QDict *ret, *error; > + const gchar *klass, *desc; > + > + qtest_start("-machine none"); >=20=20 > + ret =3D qmp("{'execute': 'object-add'," > + " 'arguments': { 'qom-type': 'memory-backend-ram', 'id': '= ram1' } }"); > + g_assert_nonnull(ret); > + > + error =3D qdict_get_qdict(ret, "error"); > + klass =3D qdict_get_try_str(error, "class"); > + desc =3D qdict_get_try_str(error, "desc"); > + > + g_assert_cmpstr(klass, =3D=3D, "GenericError"); > + g_assert_cmpstr(desc, =3D=3D, "can't create backend with size 0"); Sure checking "desc" is worthwhile? We don't do that elsewhere in this test program, and only rarely in other test programs. > + > + QDECREF(ret); > + qtest_end(); > +} > + > +static void test_qom_set_without_value(void) > +{ > + QDict *ret, *error; > + const gchar *klass, *desc; > + > + qtest_start("-machine none"); > + > + ret =3D qmp("{'execute': 'qom-set'," > + " 'arguments': { 'path': '/machine', 'property': 'rtc-time= ' } }"); > + g_assert_nonnull(ret); > + > + error =3D qdict_get_qdict(ret, "error"); > + klass =3D qdict_get_try_str(error, "class"); > + desc =3D qdict_get_try_str(error, "desc"); > + > + g_assert_cmpstr(klass, =3D=3D, "GenericError"); > + g_assert_cmpstr(desc, =3D=3D, "Parameter 'value' is missing"); Likewise. > + > + QDECREF(ret); > qtest_end(); > } >=20=20 > @@ -411,13 +454,19 @@ int main(int argc, char *argv[]) >=20=20 > g_test_init(&argc, &argv, NULL); >=20=20 > + qtest_add_func("qmp/object-add-without-props", > + test_object_add_without_props); > + qtest_add_func("qmp/qom-set-without-value", > + test_qom_set_without_value); > qtest_add_func("qmp/protocol", test_qmp_protocol); > qtest_add_func("qmp/oob", test_qmp_oob); > + > qmp_schema_init(&schema); > add_query_tests(&schema); >=20=20 > ret =3D g_test_run(); >=20=20 > qmp_schema_cleanup(&schema); > + > return ret; > }