qemu-e2k/tests
Daniel P. Berrange 603476c25c qdict: implement a qdict_crumple method for un-flattening a dict
The qdict_flatten() method will take a dict whose elements are
further nested dicts/lists and flatten them by concatenating
keys.

The qdict_crumple() method aims to do the reverse, taking a flat
qdict, and turning it into a set of nested dicts/lists. It will
apply nesting based on the key name, with a '.' indicating a
new level in the hierarchy. If the keys in the nested structure
are all numeric, it will create a list, otherwise it will create
a dict.

If the keys are a mixture of numeric and non-numeric, or the
numeric keys are not in strictly ascending order, an error will
be reported.

As an example, a flat dict containing

 {
   'foo.0.bar': 'one',
   'foo.0.wizz': '1',
   'foo.1.bar': 'two',
   'foo.1.wizz': '2'
 }

will get turned into a dict with one element 'foo' whose
value is a list. The list elements will each in turn be
dicts.

 {
   'foo': [
     { 'bar': 'one', 'wizz': '1' },
     { 'bar': 'two', 'wizz': '2' }
   ],
 }

If the key is intended to contain a literal '.', then it must
be escaped as '..'. ie a flat dict

  {
     'foo..bar': 'wizz',
     'bar.foo..bar': 'eek',
     'bar.hello': 'world'
  }

Will end up as

  {
     'foo.bar': 'wizz',
     'bar': {
        'foo.bar': 'eek',
        'hello': 'world'
     }
  }

