[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/56] qmp-test: Cover syntax and lexical errors
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 05/56] qmp-test: Cover syntax and lexical errors |
Date: |
Fri, 10 Aug 2018 15:52:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 08/08/2018 07:02 AM, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> tests/libqtest.c | 17 +++++++++++++++++
>> tests/libqtest.h | 11 +++++++++++
>> tests/qmp-test.c | 39 +++++++++++++++++++++++++++++++++++++++
>> 3 files changed, 67 insertions(+)
>>
>
>> + /* lexical error: impossible byte outside string */
>> + qtest_qmp_send_raw(qts, "{\xFF");
>
> \xff is an impossible byte inside a string as well; plus it has
> special meaning to at least QMP for commanding a parser reset. Is a
> better byte more appropriate (maybe \x7f), either in replacement to
> \xff or as an additional test?
\xFF is documented to have special meaning for QGA, but as far as the
code's concerned, it's a lexical error like any other. I'm fixing the
documentation in PATCH 56. Want me to move that patch to the front of
the series?
>> + resp = qtest_qmp_receive(qts);
>> + g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
>> + qobject_unref(resp);
>> + g_assert(recovered(qts));
>> +
>> + /* lexical error: impossible byte in string */
>> + qtest_qmp_send_raw(qts, "{'bad \xFF");
>
> Same question about \xff being special as the parser reset command, so
> should we test a different byte instead/as well?
>
>> + resp = qtest_qmp_receive(qts);
>> + g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
>> + qobject_unref(resp);
>> + g_assert(recovered(qts));
>> +
>> + /* lexical error: interpolation */
>> + qtest_qmp_send_raw(qts, "%%p\n");
>> + resp = qtest_qmp_receive(qts);
>> + g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
>> + qobject_unref(resp);
>> + g_assert(recovered(qts));
>> +
>> /* Not even a dictionary */
>> resp = qtest_qmp(qts, "null");
>> g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
>>
- Re: [Qemu-devel] [PATCH 01/56] check-qjson: Cover multiple JSON objects in same string, (continued)
[Qemu-devel] [PATCH 27/56] json: Reject invalid \uXXXX, fix \u0000, Markus Armbruster, 2018/08/08
[Qemu-devel] [PATCH 15/56] check-qjson: Cover interpolation more thoroughly, Markus Armbruster, 2018/08/08
[Qemu-devel] [PATCH 16/56] json: Fix lexer to include the bad character in JSON_ERROR token, Markus Armbruster, 2018/08/08
[Qemu-devel] [PATCH 03/56] check-qjson: Cover whitespace more thoroughly, Markus Armbruster, 2018/08/08