qemu-e2k/tests
Markus Armbruster c7a3f25200 qapi.py: Restructure lexer and parser
The parser has a rather unorthodox structure:

    Until EOF:

        Read a section:

            Generator function get_expr() yields one section after the
            other, as a string.  An unindented, non-empty line that
            isn't a comment starts a new section.

        Lexing:

            Split section into a list of tokens (strings), with help
            of generator function tokenize().

        Parsing:

            Parse the first expression from the list of tokens, with
            parse(), throw away any remaining tokens.

            In parse_schema(): record value of an enum, union or
            struct key (if any) in the appropriate global table,
            append expression to the list of expressions.

    Return list of expressions.

Known issues:

(1) Indentation is significant, unlike in real JSON.

(2) Neither lexer nor parser have any idea of source positions.  Error
    reporting is hard, let's go shopping.

(3) The one error we bother to detect, we "report" via raise.

(4) The lexer silently ignores invalid characters.

(5) If everything in a section gets ignored, the parser crashes.

(6) The lexer treats a string containing a structural character exactly
    like the structural character.

(7) Tokens trailing the first expression in a section are silently
    ignored.

(8) The parser accepts any token in place of a colon.

(9) The parser treats comma as optional.

(10) parse() crashes on unexpected EOF.

(11) parse_schema() crashes when a section's expression isn't a JSON
    object.

Replace this piece of original art by a thoroughly unoriginal design.
Takes care of (1), (2), (5), (6) and (7), and lays the groundwork for
addressing the others.  Generated source files remain unchanged.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1374939721-7876-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-07-29 10:37:10 -05:00
..
libqos libqos: Generalize I/O-mapped fw_cfg 2013-07-18 13:27:47 -05:00
qapi-schema qapi.py: Restructure lexer and parser 2013-07-29 10:37:10 -05:00
qemu-iotests Add tests for sync modes 'TOP' and 'NONE' 2013-07-26 22:01:31 +02:00
tcg target-mips: fix mipsdsp_mul_q31_q31 2013-07-29 07:48:17 +02:00
.gitignore Add some missing qtest binaries to .gitignore 2013-02-21 10:33:54 +01:00
Makefile tests: Use qapi-schema-test.json as schema parser test 2013-07-29 10:37:10 -05:00
boot-order-test.c boot-order-test: Add tests for Sun4u 2013-07-18 13:27:47 -05:00
check-block.sh Add 'make check-block' 2012-03-12 15:14:07 +01:00
check-qdict.c qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
check-qfloat.c qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
check-qint.c qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
check-qjson.c qjson: to_json() case QTYPE_QSTRING is buggy, rewrite 2013-04-13 19:40:25 +00:00
check-qlist.c qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
check-qstring.c qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
endianness-test.c pc-testdev: add I/O port to test memory.c auto split/combine 2013-07-25 08:12:28 -05:00
fdc-test.c libqtest: New qtest_end() to go with qtest_start() 2013-07-18 11:32:55 -05:00
fw_cfg-test.c libqos: Generalize I/O-mapped fw_cfg 2013-07-18 13:27:47 -05:00
hd-geo-test.c libqtest: New qtest_end() to go with qtest_start() 2013-07-18 11:32:55 -05:00
i440fx-test.c i440fx-test: add test for PAM functionality 2013-04-17 10:27:47 -05:00
ide-test.c libqtest: New qtest_end() to go with qtest_start() 2013-07-18 11:32:55 -05:00
libqtest.c libqtest: Plug fd and memory leaks in qtest_quit() 2013-07-18 11:32:54 -05:00
libqtest.h libqtest: New qtest_end() to go with qtest_start() 2013-07-18 11:32:55 -05:00
m48t59-test.c qtest: Add MMIO support 2013-02-18 08:39:10 -06:00
qemu-iotests-quick.sh make check: Add qemu-iotests subset 2012-03-12 15:14:07 +01:00
rtc-test.c hw: move headers to include/ 2013-04-08 18:13:10 +02:00
test-aio.c aio: Fix return value of aio_poll() 2013-01-17 10:51:42 +01:00
test-bitops.c tests: Add test-bitops.c with some sextract tests 2013-07-22 15:41:49 -05:00
test-coroutine.c coroutine: trim down nesting level in perf_nesting test 2013-02-22 21:21:10 +01:00
test-cutils.c cutils: unsigned int parsing functions 2013-02-04 14:38:33 -06:00
test-hbitmap.c hbitmap: add assertion on hbitmap_iter_init 2013-01-25 18:18:35 +01:00
test-int128.c int128: optimize and add test cases 2013-07-02 08:17:01 +02:00
test-iov.c test-iov: add iov_discard_front/back() testcases 2013-01-02 15:58:09 +01:00
test-mul64.c tests: Add unit tests for mulu64 and muls64 2013-02-17 14:28:58 +00:00
test-qmp-commands.c misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
test-qmp-input-strict.c qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
test-qmp-input-visitor.c misc: Use g_assert_not_reached for code which is expected to be unreachable 2013-07-27 11:22:54 +04:00
test-qmp-output-visitor.c misc: Use g_assert_not_reached for code which is expected to be unreachable 2013-07-27 11:22:54 +04:00
test-string-input-visitor.c tests/test-string-input-visitor: Handle errors provoked by fuzz test 2013-02-07 13:22:50 -02:00
test-string-output-visitor.c qapi: move include files to include/qobject/ 2012-12-19 08:31:31 +01:00
test-thread-pool.c add a header file for atomic operations 2013-07-04 17:42:49 +02:00
test-visitor-serialization.c misc: Use g_assert_not_reached for code which is expected to be unreachable 2013-07-27 11:22:54 +04:00
test-x86-cpuid.c target-i386: Topology & APIC ID utility functions 2013-01-27 14:34:27 +01:00
test-xbzrle.c Add XBZRLE testing 2013-02-01 08:32:20 +01:00
tmp105-test.c libqos: Relocate I2C files 2013-05-03 12:03:14 -05:00