The intent of this function is that it allows a set of QemuOpts
to be turned into a nested data structure that mirrors the nesting
used when the same object is defined over QMP.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1475246744-29302-3-git-send-email-berrange@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Parameter recursive dropped along with its tests; whitespace style
touched up]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-10-25 17:56:14 +02:00
..
acpi-test-data tests: acpi tables expected blobs update 2016-10-10 01:16:58 +03:00
data tests: use static qga config file 2016-07-25 13:23:18 -05:00
docker tests/docker/Makefile.include: add a generic docker-run target 2016-10-17 10:05:48 +08:00
guest-debug
image-fuzzer
libqos spapr: Improved placement of PCI host bridges in guest memory map 2016-10-16 12:04:15 +11:00
migration tests: introduce a framework for testing migration performance 2016-07-22 13:23:39 +05:30
multiboot
qapi-schema
qemu-iotests iotests: Do not rely on unavailable domains in 162 2016-10-24 17:54:03 +02:00
rocker
tcg test-i386: fix bitrot for 64-bit 2016-10-24 15:27:19 +02:00
vmstate-static-checker-data
.gitignore qapi: rename *qmp-*-visitor* to *qobject-*-visitor* 2016-10-25 16:25:48 +02:00
ac97-test.c
ahci-test.c
bios-tables-test.c tests/boot-sector: Use mkstemp() to create a unique file name 2016-10-14 10:06:47 +11:00
boot-order-test.c
boot-sector.c tests/boot-sector: Increase time-out to 90 seconds 2016-10-14 10:06:47 +11:00
boot-sector.h tests/boot-sector: Use mkstemp() to create a unique file name 2016-10-14 10:06:47 +11:00
boot-serial-test.c tests: Check serial output of firmware boot of some machines 2016-09-07 12:40:13 +10:00
check-block.sh tests: allow to specify list of formats to test for check-block.sh 2016-09-23 13:36:09 +02:00
check-qdict.c qdict: implement a qdict_crumple method for un-flattening a dict 2016-10-25 17:56:14 +02:00
check-qfloat.c
check-qint.c
check-qjson.c
check-qlist.c
check-qnull.c qapi: rename QmpOutputVisitor to QObjectOutputVisitor 2016-10-25 16:25:54 +02:00
check-qom-interface.c tests: fix check-qom-interface leaks 2016-09-08 17:57:32 +04:00
check-qom-proplist.c tests: fix check-qom-proplist leaks 2016-09-08 17:57:32 +04:00
check-qstring.c
crypto-tls-x509-helpers.c
crypto-tls-x509-helpers.h crypto: fix building complaint 2016-09-12 12:00:52 +01:00
device-introspect-test.c
display-vga-test.c
drive_del-test.c tests: add drive_del-test to ppc/ppc64 2016-07-29 14:14:15 +10:00
ds1338-test.c
e1000-test.c
e1000e-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
eepro100-test.c
endianness-test.c spapr: Improved placement of PCI host bridges in guest memory map 2016-10-16 12:04:15 +11:00
es1370-test.c
fdc-test.c
fw_cfg-test.c
hd-geo-test.c tests/hd-geo-test: Don't pass NULL to unlink() 2016-09-08 10:43:58 +01:00
i440fx-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
i82801b11-test.c
ide-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
intel-hda-test.c
io-channel-helpers.c
io-channel-helpers.h
ioh3420-test.c
ipmi-bt-test.c
ipmi-kcs-test.c
ipoctal232-test.c
ivshmem-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
libqtest.c qtest: ask endianness of the target in qtest_init() 2016-10-14 10:06:47 +11:00
libqtest.h qtest: ask endianness of the target in qtest_init() 2016-10-14 10:06:47 +11:00
m25p80-test.c tests: add a m25p80 test 2016-10-17 19:22:17 +01:00
m48t59-test.c
Makefile.include qapi: rename *qmp-*-visitor* to *qobject-*-visitor* 2016-10-25 16:25:48 +02:00
ne2000-test.c
nvme-test.c
pc-cpu-test.c tests: pc-cpu-test leaks fixes 2016-09-08 18:05:22 +04:00
pcnet-test.c
pkix_asn1_tab.c qtest: fix make check complaint in crypto module 2016-10-19 10:09:24 +01:00
postcopy-test.c tests: fix postcopy-test leaks 2016-09-08 18:05:22 +04:00
prom-env-test.c
ptimer-test-stubs.c tests: ptimer: Change the copyright comment 2016-10-24 16:26:53 +01:00
ptimer-test.c tests: ptimer: Replace 10000 with 1 2016-10-24 16:26:53 +01:00
ptimer-test.h tests: ptimer: Change the copyright comment 2016-10-24 16:26:53 +01:00
pvpanic-test.c
pxe-test.c tests/boot-sector: Use mkstemp() to create a unique file name 2016-10-14 10:06:47 +11:00
q35-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
qemu-iotests-quick.sh
qht-bench.c qht-bench: relax test_start/stop atomic accesses 2016-10-24 15:27:19 +02:00
qom-test.c tests: fix qom-test leaks 2016-09-08 18:05:21 +04:00
rcutorture.c
rtas-test.c libqos: use generic qtest_shutdown() 2016-10-06 16:15:53 +11:00
rtc-test.c
rtl8139-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
spapr-phb-test.c spapr: Improved placement of PCI host bridges in guest memory map 2016-10-16 12:04:15 +11:00
tco-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
test-aio.c timer: set vm_clock disabled default 2016-08-09 22:57:36 +02:00
test-arm-mptimer.c tests: Add tests for the ARM MPTimer 2016-10-24 16:26:54 +01:00
test-base64.c
test-bitops.c
test-blockjob-txn.c
test-blockjob.c tests: Test blockjob IDs 2016-08-08 13:05:43 +02:00
test-bufferiszero.c cutils: Add test for buffer_is_zero 2016-09-13 19:13:32 +02:00
test-char.c char: remove explicit_fe_open, use a set_handlers argument 2016-10-24 15:46:10 +02:00
test-clone-visitor.c
test-coroutine.c test-coroutine: test qemu_coroutine_entered() 2016-09-28 17:11:23 +01:00
test-crypto-afsplit.c
test-crypto-block.c tests: No longer dependent on CONFIG_UUID 2016-09-23 11:42:52 +08:00
test-crypto-cipher.c crypto: add CTR mode support 2016-10-19 10:09:24 +01:00
test-crypto-hash.c crypto: fix initialization of crypto in tests 2016-10-19 10:23:55 +01:00
test-crypto-ivgen.c
test-crypto-pbkdf.c crypto: support more hash algorithms for pbkdf 2016-09-19 16:30:45 +01:00
test-crypto-secret.c
test-crypto-tlscredsx509.c
test-crypto-tlssession.c
test-crypto-xts.c
test-cutils.c tests: fix test-cutils leaks 2016-09-08 17:57:32 +04:00
test-filter-mirror.c
test-filter-redirector.c
test-hbitmap.c tests: Add test code for hbitmap serialization 2016-10-24 17:56:07 +02:00
test-int128.c
test-io-channel-buffer.c
test-io-channel-command.c
test-io-channel-file.c
test-io-channel-socket.c
test-io-channel-tls.c crypto: fix initialization of crypto in tests 2016-10-19 10:23:55 +01:00
test-io-task.c tests: Rename qtests which have names ending "error" 2016-08-05 15:27:15 +01:00
test-iov.c tests: fix test-iov leaks 2016-09-08 17:57:32 +04:00
test-logging.c test-logging: don't hard-code paths in /tmp 2016-08-19 12:44:11 +01:00
test-mul64.c
test-netfilter.c
test-opts-visitor.c
test-qdev-global-props.c
test-qdist.c qdist: return "(empty)" instead of NULL when printing an empty dist 2016-08-03 18:44:56 +02:00
test-qemu-opts.c
test-qga.c tests: add a test to check invalid args 2016-09-19 17:32:22 +02:00
test-qht-par.c
test-qht.c test-qht: perform lookups under rcu_read_lock 2016-10-06 18:04:13 +02:00
test-qmp-commands.c qapi: rename QmpInputVisitor to QObjectInputVisitor 2016-10-25 16:25:54 +02:00
test-qmp-event.c
test-qobject-input-strict.c qapi: rename QmpInputVisitor to QObjectInputVisitor 2016-10-25 16:25:54 +02:00
test-qobject-input-visitor.c qapi: don't pass two copies of TestInputVisitorData to tests 2016-10-25 16:25:54 +02:00
test-qobject-output-visitor.c qapi: rename QmpOutputVisitor to QObjectOutputVisitor 2016-10-25 16:25:54 +02:00
test-rcu-list.c
test-replication.c tests: add unit test case for replication 2016-09-13 11:00:56 +01:00
test-rfifolock.c
test-string-input-visitor.c qapi: rename *qmp-*-visitor* to *qobject-*-visitor* 2016-10-25 16:25:48 +02:00
test-string-output-visitor.c qapi: rename *qmp-*-visitor* to *qobject-*-visitor* 2016-10-25 16:25:48 +02:00
test-thread-pool.c
test-throttle.c throttle: Test burst limits lower than the normal limits 2016-08-05 09:59:06 +01:00
test-timed-average.c
test-uuid.c tests: Add uuid tests 2016-09-23 11:42:52 +08:00
test-visitor-serialization.c qapi: rename QmpOutputVisitor to QObjectOutputVisitor 2016-10-25 16:25:54 +02:00
test-vmstate.c tests: fix test-vmstate leaks 2016-09-08 17:57:32 +04:00
test-write-threshold.c
test-x86-cpuid-compat.c tests: Add test case for x86 feature parsing compatibility 2016-10-17 15:44:49 -02:00
test-x86-cpuid.c
test-xbzrle.c
tmp105-test.c
tpci200-test.c
usb-hcd-ehci-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
usb-hcd-ohci-test.c
usb-hcd-uhci-test.c tests: minor cleanups in usb-hcd-uhci-test 2016-10-14 10:06:47 +11:00
usb-hcd-xhci-test.c
vhost-user-bridge.c
vhost-user-test.c char: remove explicit_fe_open, use a set_handlers argument 2016-10-24 15:46:10 +02:00
virtio-9p-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
virtio-balloon-test.c
virtio-blk-test.c qtest: ask endianness of the target in qtest_init() 2016-10-14 10:06:47 +11:00
virtio-console-test.c
virtio-net-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
virtio-rng-test.c
virtio-scsi-test.c libqos: add PCI management in qtest_vboot()/qtest_shutdown() 2016-10-06 16:15:53 +11:00
virtio-serial-test.c
vmxnet3-test.c
wdt_ib700-test.c