2017-08-10 10:50:25 +02:00
|
|
|
|
|
|
|
.PHONY: check-help
|
|
|
|
check-help:
|
|
|
|
@echo "Regression testing targets:"
|
|
|
|
@echo
|
2018-11-09 16:07:10 +01:00
|
|
|
@echo " $(MAKE) check Run unit, qapi-schema, qtest and decodetree"
|
|
|
|
@echo
|
2017-11-21 10:55:10 +01:00
|
|
|
@echo " $(MAKE) check-qtest-TARGET Run qtest tests for given target"
|
|
|
|
@echo " $(MAKE) check-qtest Run qtest tests"
|
|
|
|
@echo " $(MAKE) check-unit Run qobject tests"
|
|
|
|
@echo " $(MAKE) check-speed Run qobject speed tests"
|
|
|
|
@echo " $(MAKE) check-qapi-schema Run QAPI schema tests"
|
|
|
|
@echo " $(MAKE) check-block Run block tests"
|
2018-04-06 23:08:36 +02:00
|
|
|
@echo " $(MAKE) check-tcg Run TCG tests"
|
2019-01-07 18:25:44 +01:00
|
|
|
@echo " $(MAKE) check-softfloat Run FPU emulation tests"
|
2018-10-18 17:31:33 +02:00
|
|
|
@echo " $(MAKE) check-acceptance Run all acceptance (functional) tests"
|
2018-11-09 16:07:10 +01:00
|
|
|
@echo
|
2017-11-21 10:55:10 +01:00
|
|
|
@echo " $(MAKE) check-report.html Generates an HTML test report"
|
2018-10-18 17:31:32 +02:00
|
|
|
@echo " $(MAKE) check-venv Creates a Python venv for tests"
|
2018-11-09 16:07:10 +01:00
|
|
|
@echo " $(MAKE) check-clean Clean the tests and related data"
|
2017-08-10 10:50:25 +02:00
|
|
|
@echo
|
|
|
|
@echo "Please note that HTML reports do not regenerate if the unit tests"
|
2018-11-09 16:07:10 +01:00
|
|
|
@echo "have not changed."
|
2017-08-10 10:50:25 +02:00
|
|
|
@echo
|
|
|
|
@echo "The variable SPEED can be set to control the gtester speed setting."
|
2017-11-21 10:55:10 +01:00
|
|
|
@echo "Default options are -k and (for $(MAKE) V=1) --verbose; they can be"
|
2017-08-10 10:50:25 +02:00
|
|
|
@echo "changed with variable GTESTER_OPTIONS."
|
|
|
|
|
|
|
|
ifneq ($(wildcard config-host.mak),)
|
2012-03-08 12:29:00 +01:00
|
|
|
export SRC_PATH
|
|
|
|
|
2018-02-26 20:48:58 +01:00
|
|
|
# TODO don't duplicate $(SRC_PATH)/Makefile's qapi-py here
|
|
|
|
qapi-py = $(SRC_PATH)/scripts/qapi/commands.py \
|
|
|
|
$(SRC_PATH)/scripts/qapi/events.py \
|
|
|
|
$(SRC_PATH)/scripts/qapi/introspect.py \
|
|
|
|
$(SRC_PATH)/scripts/qapi/types.py \
|
|
|
|
$(SRC_PATH)/scripts/qapi/visit.py \
|
|
|
|
$(SRC_PATH)/scripts/qapi/common.py \
|
|
|
|
$(SRC_PATH)/scripts/qapi/doc.py \
|
|
|
|
$(SRC_PATH)/scripts/qapi-gen.py
|
2015-09-02 12:35:52 +02:00
|
|
|
|
2014-01-23 17:22:59 +01:00
|
|
|
# Get the list of all supported sysemu targets
|
|
|
|
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
|
|
|
|
$(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
|
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-unit-y += tests/check-qdict$(EXESUF)
|
2018-09-26 14:23:09 +02:00
|
|
|
check-unit-y += tests/check-block-qdict$(EXESUF)
|
2016-10-25 11:09:25 +02:00
|
|
|
check-unit-y += tests/test-char$(EXESUF)
|
2017-06-07 18:35:58 +02:00
|
|
|
check-unit-y += tests/check-qnum$(EXESUF)
|
2012-03-28 15:42:01 +02:00
|
|
|
check-unit-y += tests/check-qstring$(EXESUF)
|
|
|
|
check-unit-y += tests/check-qlist$(EXESUF)
|
2016-04-28 23:45:21 +02:00
|
|
|
check-unit-y += tests/check-qnull$(EXESUF)
|
2017-11-14 19:01:28 +01:00
|
|
|
check-unit-y += tests/check-qobject$(EXESUF)
|
2012-03-28 15:42:01 +02:00
|
|
|
check-unit-y += tests/check-qjson$(EXESUF)
|
2017-08-25 12:59:09 +02:00
|
|
|
check-unit-y += tests/check-qlit$(EXESUF)
|
2016-09-30 16:45:27 +02:00
|
|
|
check-unit-y += tests/test-qobject-output-visitor$(EXESUF)
|
qapi: Add new clone visitor
We have a couple places in the code base that want to deep-clone
one QAPI object into another, and they were resorting to serializing
the struct out to QObject then reparsing it. A much more efficient
version can be done by adding a new clone visitor.
Since cloning is still relatively uncommon, expose the use of the
new visitor via a QAPI_CLONE() macro that takes care of type-punning
the underlying function pointer, rather than generating lots of
unused functions for types that won't be cloned. And yes, we're
relying on the compiler treating all pointers equally, even though
a strict C program cannot portably do so - but we're not the first
one in the qemu code base to expect it to work (hello, glib!).
The choice of adding a fourth visitor type deserves some explanation.
On the surface, the clone visitor is mostly an input visitor (it
takes arbitrary input - in this case, another QAPI object - and
creates a new QAPI object during the course of the visit). But
ever since commit da72ab0 consolidated enum visits based on the
visitor type, using VISITOR_INPUT would cause us to run
visit_type_str(), even though for cloning there is nothing to do
(we just copy the enum value across, without regards to its mapping
to strings). Also, since our input happens to be a QAPI object,
we can also satisfy the internal checks for VISITOR_OUTPUT. So in
the end, I settled with a new VISITOR_CLONE, and chose its value
such that many internal checks can use 'v->type & mask', sticking
to 'v->type == value' where the difference matters.
Note that we can only clone objects (including alternates) and lists,
not built-ins or enums. The visitor core hides integer width from
the actual visitor (since commit 04e070d), and as long as that's the
case, we can't clone top-level integers. Then again, those can
always be cloned by direct copy, since they are not objects with
deep pointers, so it's no real loss. And restricting cloning to
just objects and lists is cleaner than restricting it to non-integers.
As such, I documented that the clone visitor is for direct use only
by code internal to QAPI, and should not be used on incomplete objects
(other than a hack to work around the fact that we allow NULL in place
of "" in visit_type_str() in other output visitors). Note that as
written, the clone visitor will never fail on a complete object.
Scalars (including enums) not at the root of the clone copy just fine
with no additional effort while visiting the scalar, by virtue of a
g_memdup() each time we push another struct onto the stack. Cloning
a string requires deduplication of a pointer, which means it can also
provide the guarantee of an input visitor of never producing NULL
even when still accepting NULL in place of "" the way the QMP output
visitor does.
Cloning an 'any' type could be possible by incrementing the QObject
refcnt, but it's not obvious whether that is better than implementing
a QObject deep clone. So for now, we document it as unsupported,
and intentionally omit the .type_any() callback to let a developer
know their usage needs implementation.
Add testsuite coverage for several different clone situations, to
ensure that the code is working. I also tested that valgrind was
happy with the test.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1465490926-28625-14-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-06-09 18:48:44 +02:00
|
|
|
check-unit-y += tests/test-clone-visitor$(EXESUF)
|
2016-09-30 16:45:27 +02:00
|
|
|
check-unit-y += tests/test-qobject-input-visitor$(EXESUF)
|
2018-02-11 10:35:56 +01:00
|
|
|
check-unit-y += tests/test-qmp-cmds$(EXESUF)
|
2012-03-28 15:42:01 +02:00
|
|
|
check-unit-y += tests/test-string-input-visitor$(EXESUF)
|
|
|
|
check-unit-y += tests/test-string-output-visitor$(EXESUF)
|
2014-06-18 08:43:29 +02:00
|
|
|
check-unit-y += tests/test-qmp-event$(EXESUF)
|
2013-08-20 00:35:40 +02:00
|
|
|
check-unit-y += tests/test-opts-visitor$(EXESUF)
|
2012-03-28 15:42:01 +02:00
|
|
|
check-unit-y += tests/test-coroutine$(EXESUF)
|
2012-02-22 04:05:07 +01:00
|
|
|
check-unit-y += tests/test-visitor-serialization$(EXESUF)
|
rewrite iov_* functions
This changes implementations of all iov_*
functions, completing the previous step.
All iov_* functions now ensure that this offset
argument is within the iovec (using assertion),
but lets to specify `bytes' value larger than
actual length of the iovec - in this case they
stops at the actual end of iovec. It is also
suggested to use convinient `-1' value as `bytes'
to mean just this -- "up to the end".
There's one very minor semantic change here: new
requiriment is that `offset' points to inside of
iovec. This is checked just at the end of functions
(assert()), it does not actually need to be enforced,
but using any of these functions with offset pointing
past the end of iovec is wrong anyway.
Note: the new code in iov.c uses arithmetic with
void pointers. I thought this is not supported
everywhere and is a GCC extension (indeed, the C
standard does not define void arithmetic). However,
the original code already use void arith in
iov_from_buf() function:
(memcpy(..., buf + buf_off,...)
which apparently works well so far (it is this
way in qemu 1.0). So I left it this way and used
it in other places.
While at it, add a unit-test file test-iov.c,
to check various corner cases with iov_from_buf(),
iov_to_buf() and iov_memset().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07 18:08:19 +02:00
|
|
|
check-unit-y += tests/test-iov$(EXESUF)
|
2012-11-23 16:13:23 +01:00
|
|
|
check-unit-y += tests/test-aio$(EXESUF)
|
2017-02-13 14:52:19 +01:00
|
|
|
check-unit-y += tests/test-aio-multithread$(EXESUF)
|
2013-09-02 14:14:38 +02:00
|
|
|
check-unit-y += tests/test-throttle$(EXESUF)
|
2012-11-23 16:13:24 +01:00
|
|
|
check-unit-y += tests/test-thread-pool$(EXESUF)
|
add hierarchical bitmap data type and test cases
HBitmaps provides an array of bits. The bits are stored as usual in an
array of unsigned longs, but HBitmap is also optimized to provide fast
iteration over set bits; going from one bit to the next is O(logB n)
worst case, with B = sizeof(long) * CHAR_BIT: the result is low enough
that the number of levels is in fact fixed.
In order to do this, it stacks multiple bitmaps with progressively coarser
granularity; in all levels except the last, bit N is set iff the N-th
unsigned long is nonzero in the immediately next level. When iteration
completes on the last level it can examine the 2nd-last level to quickly
skip entire words, and even do so recursively to skip blocks of 64 words or
powers thereof (32 on 32-bit machines).
Given an index in the bitmap, it can be split in group of bits like
this (for the 64-bit case):
bits 0-57 => word in the last bitmap | bits 58-63 => bit in the word
bits 0-51 => word in the 2nd-last bitmap | bits 52-57 => bit in the word
bits 0-45 => word in the 3rd-last bitmap | bits 46-51 => bit in the word
So it is easy to move up simply by shifting the index right by
log2(BITS_PER_LONG) bits. To move down, you shift the index left
similarly, and add the word index within the group. Iteration uses
ffs (find first set bit) to find the next word to examine; this
operation can be done in constant time in most current architectures.
Setting or clearing a range of m bits on all levels, the work to perform
is O(m + m/W + m/W^2 + ...), which is O(m) like on a regular bitmap.
When iterating on a bitmap, each bit (on any level) is only visited
once. Hence, The total cost of visiting a bitmap with m bits in it is
the number of bits that are set in all bitmaps. Unless the bitmap is
extremely sparse, this is also O(m + m/W + m/W^2 + ...), so the amortized
cost of advancing from one bit to the next is usually constant.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-01-21 17:09:40 +01:00
|
|
|
check-unit-y += tests/test-hbitmap$(EXESUF)
|
2017-12-05 14:05:02 +01:00
|
|
|
check-unit-y += tests/test-bdrv-drain$(EXESUF)
|
2019-02-23 20:20:41 +01:00
|
|
|
check-unit-y += tests/test-bdrv-graph-mod$(EXESUF)
|
2016-07-29 16:31:41 +02:00
|
|
|
check-unit-y += tests/test-blockjob$(EXESUF)
|
2015-11-06 00:13:20 +01:00
|
|
|
check-unit-y += tests/test-blockjob-txn$(EXESUF)
|
2018-02-16 17:50:14 +01:00
|
|
|
check-unit-y += tests/test-block-backend$(EXESUF)
|
block: Fix hangs in synchronous APIs with iothreads
In the block layer, synchronous APIs are often implemented by creating a
coroutine that calls the asynchronous coroutine-based implementation and
then waiting for completion with BDRV_POLL_WHILE().
For this to work with iothreads (more specifically, when the synchronous
API is called in a thread that is not the home thread of the block
device, so that the coroutine will run in a different thread), we must
make sure to call aio_wait_kick() at the end of the operation. Many
places are missing this, so that BDRV_POLL_WHILE() keeps hanging even if
the condition has long become false.
Note that bdrv_dec_in_flight() involves an aio_wait_kick() call. This
corresponds to the BDRV_POLL_WHILE() in the drain functions, but it is
generally not enough for most other operations because they haven't set
the return value in the coroutine entry stub yet. To avoid race
conditions there, we need to kick after setting the return value.
The race window is small enough that the problem doesn't usually surface
in the common path. However, it does surface and causes easily
reproducible hangs if the operation can return early before even calling
bdrv_inc/dec_in_flight, which many of them do (trivial error or no-op
success paths).
The bug in bdrv_truncate(), bdrv_check() and bdrv_invalidate_cache() is
slightly different: These functions even neglected to schedule the
coroutine in the home thread of the node. This avoids the hang, but is
obviously wrong, too. Fix those to schedule the coroutine in the right
AioContext in addition to adding aio_wait_kick() calls.
Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-01-07 13:02:48 +01:00
|
|
|
check-unit-y += tests/test-block-iothread$(EXESUF)
|
2018-10-11 09:21:35 +02:00
|
|
|
check-unit-y += tests/test-image-locking$(EXESUF)
|
2013-01-23 18:58:27 +01:00
|
|
|
check-unit-y += tests/test-x86-cpuid$(EXESUF)
|
|
|
|
# all code tested by test-x86-cpuid is inside topology.h
|
2014-12-12 12:13:38 +01:00
|
|
|
ifeq ($(CONFIG_SOFTMMU),y)
|
2013-01-31 08:12:16 +01:00
|
|
|
check-unit-y += tests/test-xbzrle$(EXESUF)
|
2014-12-12 12:13:38 +01:00
|
|
|
check-unit-$(CONFIG_POSIX) += tests/test-vmstate$(EXESUF)
|
|
|
|
endif
|
2013-02-04 19:27:45 +01:00
|
|
|
check-unit-y += tests/test-cutils$(EXESUF)
|
2017-01-10 03:10:09 +01:00
|
|
|
check-unit-y += tests/test-shift128$(EXESUF)
|
2013-02-16 21:47:01 +01:00
|
|
|
check-unit-y += tests/test-mul64$(EXESUF)
|
2013-06-20 16:19:32 +02:00
|
|
|
check-unit-y += tests/test-int128$(EXESUF)
|
|
|
|
# all code tested by test-int128 is inside int128.h
|
2013-06-21 09:09:34 +02:00
|
|
|
check-unit-y += tests/rcutorture$(EXESUF)
|
2013-08-27 17:38:45 +02:00
|
|
|
check-unit-y += tests/test-rcu-list$(EXESUF)
|
2018-08-19 11:13:32 +02:00
|
|
|
check-unit-y += tests/test-rcu-simpleq$(EXESUF)
|
2018-08-19 11:13:33 +02:00
|
|
|
check-unit-y += tests/test-rcu-tailq$(EXESUF)
|
2016-06-08 20:55:27 +02:00
|
|
|
check-unit-y += tests/test-qdist$(EXESUF)
|
2016-06-08 20:55:29 +02:00
|
|
|
check-unit-y += tests/test-qht$(EXESUF)
|
2019-01-14 15:54:38 +01:00
|
|
|
check-unit-y += tests/test-qht-par$(EXESUF)
|
2013-06-28 13:40:32 +02:00
|
|
|
check-unit-y += tests/test-bitops$(EXESUF)
|
2016-12-09 15:36:00 +01:00
|
|
|
check-unit-y += tests/test-bitcnt$(EXESUF)
|
2018-07-30 17:36:39 +02:00
|
|
|
check-unit-y += tests/test-qdev-global-props$(EXESUF)
|
2013-12-20 22:14:40 +01:00
|
|
|
check-unit-y += tests/check-qom-interface$(EXESUF)
|
qom: Add object_new_with_props() / object_new_withpropv() helpers
It is reasonably common to want to create an object, set a
number of properties, register it in the hierarchy and then
mark it as complete (if a user creatable type). This requires
quite a lot of error prone, verbose, boilerplate code to achieve.
First a pair of functions object_set_props() / object_set_propv()
are added which allow for a list of objects to be set in
one single API call.
Then object_new_with_props() / object_new_with_propv() constructors
are added which simplify the sequence of calls to create an
object, populate properties, register in the object composition
tree and mark the object complete, into a single method call.
Usage would be:
Error *err = NULL;
Object *obj;
obj = object_new_with_propv(TYPE_MEMORY_BACKEND_FILE,
object_get_objects_root(),
"hostmem0",
&err,
"share", "yes",
"mem-path", "/dev/shm/somefile",
"prealloc", "yes",
"size", "1048576",
NULL);
Note all property values are passed in string form and will
be parsed into their required data types, using normal QOM
semantics for parsing from string format.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2015-05-13 18:14:06 +02:00
|
|
|
check-unit-y += tests/check-qom-proplist$(EXESUF)
|
2014-05-19 23:53:55 +02:00
|
|
|
check-unit-y += tests/test-qemu-opts$(EXESUF)
|
keyval: New keyval_parse()
keyval_parse() parses KEY=VALUE,... into a QDict. Works like
qemu_opts_parse(), except:
* Returns a QDict instead of a QemuOpts (d'oh).
* Supports nesting, unlike QemuOpts: a KEY is split into key
fragments at '.' (dotted key convention; the block layer does
something similar on top of QemuOpts). The key fragments are QDict
keys, and the last one's value is updated to VALUE.
* Each key fragment may be up to 127 bytes long. qemu_opts_parse()
limits the entire key to 127 bytes.
* Overlong key fragments are rejected. qemu_opts_parse() silently
truncates them.
* Empty key fragments are rejected. qemu_opts_parse() happily
accepts empty keys.
* It does not store the returned value. qemu_opts_parse() stores it
in the QemuOptsList.
* It does not treat parameter "id" specially. qemu_opts_parse()
ignores all but the first "id", and fails when its value isn't
id_wellformed(), or duplicate (a QemuOpts with the same ID is
already stored). It also screws up when a value contains ",id=".
* Implied value is not supported. qemu_opts_parse() desugars "foo" to
"foo=on", and "nofoo" to "foo=off".
* An implied key's value can't be empty, and can't contain ','.
I intend to grow this into a saner replacement for QemuOpts. It'll
take time, though.
Note: keyval_parse() provides no way to do lists, and its key syntax
is incompatible with the __RFQDN_ prefix convention for downstream
extensions, because it blindly splits at '.', even in __RFQDN_. Both
issues will be addressed later in the series.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1488317230-26248-4-git-send-email-armbru@redhat.com>
2017-02-28 22:26:49 +01:00
|
|
|
check-unit-y += tests/test-keyval$(EXESUF)
|
block: add event when disk usage exceeds threshold
Managing applications, like oVirt (http://www.ovirt.org), make extensive
use of thin-provisioned disk images.
To let the guest run smoothly and be not unnecessarily paused, oVirt sets
a disk usage threshold (so called 'high water mark') based on the occupation
of the device, and automatically extends the image once the threshold
is reached or exceeded.
In order to detect the crossing of the threshold, oVirt has no choice but
aggressively polling the QEMU monitor using the query-blockstats command.
This lead to unnecessary system load, and is made even worse under scale:
deployments with hundreds of VMs are no longer rare.
To fix this, this patch adds:
* A new monitor command `block-set-write-threshold', to set a mark for
a given block device.
* A new event `BLOCK_WRITE_THRESHOLD', to report if a block device
usage exceeds the threshold.
* A new `write_threshold' field into the `BlockDeviceInfo' structure,
to report the configured threshold.
This will allow the managing application to use smarter and more
efficient monitoring, greatly reducing the need of polling.
[Updated qemu-iotests 067 output to add the new 'write_threshold'
property. --Stefan]
[Changed g_assert_false() to !g_assert() to fix the build on older glib
versions. --Kevin]
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1421068273-692-1-git-send-email-fromani@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-01-12 14:11:13 +01:00
|
|
|
check-unit-y += tests/test-write-threshold$(EXESUF)
|
2016-03-11 19:09:22 +01:00
|
|
|
check-unit-y += tests/test-crypto-hash$(EXESUF)
|
2017-07-14 20:04:10 +02:00
|
|
|
check-speed-y += tests/benchmark-crypto-hash$(EXESUF)
|
2016-12-13 11:43:00 +01:00
|
|
|
check-unit-y += tests/test-crypto-hmac$(EXESUF)
|
2017-07-14 20:04:11 +02:00
|
|
|
check-speed-y += tests/benchmark-crypto-hmac$(EXESUF)
|
2015-07-01 19:10:32 +02:00
|
|
|
check-unit-y += tests/test-crypto-cipher$(EXESUF)
|
2017-07-14 20:04:09 +02:00
|
|
|
check-speed-y += tests/benchmark-crypto-cipher$(EXESUF)
|
crypto: add QCryptoSecret object class for password/key handling
Introduce a new QCryptoSecret object class which will be used
for providing passwords and keys to other objects which need
sensitive credentials.
The new object can provide secret values directly as properties,
or indirectly via a file. The latter includes support for file
descriptor passing syntax on UNIX platforms. Ordinarily passing
secret values directly as properties is insecure, since they
are visible in process listings, or in log files showing the
CLI args / QMP commands. It is possible to use AES-256-CBC to
encrypt the secret values though, in which case all that is
visible is the ciphertext. For ad hoc developer testing though,
it is fine to provide the secrets directly without encryption
so this is not explicitly forbidden.
The anticipated scenario is that libvirtd will create a random
master key per QEMU instance (eg /var/run/libvirt/qemu/$VMNAME.key)
and will use that key to encrypt all passwords it provides to
QEMU via '-object secret,....'. This avoids the need for libvirt
(or other mgmt apps) to worry about file descriptor passing.
It also makes life easier for people who are scripting the
management of QEMU, for whom FD passing is significantly more
complex.
Providing data inline (insecure, only for ad hoc dev testing)
$QEMU -object secret,id=sec0,data=letmein
Providing data indirectly in raw format
printf "letmein" > mypasswd.txt
$QEMU -object secret,id=sec0,file=mypasswd.txt
Providing data indirectly in base64 format
$QEMU -object secret,id=sec0,file=mykey.b64,format=base64
Providing data with encryption
$QEMU -object secret,id=master0,file=mykey.b64,format=base64 \
-object secret,id=sec0,data=[base64 ciphertext],\
keyid=master0,iv=[base64 IV],format=base64
Note that 'format' here refers to the format of the ciphertext
data. The decrypted data must always be in raw byte format.
More examples are shown in the updated docs.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-14 10:58:38 +02:00
|
|
|
check-unit-y += tests/test-crypto-secret$(EXESUF)
|
2015-04-13 15:01:39 +02:00
|
|
|
check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlscredsx509$(EXESUF)
|
2015-03-02 18:23:31 +01:00
|
|
|
check-unit-$(CONFIG_GNUTLS) += tests/test-crypto-tlssession$(EXESUF)
|
2016-04-19 09:39:13 +02:00
|
|
|
ifneq (,$(findstring qemu-ga,$(TOOLS)))
|
2019-01-03 15:10:10 +01:00
|
|
|
check-unit-$(land,$(CONFIG_LINUX),$(CONFIG_VIRTIO_SERIAL)) += tests/test-qga$(EXESUF)
|
2016-04-19 09:39:13 +02:00
|
|
|
endif
|
2015-10-28 16:33:01 +01:00
|
|
|
check-unit-y += tests/test-timed-average$(EXESUF)
|
2017-12-21 13:55:20 +01:00
|
|
|
check-unit-y += tests/test-util-sockets$(EXESUF)
|
2015-03-18 18:25:45 +01:00
|
|
|
check-unit-y += tests/test-io-task$(EXESUF)
|
2015-02-27 17:19:33 +01:00
|
|
|
check-unit-y += tests/test-io-channel-socket$(EXESUF)
|
2015-02-27 19:25:25 +01:00
|
|
|
check-unit-y += tests/test-io-channel-file$(EXESUF)
|
2015-03-02 19:13:13 +01:00
|
|
|
check-unit-$(CONFIG_GNUTLS) += tests/test-io-channel-tls$(EXESUF)
|
2015-08-27 17:25:30 +02:00
|
|
|
check-unit-y += tests/test-io-channel-command$(EXESUF)
|
2015-09-15 18:27:33 +02:00
|
|
|
check-unit-y += tests/test-io-channel-buffer$(EXESUF)
|
2015-11-23 16:24:50 +01:00
|
|
|
check-unit-y += tests/test-base64$(EXESUF)
|
2018-07-18 12:55:05 +02:00
|
|
|
check-unit-$(if $(CONFIG_NETTLE),y,$(CONFIG_GCRYPT)) += tests/test-crypto-pbkdf$(EXESUF)
|
2015-10-15 13:35:28 +02:00
|
|
|
check-unit-y += tests/test-crypto-ivgen$(EXESUF)
|
2015-10-23 17:14:25 +02:00
|
|
|
check-unit-y += tests/test-crypto-afsplit$(EXESUF)
|
2016-02-11 15:00:17 +01:00
|
|
|
check-unit-y += tests/test-crypto-xts$(EXESUF)
|
2015-10-24 12:44:13 +02:00
|
|
|
check-unit-y += tests/test-crypto-block$(EXESUF)
|
2016-03-15 15:30:20 +01:00
|
|
|
check-unit-y += tests/test-logging$(EXESUF)
|
2016-07-27 09:01:51 +02:00
|
|
|
check-unit-$(CONFIG_REPLICATION) += tests/test-replication$(EXESUF)
|
2016-08-29 20:46:16 +02:00
|
|
|
check-unit-y += tests/test-bufferiszero$(EXESUF)
|
2016-09-21 06:27:24 +02:00
|
|
|
check-unit-y += tests/test-uuid$(EXESUF)
|
2016-10-17 20:22:17 +02:00
|
|
|
check-unit-y += tests/ptimer-test$(EXESUF)
|
2017-02-28 22:27:03 +01:00
|
|
|
check-unit-y += tests/test-qapi-util$(EXESUF)
|
2012-03-28 15:42:01 +02:00
|
|
|
|
|
|
|
check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
|
|
|
|
|
2012-03-28 15:42:07 +02:00
|
|
|
# All QTests for now are POSIX-only, but the dependencies are
|
|
|
|
# really in libqtest, not in the testcases themselves.
|
2013-11-07 18:25:10 +01:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-generic-y += tests/qmp-test$(EXESUF)
|
2018-08-23 18:39:32 +02:00
|
|
|
check-qtest-generic-y += tests/qmp-cmd-test$(EXESUF)
|
|
|
|
|
2017-03-03 13:32:23 +01:00
|
|
|
check-qtest-generic-y += tests/device-introspect-test$(EXESUF)
|
2018-06-08 19:17:39 +02:00
|
|
|
check-qtest-generic-y += tests/cdrom-test$(EXESUF)
|
tests: Fix how qom-test is run
We want to run qom-test for every architecture, without having to
manually add it to every architecture's list of tests. Commit 3687d53
accomplished this by adding it to every architecture's list
automatically.
However, some architectures inherit their tests from others, like this:
check-qtest-x86_64-y = $(check-qtest-i386-y)
check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
For such architectures, we ended up running the (slow!) test twice.
Commit 2b8419c attempted to avoid this by adding the test only when
it's not already present. Works only as long as we consider adding
the test to the architectures on the left hand side *after* the ones
on the right hand side: x86_64 after i386, microblazeel after
microblaze, xtensaeb after xtensa.
Turns out we consider them in $(SYSEMU_TARGET_LIST) order. Defined as
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
$(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
On my machine, this results in the oder xtensa, x86_64, microblazeel,
microblaze, i386. Consequently, qom-test runs twice for microblazeel
and x86_64.
Replace this complex and flawed machinery with a much simpler one: add
generic tests (currently just qom-test) to check-qtest-generic-y
instead of check-qtest-$(target)-y for every target, then run
$(check-qtest-generic-y) for every target.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-Id: <1443689999-12182-5-git-send-email-armbru@redhat.com>
2015-10-01 10:59:53 +02:00
|
|
|
|
2014-02-09 12:24:15 +01:00
|
|
|
check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
|
|
|
|
|
2019-01-03 15:10:10 +01:00
|
|
|
check-qtest-virtioserial-$(CONFIG_VIRTIO_SERIAL) += tests/virtio-console-test$(EXESUF)
|
2014-02-21 17:49:12 +01:00
|
|
|
|
2019-01-03 15:10:09 +01:00
|
|
|
check-qtest-virtio-$(CONFIG_VIRTIO_NET) += tests/virtio-net-test$(EXESUF)
|
2019-01-03 15:10:02 +01:00
|
|
|
check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) += tests/virtio-balloon-test$(EXESUF)
|
2019-01-03 15:10:08 +01:00
|
|
|
check-qtest-virtio-$(CONFIG_VIRTIO_BLK) += tests/virtio-blk-test$(EXESUF)
|
2019-01-03 15:10:01 +01:00
|
|
|
check-qtest-virtio-$(CONFIG_VIRTIO_RNG) += tests/virtio-rng-test$(EXESUF)
|
2019-01-03 15:10:07 +01:00
|
|
|
check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) += tests/virtio-scsi-test$(EXESUF)
|
2014-02-21 17:15:21 +01:00
|
|
|
ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
|
2019-01-03 15:10:03 +01:00
|
|
|
check-qtest-virtio-$(CONFIG_VIRTIO_9P) += tests/virtio-9p-test$(EXESUF)
|
2014-02-21 17:15:21 +01:00
|
|
|
endif
|
2019-01-03 15:10:10 +01:00
|
|
|
check-qtest-virtio-$(CONFIG_VIRTIO_SERIAL) += tests/virtio-serial-test$(EXESUF)
|
2014-02-21 17:49:12 +01:00
|
|
|
check-qtest-virtio-y += $(check-qtest-virtioserial-y)
|
2014-02-09 04:13:37 +01:00
|
|
|
|
2013-11-07 18:25:10 +01:00
|
|
|
check-qtest-pci-y += tests/e1000-test$(EXESUF)
|
2016-06-01 10:23:46 +02:00
|
|
|
check-qtest-pci-y += tests/e1000e-test$(EXESUF)
|
2018-07-10 15:30:41 +02:00
|
|
|
check-qtest-pci-$(CONFIG_RTL8139_PCI) += tests/rtl8139-test$(EXESUF)
|
2018-07-10 15:30:00 +02:00
|
|
|
check-qtest-pci-$(CONFIG_PCNET_PCI) += tests/pcnet-test$(EXESUF)
|
2018-07-10 15:26:27 +02:00
|
|
|
check-qtest-pci-$(CONFIG_EEPRO100_PCI) += tests/eepro100-test$(EXESUF)
|
2018-07-10 15:24:17 +02:00
|
|
|
check-qtest-pci-$(CONFIG_NE2000_PCI) += tests/ne2000-test$(EXESUF)
|
2018-07-10 22:56:55 +02:00
|
|
|
check-qtest-pci-$(CONFIG_NVME_PCI) += tests/nvme-test$(EXESUF)
|
2018-07-10 15:50:42 +02:00
|
|
|
check-qtest-pci-$(CONFIG_AC97) += tests/ac97-test$(EXESUF)
|
2018-07-10 15:50:08 +02:00
|
|
|
check-qtest-pci-$(CONFIG_ES1370) += tests/es1370-test$(EXESUF)
|
2018-11-29 11:20:25 +01:00
|
|
|
check-qtest-pci-$(CONFIG_VIRTIO) += $(check-qtest-virtio-y)
|
2018-07-10 16:27:49 +02:00
|
|
|
check-qtest-pci-$(CONFIG_IPACK) += tests/tpci200-test$(EXESUF)
|
|
|
|
check-qtest-pci-$(CONFIG_IPACK) += $(check-qtest-ipack-y)
|
2018-11-29 11:20:25 +01:00
|
|
|
check-qtest-pci-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
2018-07-10 19:01:55 +02:00
|
|
|
check-qtest-pci-$(CONFIG_HDA) += tests/intel-hda-test$(EXESUF)
|
2018-07-10 23:39:01 +02:00
|
|
|
check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
|
2018-11-29 11:20:25 +01:00
|
|
|
check-qtest-pci-$(CONFIG_MEGASAS_SCSI_PCI) += tests/megasas-test$(EXESUF)
|
2013-11-07 18:25:10 +01:00
|
|
|
|
2018-09-24 09:27:40 +02:00
|
|
|
check-qtest-i386-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
2013-07-22 15:54:34 +02:00
|
|
|
check-qtest-i386-y += tests/fdc-test$(EXESUF)
|
2013-05-08 11:18:41 +02:00
|
|
|
check-qtest-i386-y += tests/ide-test$(EXESUF)
|
2014-08-21 19:44:32 +02:00
|
|
|
check-qtest-i386-y += tests/ahci-test$(EXESUF)
|
2012-07-10 11:12:30 +02:00
|
|
|
check-qtest-i386-y += tests/hd-geo-test$(EXESUF)
|
2013-06-26 15:52:13 +02:00
|
|
|
check-qtest-i386-y += tests/boot-order-test$(EXESUF)
|
2014-05-27 21:03:14 +02:00
|
|
|
check-qtest-i386-y += tests/bios-tables-test$(EXESUF)
|
2018-08-13 13:01:42 +02:00
|
|
|
check-qtest-i386-$(CONFIG_SGA) += tests/boot-serial-test$(EXESUF)
|
2017-07-27 17:45:37 +02:00
|
|
|
check-qtest-i386-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
2012-05-15 18:19:45 +02:00
|
|
|
check-qtest-i386-y += tests/rtc-test$(EXESUF)
|
2018-11-29 11:20:25 +01:00
|
|
|
check-qtest-i386-$(CONFIG_ISA_IPMI_KCS) += tests/ipmi-kcs-test$(EXESUF)
|
2019-01-18 19:54:02 +01:00
|
|
|
# Disabled temporarily as it fails intermittently especially under NetBSD VM
|
2018-11-29 11:20:25 +01:00
|
|
|
# check-qtest-i386-$(CONFIG_ISA_IPMI_BT) += tests/ipmi-bt-test$(EXESUF)
|
2013-04-16 16:45:19 +02:00
|
|
|
check-qtest-i386-y += tests/i440fx-test$(EXESUF)
|
2013-04-16 16:45:21 +02:00
|
|
|
check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
|
2014-10-02 16:51:31 +02:00
|
|
|
check-qtest-i386-y += tests/drive_del-test$(EXESUF)
|
2018-09-24 09:26:19 +02:00
|
|
|
check-qtest-i386-$(CONFIG_WDT_IB700) += tests/wdt_ib700-test$(EXESUF)
|
2015-07-08 09:06:15 +02:00
|
|
|
check-qtest-i386-y += tests/tco-test$(EXESUF)
|
2013-11-07 18:25:10 +01:00
|
|
|
check-qtest-i386-y += $(check-qtest-pci-y)
|
2018-09-24 09:28:23 +02:00
|
|
|
check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
|
2018-07-10 22:51:53 +02:00
|
|
|
check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)
|
2018-07-10 19:02:03 +02:00
|
|
|
check-qtest-i386-$(CONFIG_I82801B11) += tests/i82801b11-test$(EXESUF)
|
2018-07-10 18:30:10 +02:00
|
|
|
check-qtest-i386-$(CONFIG_IOH3420) += tests/ioh3420-test$(EXESUF)
|
2018-07-10 23:13:41 +02:00
|
|
|
check-qtest-i386-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
|
2018-07-11 18:51:04 +02:00
|
|
|
check-qtest-i386-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
|
2018-07-17 12:01:47 +02:00
|
|
|
ifeq ($(CONFIG_USB_ECHI)$(CONFIG_USB_UHCI),yy)
|
2014-03-30 20:25:38 +02:00
|
|
|
check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
|
2018-07-17 12:01:47 +02:00
|
|
|
endif
|
2018-07-10 23:07:09 +02:00
|
|
|
check-qtest-i386-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
|
2017-10-06 12:13:51 +02:00
|
|
|
check-qtest-i386-y += tests/cpu-plug-test$(EXESUF)
|
2015-04-14 15:11:36 +02:00
|
|
|
check-qtest-i386-y += tests/q35-test$(EXESUF)
|
2017-07-02 05:54:03 +02:00
|
|
|
check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
|
2017-08-03 11:07:46 +02:00
|
|
|
check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF)
|
|
|
|
ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
|
|
|
|
check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF)
|
2015-10-06 11:17:55 +02:00
|
|
|
endif
|
2018-07-11 10:47:31 +02:00
|
|
|
check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-swtpm-test$(EXESUF)
|
|
|
|
check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-test$(EXESUF)
|
|
|
|
check-qtest-i386-$(CONFIG_TPM_TIS) += tests/tpm-tis-swtpm-test$(EXESUF)
|
|
|
|
check-qtest-i386-$(CONFIG_TPM_TIS) += tests/tpm-tis-test$(EXESUF)
|
2017-07-27 17:45:37 +02:00
|
|
|
check-qtest-i386-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
2017-08-17 08:25:08 +02:00
|
|
|
check-qtest-i386-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
|
2018-07-10 15:30:41 +02:00
|
|
|
check-qtest-i386-$(CONFIG_RTL8139_PCI) += tests/test-filter-redirector$(EXESUF)
|
2017-10-11 11:03:22 +02:00
|
|
|
check-qtest-i386-y += tests/migration-test$(EXESUF)
|
2016-09-20 22:11:39 +02:00
|
|
|
check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF)
|
2017-05-03 14:56:55 +02:00
|
|
|
check-qtest-i386-y += tests/numa-test$(EXESUF)
|
2016-06-06 18:45:07 +02:00
|
|
|
check-qtest-x86_64-y += $(check-qtest-i386-y)
|
2018-07-10 18:52:52 +02:00
|
|
|
check-qtest-x86_64-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF)
|
2016-09-03 11:57:50 +02:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-alpha-y += tests/boot-serial-test$(EXESUF)
|
2018-11-29 12:50:48 +01:00
|
|
|
check-qtest-alpha-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
2016-09-03 11:57:51 +02:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-hppa-y += tests/boot-serial-test$(EXESUF)
|
2018-11-29 12:50:48 +01:00
|
|
|
check-qtest-hppa-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
2018-02-04 07:46:15 +01:00
|
|
|
|
2017-11-30 09:53:04 +01:00
|
|
|
check-qtest-m68k-y = tests/boot-serial-test$(EXESUF)
|
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-microblaze-y += tests/boot-serial-test$(EXESUF)
|
2017-11-30 09:53:05 +01:00
|
|
|
|
2018-09-24 09:27:40 +02:00
|
|
|
check-qtest-mips-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
2018-11-29 12:50:48 +01:00
|
|
|
check-qtest-mips-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
2018-09-24 09:27:40 +02:00
|
|
|
|
|
|
|
check-qtest-mips64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
2018-11-29 12:50:48 +01:00
|
|
|
check-qtest-mips64-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
2018-09-24 09:27:40 +02:00
|
|
|
|
|
|
|
check-qtest-mips64el-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
2018-11-29 12:50:48 +01:00
|
|
|
check-qtest-mips64el-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
2018-09-24 09:27:40 +02:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-moxie-y += tests/boot-serial-test$(EXESUF)
|
2017-11-30 09:53:07 +01:00
|
|
|
|
2018-09-24 09:27:40 +02:00
|
|
|
check-qtest-ppc-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
2016-09-03 11:57:50 +02:00
|
|
|
check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
|
|
|
|
check-qtest-ppc-y += tests/prom-env-test$(EXESUF)
|
|
|
|
check-qtest-ppc-y += tests/drive_del-test$(EXESUF)
|
2016-09-03 11:57:51 +02:00
|
|
|
check-qtest-ppc-y += tests/boot-serial-test$(EXESUF)
|
2018-11-29 11:32:11 +01:00
|
|
|
check-qtest-ppc-$(CONFIG_M48T59) += tests/m48t59-test$(EXESUF)
|
2016-09-03 11:57:50 +02:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-ppc64-y += $(check-qtest-ppc-y)
|
2018-11-29 11:32:11 +01:00
|
|
|
check-qtest-ppc64-$(CONFIG_PSERIES) += tests/spapr-phb-test$(EXESUF)
|
|
|
|
check-qtest-ppc64-$(CONFIG_POWERNV) += tests/pnv-xscom-test$(EXESUF)
|
2017-10-11 11:03:22 +02:00
|
|
|
check-qtest-ppc64-y += tests/migration-test$(EXESUF)
|
2018-11-29 11:32:11 +01:00
|
|
|
check-qtest-ppc64-$(CONFIG_PSERIES) += tests/rtas-test$(EXESUF)
|
2017-07-27 17:45:37 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
2018-07-10 23:13:41 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
|
2018-07-11 18:51:04 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
|
2018-07-10 23:07:09 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
|
2018-11-29 11:32:11 +01:00
|
|
|
check-qtest-ppc64-$(CONFIG_VIRTIO) += $(check-qtest-virtio-y)
|
2017-07-27 17:45:37 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
2017-08-17 08:25:08 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
|
2018-07-10 15:30:41 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_RTL8139_PCI) += tests/test-filter-redirector$(EXESUF)
|
2018-11-29 11:32:11 +01:00
|
|
|
check-qtest-ppc64-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
|
2017-05-03 14:56:55 +02:00
|
|
|
check-qtest-ppc64-y += tests/numa-test$(EXESUF)
|
2018-07-10 23:39:01 +02:00
|
|
|
check-qtest-ppc64-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
|
2017-10-06 15:53:19 +02:00
|
|
|
check-qtest-ppc64-y += tests/cpu-plug-test$(EXESUF)
|
2016-09-03 11:57:50 +02:00
|
|
|
|
2018-09-24 09:27:40 +02:00
|
|
|
check-qtest-sh4-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
|
|
|
|
|
|
|
check-qtest-sh4eb-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-sparc-y += tests/prom-env-test$(EXESUF)
|
tests/m48t59: Fix and re-enable the test for sparc
The m48t59 test has been disabled in commit baeddded5fe6fa37d13fb94bf8d
("sparc: disable qtest in make check"), likely due to some timing issues
in the bcd_check_time tests which might fail if it gets interrupted for
too long. It should be OK to re-enable this test if we make sure that we
do not run it on timing-sensitive machines, thus it should be OK if we only
run it in the g_test_slow() mode.
Additionally, there are two other issues:
First, the test can not run so easily on sparc64 anymore, since commit
f3b18f35a23c60edbda6420cd ("sun4u: switch m48t59 NVRAM to MMIO access")
moved the m48t59 device to the ebus instead, and for this you first
have to set up the corresponding PCI device (which is currently not
possible from within the m48t59 test). So we can only re-enable this
test on sparc, but not the sparc64 target.
Second, the fuzzing test is executed before the bcd-check-time test
(due to the naming of the tests), without having the base address set
up properly, so the fuzzing test does not really check anything at all.
Fix it by setting up the base address from the main function already
and by moving the qtest_start() to the tests themselves, so that each
test starts with a clean environment (since after the fuzzing, the clock
is unusable for the bcd-check-time test).
Signed-off-by: Thomas Huth <thuth@redhat.com>
2018-02-12 12:13:38 +01:00
|
|
|
check-qtest-sparc-y += tests/m48t59-test$(EXESUF)
|
2018-02-01 10:28:22 +01:00
|
|
|
check-qtest-sparc-y += tests/boot-serial-test$(EXESUF)
|
2016-09-03 11:57:50 +02:00
|
|
|
|
2018-09-24 09:27:40 +02:00
|
|
|
check-qtest-sparc64-$(CONFIG_ISA_TESTDEV) = tests/endianness-test$(EXESUF)
|
2017-02-10 19:22:57 +01:00
|
|
|
check-qtest-sparc64-y += tests/prom-env-test$(EXESUF)
|
2018-02-01 10:28:22 +01:00
|
|
|
check-qtest-sparc64-y += tests/boot-serial-test$(EXESUF)
|
2016-09-03 11:57:50 +02:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-arm-y += tests/tmp105-test$(EXESUF)
|
2018-06-08 14:15:32 +02:00
|
|
|
check-qtest-arm-y += tests/pca9552-test$(EXESUF)
|
2016-06-27 16:37:32 +02:00
|
|
|
check-qtest-arm-y += tests/ds1338-test$(EXESUF)
|
2019-01-07 16:23:47 +01:00
|
|
|
check-qtest-arm-y += tests/microbit-test$(EXESUF)
|
2016-10-17 20:22:17 +02:00
|
|
|
check-qtest-arm-y += tests/m25p80-test$(EXESUF)
|
2019-01-03 15:10:08 +01:00
|
|
|
check-qtest-arm-$(CONFIG_VIRTIO_BLK) += tests/virtio-blk-test$(EXESUF)
|
2016-10-24 17:26:54 +02:00
|
|
|
check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
|
2017-11-30 09:53:08 +01:00
|
|
|
check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
|
2018-07-10 18:52:52 +02:00
|
|
|
check-qtest-arm-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF)
|
2018-08-16 15:05:28 +02:00
|
|
|
check-qtest-arm-y += tests/hexloader-test$(EXESUF)
|
2016-09-03 11:57:50 +02:00
|
|
|
|
2017-05-03 14:56:55 +02:00
|
|
|
check-qtest-aarch64-y = tests/numa-test$(EXESUF)
|
2018-07-10 18:52:52 +02:00
|
|
|
check-qtest-aarch64-$(CONFIG_SDHCI) += tests/sdhci-test$(EXESUF)
|
2018-02-01 18:28:09 +01:00
|
|
|
check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
|
2018-10-04 18:08:46 +02:00
|
|
|
check-qtest-aarch64-y += tests/migration-test$(EXESUF)
|
2017-05-03 14:56:55 +02:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-microblazeel-y += $(check-qtest-microblaze-y)
|
2016-09-03 11:57:50 +02:00
|
|
|
|
2018-10-11 16:47:51 +02:00
|
|
|
check-qtest-xtensaeb-y += $(check-qtest-xtensa-y)
|
2012-03-28 15:42:07 +02:00
|
|
|
|
2016-09-03 11:57:51 +02:00
|
|
|
check-qtest-s390x-y = tests/boot-serial-test$(EXESUF)
|
2017-08-11 07:57:56 +02:00
|
|
|
check-qtest-s390x-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
2017-08-17 08:25:09 +02:00
|
|
|
check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
|
|
|
check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
|
|
|
|
check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
|
2017-08-31 16:40:08 +02:00
|
|
|
check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
|
2018-08-01 15:26:22 +02:00
|
|
|
check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
|
2017-10-17 13:39:15 +02:00
|
|
|
check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
|
2018-10-09 11:51:17 +02:00
|
|
|
check-qtest-s390x-y += tests/migration-test$(EXESUF)
|
2016-09-03 11:57:51 +02:00
|
|
|
|
2018-02-07 11:40:24 +01:00
|
|
|
check-qtest-generic-y += tests/machine-none-test$(EXESUF)
|
tests: Fix how qom-test is run
We want to run qom-test for every architecture, without having to
manually add it to every architecture's list of tests. Commit 3687d53
accomplished this by adding it to every architecture's list
automatically.
However, some architectures inherit their tests from others, like this:
check-qtest-x86_64-y = $(check-qtest-i386-y)
check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
For such architectures, we ended up running the (slow!) test twice.
Commit 2b8419c attempted to avoid this by adding the test only when
it's not already present. Works only as long as we consider adding
the test to the architectures on the left hand side *after* the ones
on the right hand side: x86_64 after i386, microblazeel after
microblaze, xtensaeb after xtensa.
Turns out we consider them in $(SYSEMU_TARGET_LIST) order. Defined as
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
$(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
On my machine, this results in the oder xtensa, x86_64, microblazeel,
microblaze, i386. Consequently, qom-test runs twice for microblazeel
and x86_64.
Replace this complex and flawed machinery with a much simpler one: add
generic tests (currently just qom-test) to check-qtest-generic-y
instead of check-qtest-$(target)-y for every target, then run
$(check-qtest-generic-y) for every target.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-Id: <1443689999-12182-5-git-send-email-armbru@redhat.com>
2015-10-01 10:59:53 +02:00
|
|
|
check-qtest-generic-y += tests/qom-test$(EXESUF)
|
2017-04-25 07:16:47 +02:00
|
|
|
check-qtest-generic-y += tests/test-hmp$(EXESUF)
|
2014-01-23 17:22:59 +01:00
|
|
|
|
2016-02-18 07:48:17 +01:00
|
|
|
qapi-schema += alternate-any.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += alternate-array.json
|
|
|
|
qapi-schema += alternate-base.json
|
|
|
|
qapi-schema += alternate-clash.json
|
|
|
|
qapi-schema += alternate-conflict-dict.json
|
qapi: Reject alternates that can't work with keyval_parse()
Alternates are sum types like unions, but use the JSON type on the
wire / QType in QObject instead of an explicit tag. That's why we
require alternate members to have distinct QTypes.
The recently introduced keyval_parse() (commit d454dbe) can only
produce string scalars. The qobject_input_visitor_new_keyval() input
visitor mostly hides the difference, so code using a QObject input
visitor doesn't have to care whether its input was parsed from JSON or
KEY=VALUE,... The difference leaks for alternates, as noted in commit
0ee9ae7: a non-string, non-enum scalar alternate value can't currently
be expressed.
In part, this is just our insufficiently sophisticated implementation.
Consider alternate type 'GuestFileWhence'. It has an integer member
and a 'QGASeek' member. The latter is an enumeration with values
'set', 'cur', 'end'. The meaning of b=set, b=cur, b=end, b=0, b=1 and
so forth is perfectly obvious. However, our current implementation
falls apart at run time for b=0, b=1, and so forth. Fixable, but not
today; add a test case and a TODO comment.
Now consider an alternate type with a string and an integer member.
What's the meaning of a=42? Is it the string "42" or the integer 42?
Whichever meaning you pick makes the other inexpressible. This isn't
just an implementation problem, it's fundamental. Our current
implementation will pick string.
So far, we haven't needed such alternates. To make sure we stop and
think before we add one that cannot sanely work with keyval_parse(),
let's require alternate members to have sufficiently distinct
representation in KEY=VALUE,... syntax:
* A string member clashes with any other scalar member
* An enumeration member clashes with bool members when it has value
'on' or 'off'.
* An enumeration member clashes with numeric members when it has a
value that starts with '-', '+', or a decimal digit. This is a
rather lazy approximation of the actual number syntax accepted by
the visitor.
Note that enumeration values starting with '-' and '+' are rejected
elsewhere already, but better safe than sorry.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1495471335-23707-5-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2017-05-22 18:42:15 +02:00
|
|
|
qapi-schema += alternate-conflict-enum-bool.json
|
|
|
|
qapi-schema += alternate-conflict-enum-int.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += alternate-conflict-string.json
|
qapi: Fix error handling code on alternate conflict
The conflict check added by commit c0644771 ("qapi: Reject
alternates that can't work with keyval_parse()") doesn't work
with the following declaration:
{ 'alternate': 'Alt',
'data': { 'one': 'bool',
'two': 'str' } }
It crashes with:
Traceback (most recent call last):
File "./scripts/qapi-types.py", line 295, in <module>
schema = QAPISchema(input_file)
File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 1468, in __init__
self.exprs = check_exprs(parser.exprs)
File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 958, in check_exprs
check_alternate(expr, info)
File "/home/ehabkost/rh/proj/virt/qemu/scripts/qapi.py", line 830, in check_alternate
% (name, key, types_seen[qtype]))
KeyError: 'QTYPE_QSTRING'
This happens because the previously-seen conflicting member
('one') can't be found at types_seen[qtype], but at
types_seen['QTYPE_BOOL'].
Fix the bug by moving the error check to the same loop that adds
new items to types_seen, raising an exception if types_seen[qt]
is already set.
Add two additional test cases that can detect the bug.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20170717180926.14924-1-ehabkost@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-07-17 20:09:26 +02:00
|
|
|
qapi-schema += alternate-conflict-bool-string.json
|
|
|
|
qapi-schema += alternate-conflict-num-string.json
|
qapi: Add tests for empty unions
The documentation claims that alternates are useful for
allowing two or more types, although nothing enforces this.
Meanwhile, it is silent on whether empty unions are allowed.
In practice, the generated code will compile, in part because
we have a 'void *data' branch; but attempting to visit such a
type will cause an abort(). While there's no technical reason
that a degenerate union could not be made to work, it's harder
to justify the time spent in chasing known (the current
abort() during visit) and unknown corner cases, than it would
be to just outlaw them. A future patch will probably take the
approach of forbidding them; in the meantime, we can at least
add testsuite coverage to make it obvious where things stand.
In addition to adding tests to expose the problems, we also
need to adjust existing tests that are meant to test something
else, but which could fail for the wrong reason if we reject
degenerate alternates/unions.
Note that empty structs are explicitly supported (for example,
right now they are the only way to specify that one branch of a
flat union adds no additional members), and empty enums are
covered by the testsuite as working (even if they do not seem
to have much use).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-8-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-30 00:21:05 +02:00
|
|
|
qapi-schema += alternate-empty.json
|
2018-12-13 13:37:14 +01:00
|
|
|
qapi-schema += alternate-invalid-dict.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += alternate-nested.json
|
|
|
|
qapi-schema += alternate-unknown.json
|
|
|
|
qapi-schema += args-alternate.json
|
|
|
|
qapi-schema += args-any.json
|
|
|
|
qapi-schema += args-array-empty.json
|
|
|
|
qapi-schema += args-array-unknown.json
|
2016-07-14 05:50:20 +02:00
|
|
|
qapi-schema += args-bad-boxed.json
|
|
|
|
qapi-schema += args-boxed-anon.json
|
|
|
|
qapi-schema += args-boxed-empty.json
|
|
|
|
qapi-schema += args-boxed-string.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += args-int.json
|
|
|
|
qapi-schema += args-invalid.json
|
|
|
|
qapi-schema += args-member-array-bad.json
|
qapi: Enforce (or whitelist) case conventions on qapi members
We document that members of enums and objects should be
'lower-case', although we were not enforcing it. We have to
whitelist a few pre-existing entities that violate the norms.
Add three new tests to expose the new error message, each of
which first uses the whitelisted name 'UuidInfo' to prove the
whitelist works, then triggers the failure (this is the same
pattern used in the existing returns-whitelist.json test).
Note that by adding this check, we have effectively forbidden
an entity with a case-insensitive clash of member names, for
any entity that is not on the whitelist (although there is
still the possibility to clash via '-' vs. '_').
Not done here: a future patch should also add naming convention
support and whitelist exceptions for command, event, and type
names.
The additions to QAPISchemaMember.check_clash() check whether
info['name'] is in the whitelist (the top-most entity name at
the point 'info' tracks), rather than self.owner (the type,
possibly implicit, that directly owns the member), because it
is easier to maintain the whitelist by the names actually in
the user's .json file, rather than worrying about the names
of implicit types.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-14-git-send-email-eblake@redhat.com>
[Simplified a bit as per discussion with Eric]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-02 06:20:57 +01:00
|
|
|
qapi-schema += args-member-case.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += args-member-unknown.json
|
qapi: Test for various name collisions
Expose some weaknesses in the generator: we don't always forbid
the generation of structs that contain multiple members that map
to the same C or QMP name. This has already been marked FIXME in
qapi.py in commit d90675f, but having more tests will make sure
future patches produce desired behavior; and updating existing
patches to better document things doesn't hurt, either. Some of
these collisions are already caught in the old-style parser
checks, but ultimately we want all collisions to be caught in the
new-style QAPISchema*.check() methods.
This patch focuses on C struct members, and does not consider
collisions between commands and events (affecting C function
names), or even collisions between generated C type names with
user type names (for things like automatic FOOList struct
representing array types or FOOKind for an implicit enum).
There are two types of struct collisions we want to catch:
1) Collision between two keys in a JSON object. qapi.py prevents
that within a single struct (see test duplicate-key), but it is
possible to have collisions between a type's members and its
base type's members (existing tests struct-base-clash,
struct-base-clash-deep), and its flat union variant members
(renamed test flat-union-clash-member).
2) Collision between two members of the C struct that is generated
for a given QAPI type:
a) Multiple QAPI names map to the same C name (new test
args-name-clash)
b) A QAPI name maps to a C name that is used for another purpose
(new tests flat-union-clash-branch, struct-base-clash-base,
union-clash-data). We already fixed some such cases in commit
0f61af3e and 1e6c1616, but more remain.
c) Two C names generated for other purposes clash
(updated test alternate-clash, new test union-clash-branches,
union-clash-type, flat-union-clash-type)
Ultimately, if we need to have a flat union where a tag value
clashes with a base member name, we could change the generator to
name the union (using 'foo.u.value' rather than 'foo.value') or
otherwise munge the C name corresponding to tag values. But
unless such a need arises, it will probably be easier to just
forbid these collisions.
Some of these negative tests will be deleted later, and positive
tests added to qapi-schema-test.json in their place, when the
generator code is reworked to avoid particular code generation
collisions in class 2).
[Note that viewing this patch with git rename detection enabled
may see some confusion due to renaming some tests while adding
others, but where the content is similar enough that git picks
the wrong pre- and post-patch files to associate]
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-6-git-send-email-eblake@redhat.com>
[Improve commit message and comments a bit, drop an unrelated test]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-30 00:21:03 +02:00
|
|
|
qapi-schema += args-name-clash.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += args-union.json
|
|
|
|
qapi-schema += args-unknown.json
|
|
|
|
qapi-schema += bad-base.json
|
|
|
|
qapi-schema += bad-data.json
|
|
|
|
qapi-schema += bad-ident.json
|
2018-07-03 17:56:35 +02:00
|
|
|
qapi-schema += bad-if.json
|
|
|
|
qapi-schema += bad-if-empty.json
|
|
|
|
qapi-schema += bad-if-empty-list.json
|
|
|
|
qapi-schema += bad-if-list.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += bad-type-bool.json
|
|
|
|
qapi-schema += bad-type-dict.json
|
|
|
|
qapi-schema += bad-type-int.json
|
qapi: Detect base class loops
It should be fairly obvious that qapi base classes need to
form an acyclic graph, since QMP cannot specify the same
key more than once, while base classes are included as flat
members alongside other members added by the child. But the
old check_member_clash() parser function was not prepared to
check for this, and entered an infinite recursion (at least
until Python gives up, complaining about nesting too deep).
Now that check_member_clash() has been recently removed,
attempts at self-inheritance trigger an assertion failure
introduced by commit ac88219a. The obvious fix is to turn
the assertion into a conditional.
This patch includes both the tests (base-cycle-direct and
base-cycle-indirect) and the fix, since the .err file output
for the unfixed case is not useful (particularly when it was
warning about unbounded recursion, as that limit may be
platform-specific).
We don't need to worry about cycles in flat unions (neither
the base type nor the type of a variant can be a union) nor
in alternates (alternate branches cannot themselves be an
alternate). But if we later allow a union type as a variant,
we will still be okay, as QAPISchemaObjectTypeVariants.check()
triggers the same QAPISchemaObjectType.check() that will
detect any loops.
Likewise, we need not worry about the case of diamond
inheritance where the same class is used for a flat union base
class and one of its variants; either both uses will introduce
a collision in trying to insert the same member name twice, or
the shared type is empty and changes nothing.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-16-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-02 06:20:59 +01:00
|
|
|
qapi-schema += base-cycle-direct.json
|
|
|
|
qapi-schema += base-cycle-indirect.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += command-int.json
|
|
|
|
qapi-schema += comments.json
|
2017-03-15 13:57:25 +01:00
|
|
|
qapi-schema += doc-bad-alternate-member.json
|
2017-03-15 13:57:24 +01:00
|
|
|
qapi-schema += doc-bad-command-arg.json
|
2017-10-02 16:13:35 +02:00
|
|
|
qapi-schema += doc-bad-section.json
|
qapi: add qapi2texi script
As the name suggests, the qapi2texi script converts JSON QAPI
description into a texi file suitable for different target
formats (info/man/txt/pdf/html...).
It parses the following kind of blocks:
Free-form:
##
# = Section
# == Subsection
#
# Some text foo with *emphasis*
# 1. with a list
# 2. like that
#
# And some code:
# | $ echo foo
# | -> do this
# | <- get that
#
##
Symbol description:
##
# @symbol:
#
# Symbol body ditto ergo sum. Foo bar
# baz ding.
#
# @param1: the frob to frobnicate
# @param2: #optional how hard to frobnicate
#
# Returns: the frobnicated frob.
# If frob isn't frobnicatable, GenericError.
#
# Since: version
# Notes: notes, comments can have
# - itemized list
# - like this
#
# Example:
#
# -> { "execute": "quit" }
# <- { "return": {} }
#
##
That's roughly following the following EBNF grammar:
api_comment = "##\n" comment "##\n"
comment = freeform_comment | symbol_comment
freeform_comment = { "# " text "\n" | "#\n" }
symbol_comment = "# @" name ":\n" { member | tag_section | freeform_comment }
member = "# @" name ':' [ text ] "\n" freeform_comment
tag_section = "# " ( "Returns:", "Since:", "Note:", "Notes:", "Example:", "Examples:" ) [ text ] "\n" freeform_comment
text = free text with markup
Note that the grammar is ambiguous: a line "# @foo:\n" can be parsed
both as freeform_comment and as symbol_comment. The actual parser
recognizes symbol_comment.
See docs/qapi-code-gen.txt for more details.
Deficiencies and limitations:
- the generated QMP documentation includes internal types
- union type support is lacking
- type information is lacking in generated documentation
- doc comment error message positions are imprecise, they point
to the beginning of the comment.
- a few minor issues, all marked TODO/FIXME in the code
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170113144135.5150-16-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[test-qapi.py tweaked to avoid trailing empty lines in .out]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-01-13 15:41:29 +01:00
|
|
|
qapi-schema += doc-bad-symbol.json
|
2017-03-15 13:57:25 +01:00
|
|
|
qapi-schema += doc-bad-union-member.json
|
2017-03-15 13:57:19 +01:00
|
|
|
qapi-schema += doc-before-include.json
|
|
|
|
qapi-schema += doc-before-pragma.json
|
qapi: add qapi2texi script
As the name suggests, the qapi2texi script converts JSON QAPI
description into a texi file suitable for different target
formats (info/man/txt/pdf/html...).
It parses the following kind of blocks:
Free-form:
##
# = Section
# == Subsection
#
# Some text foo with *emphasis*
# 1. with a list
# 2. like that
#
# And some code:
# | $ echo foo
# | -> do this
# | <- get that
#
##
Symbol description:
##
# @symbol:
#
# Symbol body ditto ergo sum. Foo bar
# baz ding.
#
# @param1: the frob to frobnicate
# @param2: #optional how hard to frobnicate
#
# Returns: the frobnicated frob.
# If frob isn't frobnicatable, GenericError.
#
# Since: version
# Notes: notes, comments can have
# - itemized list
# - like this
#
# Example:
#
# -> { "execute": "quit" }
# <- { "return": {} }
#
##
That's roughly following the following EBNF grammar:
api_comment = "##\n" comment "##\n"
comment = freeform_comment | symbol_comment
freeform_comment = { "# " text "\n" | "#\n" }
symbol_comment = "# @" name ":\n" { member | tag_section | freeform_comment }
member = "# @" name ':' [ text ] "\n" freeform_comment
tag_section = "# " ( "Returns:", "Since:", "Note:", "Notes:", "Example:", "Examples:" ) [ text ] "\n" freeform_comment
text = free text with markup
Note that the grammar is ambiguous: a line "# @foo:\n" can be parsed
both as freeform_comment and as symbol_comment. The actual parser
recognizes symbol_comment.
See docs/qapi-code-gen.txt for more details.
Deficiencies and limitations:
- the generated QMP documentation includes internal types
- union type support is lacking
- type information is lacking in generated documentation
- doc comment error message positions are imprecise, they point
to the beginning of the comment.
- a few minor issues, all marked TODO/FIXME in the code
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170113144135.5150-16-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[test-qapi.py tweaked to avoid trailing empty lines in .out]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-01-13 15:41:29 +01:00
|
|
|
qapi-schema += doc-duplicated-arg.json
|
|
|
|
qapi-schema += doc-duplicated-return.json
|
|
|
|
qapi-schema += doc-duplicated-since.json
|
|
|
|
qapi-schema += doc-empty-arg.json
|
|
|
|
qapi-schema += doc-empty-section.json
|
|
|
|
qapi-schema += doc-empty-symbol.json
|
2017-03-20 14:11:54 +01:00
|
|
|
qapi-schema += doc-good.json
|
qapi: add qapi2texi script
As the name suggests, the qapi2texi script converts JSON QAPI
description into a texi file suitable for different target
formats (info/man/txt/pdf/html...).
It parses the following kind of blocks:
Free-form:
##
# = Section
# == Subsection
#
# Some text foo with *emphasis*
# 1. with a list
# 2. like that
#
# And some code:
# | $ echo foo
# | -> do this
# | <- get that
#
##
Symbol description:
##
# @symbol:
#
# Symbol body ditto ergo sum. Foo bar
# baz ding.
#
# @param1: the frob to frobnicate
# @param2: #optional how hard to frobnicate
#
# Returns: the frobnicated frob.
# If frob isn't frobnicatable, GenericError.
#
# Since: version
# Notes: notes, comments can have
# - itemized list
# - like this
#
# Example:
#
# -> { "execute": "quit" }
# <- { "return": {} }
#
##
That's roughly following the following EBNF grammar:
api_comment = "##\n" comment "##\n"
comment = freeform_comment | symbol_comment
freeform_comment = { "# " text "\n" | "#\n" }
symbol_comment = "# @" name ":\n" { member | tag_section | freeform_comment }
member = "# @" name ':' [ text ] "\n" freeform_comment
tag_section = "# " ( "Returns:", "Since:", "Note:", "Notes:", "Example:", "Examples:" ) [ text ] "\n" freeform_comment
text = free text with markup
Note that the grammar is ambiguous: a line "# @foo:\n" can be parsed
both as freeform_comment and as symbol_comment. The actual parser
recognizes symbol_comment.
See docs/qapi-code-gen.txt for more details.
Deficiencies and limitations:
- the generated QMP documentation includes internal types
- union type support is lacking
- type information is lacking in generated documentation
- doc comment error message positions are imprecise, they point
to the beginning of the comment.
- a few minor issues, all marked TODO/FIXME in the code
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170113144135.5150-16-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[test-qapi.py tweaked to avoid trailing empty lines in .out]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-01-13 15:41:29 +01:00
|
|
|
qapi-schema += doc-interleaved-section.json
|
|
|
|
qapi-schema += doc-invalid-end.json
|
|
|
|
qapi-schema += doc-invalid-end2.json
|
|
|
|
qapi-schema += doc-invalid-return.json
|
|
|
|
qapi-schema += doc-invalid-section.json
|
|
|
|
qapi-schema += doc-invalid-start.json
|
|
|
|
qapi-schema += doc-missing-colon.json
|
|
|
|
qapi-schema += doc-missing-expr.json
|
|
|
|
qapi-schema += doc-missing-space.json
|
2017-10-02 16:13:35 +02:00
|
|
|
qapi-schema += doc-missing.json
|
2017-03-15 13:57:19 +01:00
|
|
|
qapi-schema += doc-no-symbol.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += double-data.json
|
|
|
|
qapi-schema += double-type.json
|
|
|
|
qapi-schema += duplicate-key.json
|
|
|
|
qapi-schema += empty.json
|
2018-12-13 13:37:08 +01:00
|
|
|
qapi-schema += enum-bad-member.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += enum-bad-name.json
|
|
|
|
qapi-schema += enum-bad-prefix.json
|
|
|
|
qapi-schema += enum-clash-member.json
|
2018-12-13 13:37:08 +01:00
|
|
|
qapi-schema += enum-dict-member-unknown.json
|
2018-12-13 13:37:11 +01:00
|
|
|
qapi-schema += enum-if-invalid.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += enum-int-member.json
|
qapi: Enforce (or whitelist) case conventions on qapi members
We document that members of enums and objects should be
'lower-case', although we were not enforcing it. We have to
whitelist a few pre-existing entities that violate the norms.
Add three new tests to expose the new error message, each of
which first uses the whitelisted name 'UuidInfo' to prove the
whitelist works, then triggers the failure (this is the same
pattern used in the existing returns-whitelist.json test).
Note that by adding this check, we have effectively forbidden
an entity with a case-insensitive clash of member names, for
any entity that is not on the whitelist (although there is
still the possibility to clash via '-' vs. '_').
Not done here: a future patch should also add naming convention
support and whitelist exceptions for command, event, and type
names.
The additions to QAPISchemaMember.check_clash() check whether
info['name'] is in the whitelist (the top-most entity name at
the point 'info' tracks), rather than self.owner (the type,
possibly implicit, that directly owns the member), because it
is easier to maintain the whitelist by the names actually in
the user's .json file, rather than worrying about the names
of implicit types.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-14-git-send-email-eblake@redhat.com>
[Simplified a bit as per discussion with Eric]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-02 06:20:57 +01:00
|
|
|
qapi-schema += enum-member-case.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += enum-missing-data.json
|
|
|
|
qapi-schema += enum-wrong-data.json
|
|
|
|
qapi-schema += escape-outside-string.json
|
|
|
|
qapi-schema += escape-too-big.json
|
|
|
|
qapi-schema += escape-too-short.json
|
2016-07-14 05:50:20 +02:00
|
|
|
qapi-schema += event-boxed-empty.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += event-case.json
|
2018-12-13 13:37:14 +01:00
|
|
|
qapi-schema += event-member-invalid-dict.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += event-nest-struct.json
|
|
|
|
qapi-schema += flat-union-array-branch.json
|
|
|
|
qapi-schema += flat-union-bad-base.json
|
|
|
|
qapi-schema += flat-union-bad-discriminator.json
|
|
|
|
qapi-schema += flat-union-base-any.json
|
|
|
|
qapi-schema += flat-union-base-union.json
|
qapi: Test for various name collisions
Expose some weaknesses in the generator: we don't always forbid
the generation of structs that contain multiple members that map
to the same C or QMP name. This has already been marked FIXME in
qapi.py in commit d90675f, but having more tests will make sure
future patches produce desired behavior; and updating existing
patches to better document things doesn't hurt, either. Some of
these collisions are already caught in the old-style parser
checks, but ultimately we want all collisions to be caught in the
new-style QAPISchema*.check() methods.
This patch focuses on C struct members, and does not consider
collisions between commands and events (affecting C function
names), or even collisions between generated C type names with
user type names (for things like automatic FOOList struct
representing array types or FOOKind for an implicit enum).
There are two types of struct collisions we want to catch:
1) Collision between two keys in a JSON object. qapi.py prevents
that within a single struct (see test duplicate-key), but it is
possible to have collisions between a type's members and its
base type's members (existing tests struct-base-clash,
struct-base-clash-deep), and its flat union variant members
(renamed test flat-union-clash-member).
2) Collision between two members of the C struct that is generated
for a given QAPI type:
a) Multiple QAPI names map to the same C name (new test
args-name-clash)
b) A QAPI name maps to a C name that is used for another purpose
(new tests flat-union-clash-branch, struct-base-clash-base,
union-clash-data). We already fixed some such cases in commit
0f61af3e and 1e6c1616, but more remain.
c) Two C names generated for other purposes clash
(updated test alternate-clash, new test union-clash-branches,
union-clash-type, flat-union-clash-type)
Ultimately, if we need to have a flat union where a tag value
clashes with a base member name, we could change the generator to
name the union (using 'foo.u.value' rather than 'foo.value') or
otherwise munge the C name corresponding to tag values. But
unless such a need arises, it will probably be easier to just
forbid these collisions.
Some of these negative tests will be deleted later, and positive
tests added to qapi-schema-test.json in their place, when the
generator code is reworked to avoid particular code generation
collisions in class 2).
[Note that viewing this patch with git rename detection enabled
may see some confusion due to renaming some tests while adding
others, but where the content is similar enough that git picks
the wrong pre- and post-patch files to associate]
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-6-git-send-email-eblake@redhat.com>
[Improve commit message and comments a bit, drop an unrelated test]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-30 00:21:03 +02:00
|
|
|
qapi-schema += flat-union-clash-member.json
|
qapi: Add tests for empty unions
The documentation claims that alternates are useful for
allowing two or more types, although nothing enforces this.
Meanwhile, it is silent on whether empty unions are allowed.
In practice, the generated code will compile, in part because
we have a 'void *data' branch; but attempting to visit such a
type will cause an abort(). While there's no technical reason
that a degenerate union could not be made to work, it's harder
to justify the time spent in chasing known (the current
abort() during visit) and unknown corner cases, than it would
be to just outlaw them. A future patch will probably take the
approach of forbidding them; in the meantime, we can at least
add testsuite coverage to make it obvious where things stand.
In addition to adding tests to expose the problems, we also
need to adjust existing tests that are meant to test something
else, but which could fail for the wrong reason if we reject
degenerate alternates/unions.
Note that empty structs are explicitly supported (for example,
right now they are the only way to specify that one branch of a
flat union adds no additional members), and empty enums are
covered by the testsuite as working (even if they do not seem
to have much use).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-8-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-30 00:21:05 +02:00
|
|
|
qapi-schema += flat-union-empty.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += flat-union-inline.json
|
2018-12-13 13:37:14 +01:00
|
|
|
qapi-schema += flat-union-inline-invalid-dict.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += flat-union-int-branch.json
|
|
|
|
qapi-schema += flat-union-invalid-branch-key.json
|
|
|
|
qapi-schema += flat-union-invalid-discriminator.json
|
2018-12-13 13:37:15 +01:00
|
|
|
qapi-schema += flat-union-invalid-if-discriminator.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += flat-union-no-base.json
|
|
|
|
qapi-schema += flat-union-optional-discriminator.json
|
|
|
|
qapi-schema += flat-union-string-discriminator.json
|
|
|
|
qapi-schema += funny-char.json
|
|
|
|
qapi-schema += ident-with-escape.json
|
|
|
|
qapi-schema += include-before-err.json
|
|
|
|
qapi-schema += include-cycle.json
|
2017-03-15 13:56:51 +01:00
|
|
|
qapi-schema += include-extra-junk.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += include-format-err.json
|
|
|
|
qapi-schema += include-nested-err.json
|
|
|
|
qapi-schema += include-no-file.json
|
|
|
|
qapi-schema += include-non-file.json
|
|
|
|
qapi-schema += include-relpath.json
|
|
|
|
qapi-schema += include-repetition.json
|
|
|
|
qapi-schema += include-self-cycle.json
|
|
|
|
qapi-schema += include-simple.json
|
|
|
|
qapi-schema += indented-expr.json
|
|
|
|
qapi-schema += leading-comma-list.json
|
|
|
|
qapi-schema += leading-comma-object.json
|
|
|
|
qapi-schema += missing-colon.json
|
|
|
|
qapi-schema += missing-comma-list.json
|
|
|
|
qapi-schema += missing-comma-object.json
|
|
|
|
qapi-schema += missing-type.json
|
|
|
|
qapi-schema += nested-struct-data.json
|
2018-12-13 13:37:14 +01:00
|
|
|
qapi-schema += nested-struct-data-invalid-dict.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += non-objects.json
|
2018-03-26 08:38:59 +02:00
|
|
|
qapi-schema += oob-test.json
|
2018-05-11 19:15:59 +02:00
|
|
|
qapi-schema += allow-preconfig-test.json
|
2017-03-15 13:56:51 +01:00
|
|
|
qapi-schema += pragma-doc-required-crap.json
|
|
|
|
qapi-schema += pragma-extra-junk.json
|
2017-03-15 13:56:55 +01:00
|
|
|
qapi-schema += pragma-name-case-whitelist-crap.json
|
2017-03-15 13:56:51 +01:00
|
|
|
qapi-schema += pragma-non-dict.json
|
2017-03-15 13:56:54 +01:00
|
|
|
qapi-schema += pragma-returns-whitelist-crap.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += qapi-schema-test.json
|
|
|
|
qapi-schema += quoted-structural-chars.json
|
|
|
|
qapi-schema += redefined-builtin.json
|
|
|
|
qapi-schema += redefined-command.json
|
|
|
|
qapi-schema += redefined-event.json
|
|
|
|
qapi-schema += redefined-type.json
|
tests/qapi-schema: Test for reserved names, empty struct
Add some testsuite coverage to ensure future patches are on
the right track:
Our current C representation of qapi arrays is done by appending
'List' to the element name; but we are not preventing the
creation of an object type with the same name. Add
reserved-type-list.json to test this. Then rename
enum-union-clash.json to reserved-type-kind.json to cover the
reservation that we DO detect, and shorten it to match the fact
that the name is reserved even if there is no clash.
We are failing to detect a collision between a dictionary member
and the implicit 'has_*' flag for another optional member. The
easiest fix would be for a future patch to reserve the entire
"has[-_]" namespace for member names (the collision is also
possible for branch names within flat unions, but only as long as
branch names can collide with (non-variant) members; however,
since future patches are about to remove that, it is not worth
testing here). Add reserved-member-has.json to test this.
A similar collision exists between a dictionary member where
c_name() munges what might otherwise be a reserved name to start
with 'q_', and another member explicitly starts with "q[-_]".
Again, the easiest solution for a future patch will be reserving
the entire namespace, but here for commands as well as members.
Add reserved-member-q.json and reserved-command-q.json to test
this; separate tests since arguably our munging of command 'unix'
to 'qmp_q_unix()' could be done without a q_, which is different
than the munging of a member 'unix' to 'foo.q_unix'.
Finally, our testsuite does not have any compilation coverage
of struct inheritance with empty qapi structs. Update
qapi-schema-test.json to test this.
Note that there is currently no technical reason to forbid type
name patterns from member names, or member name patterns from
types, since the two are not in the same namespace in C and
won't collide; but it's not worth adding positive tests of these
corner cases at this time, especially while there is other churn
pending in patches that rearrange which collisions actually
happen.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1445898903-12082-2-git-send-email-eblake@redhat.com>
[Commit message tweaked slightly]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-10-26 23:34:40 +01:00
|
|
|
qapi-schema += reserved-command-q.json
|
2015-11-18 09:52:56 +01:00
|
|
|
qapi-schema += reserved-enum-q.json
|
tests/qapi-schema: Test for reserved names, empty struct
Add some testsuite coverage to ensure future patches are on
the right track:
Our current C representation of qapi arrays is done by appending
'List' to the element name; but we are not preventing the
creation of an object type with the same name. Add
reserved-type-list.json to test this. Then rename
enum-union-clash.json to reserved-type-kind.json to cover the
reservation that we DO detect, and shorten it to match the fact
that the name is reserved even if there is no clash.
We are failing to detect a collision between a dictionary member
and the implicit 'has_*' flag for another optional member. The
easiest fix would be for a future patch to reserve the entire
"has[-_]" namespace for member names (the collision is also
possible for branch names within flat unions, but only as long as
branch names can collide with (non-variant) members; however,
since future patches are about to remove that, it is not worth
testing here). Add reserved-member-has.json to test this.
A similar collision exists between a dictionary member where
c_name() munges what might otherwise be a reserved name to start
with 'q_', and another member explicitly starts with "q[-_]".
Again, the easiest solution for a future patch will be reserving
the entire namespace, but here for commands as well as members.
Add reserved-member-q.json and reserved-command-q.json to test
this; separate tests since arguably our munging of command 'unix'
to 'qmp_q_unix()' could be done without a q_, which is different
than the munging of a member 'unix' to 'foo.q_unix'.
Finally, our testsuite does not have any compilation coverage
of struct inheritance with empty qapi structs. Update
qapi-schema-test.json to test this.
Note that there is currently no technical reason to forbid type
name patterns from member names, or member name patterns from
types, since the two are not in the same namespace in C and
won't collide; but it's not worth adding positive tests of these
corner cases at this time, especially while there is other churn
pending in patches that rearrange which collisions actually
happen.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1445898903-12082-2-git-send-email-eblake@redhat.com>
[Commit message tweaked slightly]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-10-26 23:34:40 +01:00
|
|
|
qapi-schema += reserved-member-has.json
|
|
|
|
qapi-schema += reserved-member-q.json
|
2015-10-26 23:35:02 +01:00
|
|
|
qapi-schema += reserved-member-u.json
|
2015-11-18 09:52:56 +01:00
|
|
|
qapi-schema += reserved-member-underscore.json
|
tests/qapi-schema: Test for reserved names, empty struct
Add some testsuite coverage to ensure future patches are on
the right track:
Our current C representation of qapi arrays is done by appending
'List' to the element name; but we are not preventing the
creation of an object type with the same name. Add
reserved-type-list.json to test this. Then rename
enum-union-clash.json to reserved-type-kind.json to cover the
reservation that we DO detect, and shorten it to match the fact
that the name is reserved even if there is no clash.
We are failing to detect a collision between a dictionary member
and the implicit 'has_*' flag for another optional member. The
easiest fix would be for a future patch to reserve the entire
"has[-_]" namespace for member names (the collision is also
possible for branch names within flat unions, but only as long as
branch names can collide with (non-variant) members; however,
since future patches are about to remove that, it is not worth
testing here). Add reserved-member-has.json to test this.
A similar collision exists between a dictionary member where
c_name() munges what might otherwise be a reserved name to start
with 'q_', and another member explicitly starts with "q[-_]".
Again, the easiest solution for a future patch will be reserving
the entire namespace, but here for commands as well as members.
Add reserved-member-q.json and reserved-command-q.json to test
this; separate tests since arguably our munging of command 'unix'
to 'qmp_q_unix()' could be done without a q_, which is different
than the munging of a member 'unix' to 'foo.q_unix'.
Finally, our testsuite does not have any compilation coverage
of struct inheritance with empty qapi structs. Update
qapi-schema-test.json to test this.
Note that there is currently no technical reason to forbid type
name patterns from member names, or member name patterns from
types, since the two are not in the same namespace in C and
won't collide; but it's not worth adding positive tests of these
corner cases at this time, especially while there is other churn
pending in patches that rearrange which collisions actually
happen.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1445898903-12082-2-git-send-email-eblake@redhat.com>
[Commit message tweaked slightly]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-10-26 23:34:40 +01:00
|
|
|
qapi-schema += reserved-type-kind.json
|
|
|
|
qapi-schema += reserved-type-list.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += returns-alternate.json
|
|
|
|
qapi-schema += returns-array-bad.json
|
|
|
|
qapi-schema += returns-dict.json
|
|
|
|
qapi-schema += returns-unknown.json
|
|
|
|
qapi-schema += returns-whitelist.json
|
|
|
|
qapi-schema += struct-base-clash-deep.json
|
|
|
|
qapi-schema += struct-base-clash.json
|
|
|
|
qapi-schema += struct-data-invalid.json
|
2018-12-13 13:37:14 +01:00
|
|
|
qapi-schema += struct-member-invalid-dict.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += struct-member-invalid.json
|
|
|
|
qapi-schema += trailing-comma-list.json
|
|
|
|
qapi-schema += trailing-comma-object.json
|
|
|
|
qapi-schema += type-bypass-bad-gen.json
|
|
|
|
qapi-schema += unclosed-list.json
|
|
|
|
qapi-schema += unclosed-object.json
|
|
|
|
qapi-schema += unclosed-string.json
|
|
|
|
qapi-schema += unicode-str.json
|
2017-03-15 13:56:57 +01:00
|
|
|
qapi-schema += union-base-empty.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += union-base-no-discriminator.json
|
qapi: Enforce (or whitelist) case conventions on qapi members
We document that members of enums and objects should be
'lower-case', although we were not enforcing it. We have to
whitelist a few pre-existing entities that violate the norms.
Add three new tests to expose the new error message, each of
which first uses the whitelisted name 'UuidInfo' to prove the
whitelist works, then triggers the failure (this is the same
pattern used in the existing returns-whitelist.json test).
Note that by adding this check, we have effectively forbidden
an entity with a case-insensitive clash of member names, for
any entity that is not on the whitelist (although there is
still the possibility to clash via '-' vs. '_').
Not done here: a future patch should also add naming convention
support and whitelist exceptions for command, event, and type
names.
The additions to QAPISchemaMember.check_clash() check whether
info['name'] is in the whitelist (the top-most entity name at
the point 'info' tracks), rather than self.owner (the type,
possibly implicit, that directly owns the member), because it
is easier to maintain the whitelist by the names actually in
the user's .json file, rather than worrying about the names
of implicit types.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1449033659-25497-14-git-send-email-eblake@redhat.com>
[Simplified a bit as per discussion with Eric]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-12-02 06:20:57 +01:00
|
|
|
qapi-schema += union-branch-case.json
|
2018-12-13 13:37:14 +01:00
|
|
|
qapi-schema += union-branch-invalid-dict.json
|
qapi: Test for various name collisions
Expose some weaknesses in the generator: we don't always forbid
the generation of structs that contain multiple members that map
to the same C or QMP name. This has already been marked FIXME in
qapi.py in commit d90675f, but having more tests will make sure
future patches produce desired behavior; and updating existing
patches to better document things doesn't hurt, either. Some of
these collisions are already caught in the old-style parser
checks, but ultimately we want all collisions to be caught in the
new-style QAPISchema*.check() methods.
This patch focuses on C struct members, and does not consider
collisions between commands and events (affecting C function
names), or even collisions between generated C type names with
user type names (for things like automatic FOOList struct
representing array types or FOOKind for an implicit enum).
There are two types of struct collisions we want to catch:
1) Collision between two keys in a JSON object. qapi.py prevents
that within a single struct (see test duplicate-key), but it is
possible to have collisions between a type's members and its
base type's members (existing tests struct-base-clash,
struct-base-clash-deep), and its flat union variant members
(renamed test flat-union-clash-member).
2) Collision between two members of the C struct that is generated
for a given QAPI type:
a) Multiple QAPI names map to the same C name (new test
args-name-clash)
b) A QAPI name maps to a C name that is used for another purpose
(new tests flat-union-clash-branch, struct-base-clash-base,
union-clash-data). We already fixed some such cases in commit
0f61af3e and 1e6c1616, but more remain.
c) Two C names generated for other purposes clash
(updated test alternate-clash, new test union-clash-branches,
union-clash-type, flat-union-clash-type)
Ultimately, if we need to have a flat union where a tag value
clashes with a base member name, we could change the generator to
name the union (using 'foo.u.value' rather than 'foo.value') or
otherwise munge the C name corresponding to tag values. But
unless such a need arises, it will probably be easier to just
forbid these collisions.
Some of these negative tests will be deleted later, and positive
tests added to qapi-schema-test.json in their place, when the
generator code is reworked to avoid particular code generation
collisions in class 2).
[Note that viewing this patch with git rename detection enabled
may see some confusion due to renaming some tests while adding
others, but where the content is similar enough that git picks
the wrong pre- and post-patch files to associate]
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-6-git-send-email-eblake@redhat.com>
[Improve commit message and comments a bit, drop an unrelated test]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-30 00:21:03 +02:00
|
|
|
qapi-schema += union-clash-branches.json
|
qapi: Add tests for empty unions
The documentation claims that alternates are useful for
allowing two or more types, although nothing enforces this.
Meanwhile, it is silent on whether empty unions are allowed.
In practice, the generated code will compile, in part because
we have a 'void *data' branch; but attempting to visit such a
type will cause an abort(). While there's no technical reason
that a degenerate union could not be made to work, it's harder
to justify the time spent in chasing known (the current
abort() during visit) and unknown corner cases, than it would
be to just outlaw them. A future patch will probably take the
approach of forbidding them; in the meantime, we can at least
add testsuite coverage to make it obvious where things stand.
In addition to adding tests to expose the problems, we also
need to adjust existing tests that are meant to test something
else, but which could fail for the wrong reason if we reject
degenerate alternates/unions.
Note that empty structs are explicitly supported (for example,
right now they are the only way to specify that one branch of a
flat union adds no additional members), and empty enums are
covered by the testsuite as working (even if they do not seem
to have much use).
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-8-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2015-09-30 00:21:05 +02:00
|
|
|
qapi-schema += union-empty.json
|
2015-09-30 00:20:59 +02:00
|
|
|
qapi-schema += union-invalid-base.json
|
|
|
|
qapi-schema += union-optional-branch.json
|
|
|
|
qapi-schema += union-unknown.json
|
|
|
|
qapi-schema += unknown-escape.json
|
|
|
|
qapi-schema += unknown-expr-key.json
|
qapi: add qapi2texi script
As the name suggests, the qapi2texi script converts JSON QAPI
description into a texi file suitable for different target
formats (info/man/txt/pdf/html...).
It parses the following kind of blocks:
Free-form:
##
# = Section
# == Subsection
#
# Some text foo with *emphasis*
# 1. with a list
# 2. like that
#
# And some code:
# | $ echo foo
# | -> do this
# | <- get that
#
##
Symbol description:
##
# @symbol:
#
# Symbol body ditto ergo sum. Foo bar
# baz ding.
#
# @param1: the frob to frobnicate
# @param2: #optional how hard to frobnicate
#
# Returns: the frobnicated frob.
# If frob isn't frobnicatable, GenericError.
#
# Since: version
# Notes: notes, comments can have
# - itemized list
# - like this
#
# Example:
#
# -> { "execute": "quit" }
# <- { "return": {} }
#
##
That's roughly following the following EBNF grammar:
api_comment = "##\n" comment "##\n"
comment = freeform_comment | symbol_comment
freeform_comment = { "# " text "\n" | "#\n" }
symbol_comment = "# @" name ":\n" { member | tag_section | freeform_comment }
member = "# @" name ':' [ text ] "\n" freeform_comment
tag_section = "# " ( "Returns:", "Since:", "Note:", "Notes:", "Example:", "Examples:" ) [ text ] "\n" freeform_comment
text = free text with markup
Note that the grammar is ambiguous: a line "# @foo:\n" can be parsed
both as freeform_comment and as symbol_comment. The actual parser
recognizes symbol_comment.
See docs/qapi-code-gen.txt for more details.
Deficiencies and limitations:
- the generated QMP documentation includes internal types
- union type support is lacking
- type information is lacking in generated documentation
- doc comment error message positions are imprecise, they point
to the beginning of the comment.
- a few minor issues, all marked TODO/FIXME in the code
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170113144135.5150-16-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[test-qapi.py tweaked to avoid trailing empty lines in .out]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2017-01-13 15:41:29 +01:00
|
|
|
|
|
|
|
|
2015-09-30 00:20:59 +02:00
|
|
|
check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
|
2013-07-27 17:41:53 +02:00
|
|
|
|
2017-02-28 13:29:00 +01:00
|
|
|
GENERATED_FILES += tests/test-qapi-types.h tests/test-qapi-visit.h \
|
2018-02-11 10:36:05 +01:00
|
|
|
tests/test-qapi-commands.h tests/test-qapi-events.h \
|
|
|
|
tests/test-qapi-introspect.h
|
2012-03-28 15:42:01 +02:00
|
|
|
|
2017-06-07 18:35:58 +02:00
|
|
|
test-obj-y = tests/check-qnum.o tests/check-qstring.o tests/check-qdict.o \
|
2017-11-14 19:01:28 +01:00
|
|
|
tests/check-qlist.o tests/check-qnull.o tests/check-qobject.o \
|
2017-08-25 12:59:09 +02:00
|
|
|
tests/check-qjson.o tests/check-qlit.o \
|
2018-06-14 21:14:29 +02:00
|
|
|
tests/check-block-qtest.o \
|
2012-03-28 15:42:01 +02:00
|
|
|
tests/test-coroutine.o tests/test-string-output-visitor.o \
|
2016-09-30 16:45:27 +02:00
|
|
|
tests/test-string-input-visitor.o tests/test-qobject-output-visitor.o \
|
qapi: Add new clone visitor
We have a couple places in the code base that want to deep-clone
one QAPI object into another, and they were resorting to serializing
the struct out to QObject then reparsing it. A much more efficient
version can be done by adding a new clone visitor.
Since cloning is still relatively uncommon, expose the use of the
new visitor via a QAPI_CLONE() macro that takes care of type-punning
the underlying function pointer, rather than generating lots of
unused functions for types that won't be cloned. And yes, we're
relying on the compiler treating all pointers equally, even though
a strict C program cannot portably do so - but we're not the first
one in the qemu code base to expect it to work (hello, glib!).
The choice of adding a fourth visitor type deserves some explanation.
On the surface, the clone visitor is mostly an input visitor (it
takes arbitrary input - in this case, another QAPI object - and
creates a new QAPI object during the course of the visit). But
ever since commit da72ab0 consolidated enum visits based on the
visitor type, using VISITOR_INPUT would cause us to run
visit_type_str(), even though for cloning there is nothing to do
(we just copy the enum value across, without regards to its mapping
to strings). Also, since our input happens to be a QAPI object,
we can also satisfy the internal checks for VISITOR_OUTPUT. So in
the end, I settled with a new VISITOR_CLONE, and chose its value
such that many internal checks can use 'v->type & mask', sticking
to 'v->type == value' where the difference matters.
Note that we can only clone objects (including alternates) and lists,
not built-ins or enums. The visitor core hides integer width from
the actual visitor (since commit 04e070d), and as long as that's the
case, we can't clone top-level integers. Then again, those can
always be cloned by direct copy, since they are not objects with
deep pointers, so it's no real loss. And restricting cloning to
just objects and lists is cleaner than restricting it to non-integers.
As such, I documented that the clone visitor is for direct use only
by code internal to QAPI, and should not be used on incomplete objects
(other than a hack to work around the fact that we allow NULL in place
of "" in visit_type_str() in other output visitors). Note that as
written, the clone visitor will never fail on a complete object.
Scalars (including enums) not at the root of the clone copy just fine
with no additional effort while visiting the scalar, by virtue of a
g_memdup() each time we push another struct onto the stack. Cloning
a string requires deduplication of a pointer, which means it can also
provide the guarantee of an input visitor of never producing NULL
even when still accepting NULL in place of "" the way the QMP output
visitor does.
Cloning an 'any' type could be possible by incrementing the QObject
refcnt, but it's not obvious whether that is better than implementing
a QObject deep clone. So for now, we document it as unsupported,
and intentionally omit the .type_any() callback to let a developer
know their usage needs implementation.
Add testsuite coverage for several different clone situations, to
ensure that the code is working. I also tested that valgrind was
happy with the test.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1465490926-28625-14-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-06-09 18:48:44 +02:00
|
|
|
tests/test-clone-visitor.o \
|
2017-03-03 13:32:40 +01:00
|
|
|
tests/test-qobject-input-visitor.o \
|
2018-02-11 10:35:56 +01:00
|
|
|
tests/test-qmp-cmds.o tests/test-visitor-serialization.o \
|
2013-08-20 00:35:40 +02:00
|
|
|
tests/test-x86-cpuid.o tests/test-mul64.o tests/test-int128.o \
|
2013-06-21 09:09:34 +02:00
|
|
|
tests/test-opts-visitor.o tests/test-qmp-event.o \
|
2016-06-08 20:55:27 +02:00
|
|
|
tests/rcutorture.o tests/test-rcu-list.o \
|
2018-08-19 11:13:32 +02:00
|
|
|
tests/test-rcu-simpleq.o \
|
2018-08-19 11:13:33 +02:00
|
|
|
tests/test-rcu-tailq.o \
|
2017-01-10 03:10:09 +01:00
|
|
|
tests/test-qdist.o tests/test-shift128.o \
|
2016-06-27 21:02:05 +02:00
|
|
|
tests/test-qht.o tests/qht-bench.o tests/test-qht-par.o \
|
2018-09-11 01:27:43 +02:00
|
|
|
tests/atomic_add-bench.o tests/atomic64-bench.o
|
2012-03-28 15:42:01 +02:00
|
|
|
|
|
|
|
$(test-obj-y): QEMU_INCLUDES += -Itests
|
2013-04-16 16:45:16 +02:00
|
|
|
QEMU_CFLAGS += -I$(SRC_PATH)/tests
|
2012-03-28 15:42:01 +02:00
|
|
|
|
2015-09-02 12:35:52 +02:00
|
|
|
|
|
|
|
# Deps that are common to various different sets of tests below
|
2017-09-19 16:20:31 +02:00
|
|
|
test-util-obj-y = libqemuutil.a
|
2015-09-02 12:18:16 +02:00
|
|
|
test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
|
qapi: Eliminate indirection through qmp_event_get_func_emit()
The qapi_event_send_FOO() functions emit events like this:
QMPEventFuncEmit emit;
emit = qmp_event_get_func_emit();
if (!emit) {
return;
}
qmp = qmp_event_build_dict("FOO");
[put event arguments into @qmp...]
emit(QAPI_EVENT_FOO, qmp);
The value of qmp_event_get_func_emit() depends only on the program:
* In qemu-system-FOO, it's always monitor_qapi_event_queue.
* In tests/test-qmp-event, it's always event_test_emit.
* In all other programs, it's always null.
This is exactly the kind of dependence the linker is supposed to
resolve; we don't actually need an indirection.
Note that things would fall apart if we linked more than one QAPI
schema into a single program: each set of qapi_event_send_FOO() uses
its own event enumeration, yet they share a single emit function.
Which takes the event enumeration as an argument. Which one if
there's more than one?
More seriously: how does this work even now? qemu-system-FOO wants
QAPIEvent, and passes a function taking that to
qmp_event_set_func_emit(). test-qmp-event wants test_QAPIEvent, and
passes a function taking that to qmp_event_set_func_emit().
It works by type trickery, of course:
typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict);
void qmp_event_set_func_emit(QMPEventFuncEmit emit);
QMPEventFuncEmit qmp_event_get_func_emit(void);
We use unsigned instead of the enumeration type. Relies on both
enumerations boiling down to unsigned, which happens to be true for
the compilers we use.
Clean this up as follows:
* Generate qapi_event_send_FOO() that call PREFIX_qapi_event_emit()
instead of the value of qmp_event_set_func_emit().
* Generate a prototype for PREFIX_qapi_event_emit() into
qapi-events.h.
* PREFIX_ is empty for qapi/qapi-schema.json, and test_ for
tests/qapi-schema/qapi-schema-test.json. It's qga_ for
qga/qapi-schema.json, and doc-good- for
tests/qapi-schema/doc-good.json, but those don't define any events.
* Rename monitor_qapi_event_queue() to qapi_event_emit() instead of
passing it to qmp_event_set_func_emit(). This takes care of
qemu-system-FOO.
* Rename event_test_emit() to test_qapi_event_emit() instead of
passing it to qmp_event_set_func_emit(). This takes care of
tests/test-qmp-event.
* Add a qapi_event_emit() that does nothing to stubs/monitor.c. This
takes care of all other programs that link code emitting QMP events.
* Drop qmp_event_set_func_emit(), qmp_event_get_func_emit().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181218182234.28876-3-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[Commit message typos fixed]
2018-12-18 19:22:21 +01:00
|
|
|
tests/test-qapi-introspect.o \
|
2015-09-02 12:35:52 +02:00
|
|
|
$(test-qom-obj-y)
|
2017-07-14 20:04:09 +02:00
|
|
|
benchmark-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
|
2015-03-13 18:39:26 +01:00
|
|
|
test-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
|
2015-03-18 18:25:45 +01:00
|
|
|
test-io-obj-y = $(io-obj-y) $(test-crypto-obj-y)
|
2017-02-13 14:52:19 +01:00
|
|
|
test-block-obj-y = $(block-obj-y) $(test-io-obj-y) tests/iothread.o
|
2015-09-02 12:35:52 +02:00
|
|
|
|
2017-06-07 18:35:58 +02:00
|
|
|
tests/check-qnum$(EXESUF): tests/check-qnum.o $(test-util-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/check-qstring$(EXESUF): tests/check-qstring.o $(test-util-obj-y)
|
|
|
|
tests/check-qdict$(EXESUF): tests/check-qdict.o $(test-util-obj-y)
|
2018-06-14 21:14:29 +02:00
|
|
|
tests/check-block-qdict$(EXESUF): tests/check-block-qdict.o $(test-util-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/check-qlist$(EXESUF): tests/check-qlist.o $(test-util-obj-y)
|
2016-04-28 23:45:21 +02:00
|
|
|
tests/check-qnull$(EXESUF): tests/check-qnull.o $(test-util-obj-y)
|
2017-11-14 19:01:28 +01:00
|
|
|
tests/check-qobject$(EXESUF): tests/check-qobject.o $(test-util-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/check-qjson$(EXESUF): tests/check-qjson.o $(test-util-obj-y)
|
2017-08-25 12:59:09 +02:00
|
|
|
tests/check-qlit$(EXESUF): tests/check-qlit.o $(test-util-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(test-qom-obj-y)
|
|
|
|
tests/check-qom-proplist$(EXESUF): tests/check-qom-proplist.o $(test-qom-obj-y)
|
2016-10-22 11:53:00 +02:00
|
|
|
|
2017-02-13 14:52:18 +01:00
|
|
|
tests/test-char$(EXESUF): tests/test-char.o $(test-util-obj-y) $(qtest-obj-y) $(test-io-obj-y) $(chardev-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(test-block-obj-y)
|
|
|
|
tests/test-aio$(EXESUF): tests/test-aio.o $(test-block-obj-y)
|
2017-02-13 14:52:19 +01:00
|
|
|
tests/test-aio-multithread$(EXESUF): tests/test-aio-multithread.o $(test-block-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-throttle$(EXESUF): tests/test-throttle.o $(test-block-obj-y)
|
2017-12-05 14:05:02 +01:00
|
|
|
tests/test-bdrv-drain$(EXESUF): tests/test-bdrv-drain.o $(test-block-obj-y) $(test-util-obj-y)
|
2019-02-23 20:20:41 +01:00
|
|
|
tests/test-bdrv-graph-mod$(EXESUF): tests/test-bdrv-graph-mod.o $(test-block-obj-y) $(test-util-obj-y)
|
2016-07-29 16:31:41 +02:00
|
|
|
tests/test-blockjob$(EXESUF): tests/test-blockjob.o $(test-block-obj-y) $(test-util-obj-y)
|
2015-11-06 00:13:20 +01:00
|
|
|
tests/test-blockjob-txn$(EXESUF): tests/test-blockjob-txn.o $(test-block-obj-y) $(test-util-obj-y)
|
2018-02-16 17:50:14 +01:00
|
|
|
tests/test-block-backend$(EXESUF): tests/test-block-backend.o $(test-block-obj-y) $(test-util-obj-y)
|
block: Fix hangs in synchronous APIs with iothreads
In the block layer, synchronous APIs are often implemented by creating a
coroutine that calls the asynchronous coroutine-based implementation and
then waiting for completion with BDRV_POLL_WHILE().
For this to work with iothreads (more specifically, when the synchronous
API is called in a thread that is not the home thread of the block
device, so that the coroutine will run in a different thread), we must
make sure to call aio_wait_kick() at the end of the operation. Many
places are missing this, so that BDRV_POLL_WHILE() keeps hanging even if
the condition has long become false.
Note that bdrv_dec_in_flight() involves an aio_wait_kick() call. This
corresponds to the BDRV_POLL_WHILE() in the drain functions, but it is
generally not enough for most other operations because they haven't set
the return value in the coroutine entry stub yet. To avoid race
conditions there, we need to kick after setting the return value.
The race window is small enough that the problem doesn't usually surface
in the common path. However, it does surface and causes easily
reproducible hangs if the operation can return early before even calling
bdrv_inc/dec_in_flight, which many of them do (trivial error or no-op
success paths).
The bug in bdrv_truncate(), bdrv_check() and bdrv_invalidate_cache() is
slightly different: These functions even neglected to schedule the
coroutine in the home thread of the node. This avoids the hang, but is
obviously wrong, too. Fix those to schedule the coroutine in the right
AioContext in addition to adding aio_wait_kick() calls.
Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-01-07 13:02:48 +01:00
|
|
|
tests/test-block-iothread$(EXESUF): tests/test-block-iothread.o $(test-block-obj-y) $(test-util-obj-y)
|
2018-10-11 09:21:35 +02:00
|
|
|
tests/test-image-locking$(EXESUF): tests/test-image-locking.o $(test-block-obj-y) $(test-util-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
|
|
|
|
tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
|
2017-06-28 14:05:25 +02:00
|
|
|
tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y) $(test-crypto-obj-y)
|
2013-01-23 18:58:27 +01:00
|
|
|
tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
|
2017-04-20 12:37:23 +02:00
|
|
|
tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)
|
2017-08-18 20:47:35 +02:00
|
|
|
tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o $(test-util-obj-y)
|
2013-06-20 16:19:32 +02:00
|
|
|
tests/test-int128$(EXESUF): tests/test-int128.o
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
|
|
|
|
tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y)
|
2018-08-19 11:13:32 +02:00
|
|
|
tests/test-rcu-simpleq$(EXESUF): tests/test-rcu-simpleq.o $(test-util-obj-y)
|
2018-08-19 11:13:33 +02:00
|
|
|
tests/test-rcu-tailq$(EXESUF): tests/test-rcu-tailq.o $(test-util-obj-y)
|
2016-06-08 20:55:27 +02:00
|
|
|
tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y)
|
2016-06-08 20:55:29 +02:00
|
|
|
tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y)
|
2016-06-08 20:55:31 +02:00
|
|
|
tests/test-qht-par$(EXESUF): tests/test-qht-par.o tests/qht-bench$(EXESUF) $(test-util-obj-y)
|
qht: add qht-bench, a performance benchmark
This serves as a performance benchmark as well as a stress test
for QHT. We can tweak quite a number of things, including the
number of resize threads and how frequently resizes are triggered.
A performance comparison of QHT vs CLHT[1] and ck_hs[2] using
this same benchmark program can be found here:
http://imgur.com/a/0Bms4
The tests are run on a 64-core AMD Opteron 6376, pinning threads
to cores favoring same-socket cores. For each run, qht-bench is
invoked with:
$ tests/qht-bench -d $duration -n $n -u $u -g $range
, where $duration is in seconds, $n is the number of threads,
$u is the update rate (0.0 to 100.0), and $range is the number
of keys.
Note that ck_hs's performance drops significantly as writes go
up, since it requires an external lock (I used a ck_spinlock)
around every write.
Also, note that CLHT instead of using a seqlock, relies on an
allocator that does not ever return the same address during the
same read-critical section. This gives it a slight performance
advantage over QHT on read-heavy workloads, since the seqlock
writes aren't there.
[1] CLHT: https://github.com/LPD-EPFL/CLHT
https://infoscience.epfl.ch/record/207109/files/ascy_asplos15.pdf
[2] ck_hs: http://concurrencykit.org/
http://backtrace.io/blog/blog/2015/03/13/workload-specialization/
A few of those plots are shown in text here, since that site
might not be online forever. Throughput is on Mops/s on the Y axis.
200K keys, 0 % updates
450 ++--+------+------+-------+-------+-------+-------+------+-------+--++
| + + + + + + + + +N+ |
400 ++ ---+E+ ++
| +++---- |
350 ++ 9 ++------+------++ --+E+ -+H+ ++
| | +H+- | -+N+---- ---- +++ |
300 ++ 8 ++ +E+ ++ -----+E+ --+H+ ++
| | +++ | -+N+-----+H+-- |
250 ++ 7 ++------+------++ +++-----+E+---- ++
200 ++ 1 -+E+-----+H+ ++
| ---- qht +-E--+ |
150 ++ -+E+ clht +-H--+ ++
| ---- ck +-N--+ |
100 ++ +E+ ++
| ---- |
50 ++ -+E+ ++
| +E+E+ + + + + + + + + |
0 ++--E------+------+-------+-------+-------+-------+------+-------+--++
1 8 16 24 32 40 48 56 64
Number of threads
200K keys, 1 % updates
350 ++--+------+------+-------+-------+-------+-------+------+-------+--++
| + + + + + + + + -+E+ |
300 ++ -----+H+ ++
| +E+-- |
| 9 ++------+------++ +++---- |
250 ++ | +E+ -- | -+E+ ++
| 8 ++ -- ++ ---- |
200 ++ | +++- | +++ ---+E+ ++
| 7 ++------N------++ -+E+-- qht +-E--+ |
| 1 +++---- clht +-H--+ |
150 ++ -+E+ ck +-N--+ ++
| ---- |
100 ++ +E+ ++
| ---- |
| -+E+ |
50 ++ +H+-+N+----+N+-----+N+------ ++
| +E+E+ + + + +N+-----+N+-----+N+----+N+-----+N+ |
0 ++--E------+------+-------+-------+-------+-------+------+-------+--++
1 8 16 24 32 40 48 56 64
Number of threads
200K keys, 20 % updates
300 ++--+------+------+-------+-------+-------+-------+------+-------+--++
| + + + + + + + + + |
| -+H+ |
250 ++ ---- ++
| 9 ++------+------++ --+H+ ---+E+ |
| 8 ++ +H+-- ++ -+H+----+E+-- |
200 ++ | +E+ --| -----+E+-- +++ ++
| 7 ++ + ---- ++ ---+H+---- +++ qht +-E--+ |
150 ++ 6 ++------N------++ -+H+-----+E+ clht +-H--+ ++
| 1 -----+E+-- ck +-N--+ |
| -+H+---- |
100 ++ -----+E+ ++
| +E+-- |
| ----+++ |
50 ++ -+E+ ++
| +E+ +++ |
| +E+N+-+N+-----+ + + + + + + |
0 ++--E------+------N-------N-------N-------N-------N------N-------N--++
1 8 16 24 32 40 48 56 64
Number of threads
200K keys, 100 % updates qht +-E--+
clht +-H--+
160 ++--+------+------+-------+-------+-------+-------+---ck-+-N-----+--++
| + + + + + + + + ----H |
140 ++ +H+-- -+E+ ++
| +++---- ---- |
120 ++ 8 ++------+------++ -+H+ +E+ ++
| 7 ++ +H+---- ++ ---- +++---- |
100 ++ | +E+ | +++ ---+H+ -+E+ ++
| 6 ++ +++ ++ -+H+-- +++---- |
80 ++ 5 ++------N----------+E+-----+E+ ++
| 1 -+H+---- +++ |
| -----+E+ |
60 ++ +H+---- +++ ++
| ----+E+ |
40 ++ +H+---- ++
| --+E+ |
20 ++ +E+ ++
| +EE+ + + + + + + + + |
0 ++--+N-N---N------N-------N-------N-------N-------N------N-------N--++
1 8 16 24 32 40 48 56 64
Number of threads
Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <1465412133-3029-13-git-send-email-cota@braap.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
2016-06-08 20:55:30 +02:00
|
|
|
tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y)
|
2016-08-29 20:46:16 +02:00
|
|
|
tests/test-bufferiszero$(EXESUF): tests/test-bufferiszero.o $(test-util-obj-y)
|
2016-06-27 21:02:05 +02:00
|
|
|
tests/atomic_add-bench$(EXESUF): tests/atomic_add-bench.o $(test-util-obj-y)
|
2018-09-11 01:27:43 +02:00
|
|
|
tests/atomic64-bench$(EXESUF): tests/atomic64-bench.o $(test-util-obj-y)
|
2013-06-21 09:09:34 +02:00
|
|
|
|
2018-03-09 03:09:40 +01:00
|
|
|
tests/fp/%:
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
|
|
|
|
2013-07-10 22:08:40 +02:00
|
|
|
tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
|
2014-02-05 16:36:52 +01:00
|
|
|
hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
|
2015-07-13 19:35:41 +02:00
|
|
|
hw/core/bus.o \
|
2013-07-10 22:08:40 +02:00
|
|
|
hw/core/irq.o \
|
2014-03-17 03:40:23 +01:00
|
|
|
hw/core/fw-path-provider.o \
|
2016-10-24 11:19:49 +02:00
|
|
|
hw/core/reset.o \
|
2015-09-02 12:35:52 +02:00
|
|
|
$(test-qapi-obj-y)
|
2013-11-28 15:01:18 +01:00
|
|
|
tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
|
2017-04-20 13:41:20 +02:00
|
|
|
migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \
|
2016-04-27 12:05:08 +02:00
|
|
|
migration/qemu-file-channel.o migration/qjson.o \
|
|
|
|
$(test-io-obj-y)
|
2017-02-13 14:52:18 +01:00
|
|
|
tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
|
2017-09-19 16:20:31 +02:00
|
|
|
tests/test-base64$(EXESUF): tests/test-base64.o $(test-util-obj-y)
|
2017-09-19 16:18:42 +02:00
|
|
|
tests/ptimer-test$(EXESUF): tests/ptimer-test.o tests/ptimer-test-stubs.o hw/core/ptimer.o
|
2012-03-28 15:42:01 +02:00
|
|
|
|
2016-03-15 15:30:20 +01:00
|
|
|
tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y)
|
|
|
|
|
2016-07-27 09:01:51 +02:00
|
|
|
tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
|
|
|
|
$(test-block-obj-y)
|
|
|
|
|
2018-02-26 20:48:58 +01:00
|
|
|
tests/test-qapi-types.c tests/test-qapi-types.h \
|
|
|
|
tests/test-qapi-visit.c tests/test-qapi-visit.h \
|
2018-02-11 10:36:05 +01:00
|
|
|
tests/test-qapi-commands.h tests/test-qapi-commands.c \
|
|
|
|
tests/test-qapi-events.c tests/test-qapi-events.h \
|
|
|
|
tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
|
2018-02-26 20:48:58 +01:00
|
|
|
tests/test-qapi-gen-timestamp ;
|
|
|
|
tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py)
|
2018-06-18 19:59:58 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
|
2018-02-26 20:48:58 +01:00
|
|
|
-o tests -p "test-" $<, \
|
|
|
|
"GEN","$(@:%-timestamp=%)")
|
|
|
|
@>$@
|
|
|
|
|
|
|
|
tests/qapi-schema/doc-good.test.texi: $(SRC_PATH)/tests/qapi-schema/doc-good.json $(qapi-py)
|
2018-06-18 19:59:58 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
|
2018-02-26 20:48:58 +01:00
|
|
|
-o tests/qapi-schema -p "doc-good-" $<, \
|
2016-10-04 18:27:21 +02:00
|
|
|
"GEN","$@")
|
2018-02-26 20:48:58 +01:00
|
|
|
@mv tests/qapi-schema/doc-good-qapi-doc.texi $@
|
|
|
|
@rm -f tests/qapi-schema/doc-good-qapi-*.[ch] tests/qapi-schema/doc-good-qmp-*.[ch]
|
2017-03-20 14:11:54 +01:00
|
|
|
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y)
|
|
|
|
tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y)
|
qapi: Eliminate indirection through qmp_event_get_func_emit()
The qapi_event_send_FOO() functions emit events like this:
QMPEventFuncEmit emit;
emit = qmp_event_get_func_emit();
if (!emit) {
return;
}
qmp = qmp_event_build_dict("FOO");
[put event arguments into @qmp...]
emit(QAPI_EVENT_FOO, qmp);
The value of qmp_event_get_func_emit() depends only on the program:
* In qemu-system-FOO, it's always monitor_qapi_event_queue.
* In tests/test-qmp-event, it's always event_test_emit.
* In all other programs, it's always null.
This is exactly the kind of dependence the linker is supposed to
resolve; we don't actually need an indirection.
Note that things would fall apart if we linked more than one QAPI
schema into a single program: each set of qapi_event_send_FOO() uses
its own event enumeration, yet they share a single emit function.
Which takes the event enumeration as an argument. Which one if
there's more than one?
More seriously: how does this work even now? qemu-system-FOO wants
QAPIEvent, and passes a function taking that to
qmp_event_set_func_emit(). test-qmp-event wants test_QAPIEvent, and
passes a function taking that to qmp_event_set_func_emit().
It works by type trickery, of course:
typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict);
void qmp_event_set_func_emit(QMPEventFuncEmit emit);
QMPEventFuncEmit qmp_event_get_func_emit(void);
We use unsigned instead of the enumeration type. Relies on both
enumerations boiling down to unsigned, which happens to be true for
the compilers we use.
Clean this up as follows:
* Generate qapi_event_send_FOO() that call PREFIX_qapi_event_emit()
instead of the value of qmp_event_set_func_emit().
* Generate a prototype for PREFIX_qapi_event_emit() into
qapi-events.h.
* PREFIX_ is empty for qapi/qapi-schema.json, and test_ for
tests/qapi-schema/qapi-schema-test.json. It's qga_ for
qga/qapi-schema.json, and doc-good- for
tests/qapi-schema/doc-good.json, but those don't define any events.
* Rename monitor_qapi_event_queue() to qapi_event_emit() instead of
passing it to qmp_event_set_func_emit(). This takes care of
qemu-system-FOO.
* Rename event_test_emit() to test_qapi_event_emit() instead of
passing it to qmp_event_set_func_emit(). This takes care of
tests/test-qmp-event.
* Add a qapi_event_emit() that does nothing to stubs/monitor.c. This
takes care of all other programs that link code emitting QMP events.
* Drop qmp_event_set_func_emit(), qmp_event_get_func_emit().
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181218182234.28876-3-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[Commit message typos fixed]
2018-12-18 19:22:21 +01:00
|
|
|
tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) tests/test-qapi-events.o
|
2016-09-30 16:45:27 +02:00
|
|
|
tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
|
qapi: Add new clone visitor
We have a couple places in the code base that want to deep-clone
one QAPI object into another, and they were resorting to serializing
the struct out to QObject then reparsing it. A much more efficient
version can be done by adding a new clone visitor.
Since cloning is still relatively uncommon, expose the use of the
new visitor via a QAPI_CLONE() macro that takes care of type-punning
the underlying function pointer, rather than generating lots of
unused functions for types that won't be cloned. And yes, we're
relying on the compiler treating all pointers equally, even though
a strict C program cannot portably do so - but we're not the first
one in the qemu code base to expect it to work (hello, glib!).
The choice of adding a fourth visitor type deserves some explanation.
On the surface, the clone visitor is mostly an input visitor (it
takes arbitrary input - in this case, another QAPI object - and
creates a new QAPI object during the course of the visit). But
ever since commit da72ab0 consolidated enum visits based on the
visitor type, using VISITOR_INPUT would cause us to run
visit_type_str(), even though for cloning there is nothing to do
(we just copy the enum value across, without regards to its mapping
to strings). Also, since our input happens to be a QAPI object,
we can also satisfy the internal checks for VISITOR_OUTPUT. So in
the end, I settled with a new VISITOR_CLONE, and chose its value
such that many internal checks can use 'v->type & mask', sticking
to 'v->type == value' where the difference matters.
Note that we can only clone objects (including alternates) and lists,
not built-ins or enums. The visitor core hides integer width from
the actual visitor (since commit 04e070d), and as long as that's the
case, we can't clone top-level integers. Then again, those can
always be cloned by direct copy, since they are not objects with
deep pointers, so it's no real loss. And restricting cloning to
just objects and lists is cleaner than restricting it to non-integers.
As such, I documented that the clone visitor is for direct use only
by code internal to QAPI, and should not be used on incomplete objects
(other than a hack to work around the fact that we allow NULL in place
of "" in visit_type_str() in other output visitors). Note that as
written, the clone visitor will never fail on a complete object.
Scalars (including enums) not at the root of the clone copy just fine
with no additional effort while visiting the scalar, by virtue of a
g_memdup() each time we push another struct onto the stack. Cloning
a string requires deduplication of a pointer, which means it can also
provide the guarantee of an input visitor of never producing NULL
even when still accepting NULL in place of "" the way the QMP output
visitor does.
Cloning an 'any' type could be possible by incrementing the QObject
refcnt, but it's not obvious whether that is better than implementing
a QObject deep clone. So for now, we document it as unsupported,
and intentionally omit the .type_any() callback to let a developer
know their usage needs implementation.
Add testsuite coverage for several different clone situations, to
ensure that the code is working. I also tested that valgrind was
happy with the test.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1465490926-28625-14-git-send-email-eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-06-09 18:48:44 +02:00
|
|
|
tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
|
2016-09-30 16:45:27 +02:00
|
|
|
tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
|
2018-02-11 10:36:05 +01:00
|
|
|
tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o $(test-qapi-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
|
|
|
|
tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
|
2012-02-09 11:21:03 +01:00
|
|
|
|
2017-01-10 03:10:09 +01:00
|
|
|
tests/test-shift128$(EXESUF): tests/test-shift128.o $(test-util-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-mul64$(EXESUF): tests/test-mul64.o $(test-util-obj-y)
|
|
|
|
tests/test-bitops$(EXESUF): tests/test-bitops.o $(test-util-obj-y)
|
2016-12-09 15:36:00 +01:00
|
|
|
tests/test-bitcnt$(EXESUF): tests/test-bitcnt.o $(test-util-obj-y)
|
2015-09-02 11:57:27 +02:00
|
|
|
tests/test-crypto-hash$(EXESUF): tests/test-crypto-hash.o $(test-crypto-obj-y)
|
2017-07-14 20:04:10 +02:00
|
|
|
tests/benchmark-crypto-hash$(EXESUF): tests/benchmark-crypto-hash.o $(test-crypto-obj-y)
|
2016-12-13 11:43:00 +01:00
|
|
|
tests/test-crypto-hmac$(EXESUF): tests/test-crypto-hmac.o $(test-crypto-obj-y)
|
2017-07-14 20:04:11 +02:00
|
|
|
tests/benchmark-crypto-hmac$(EXESUF): tests/benchmark-crypto-hmac.o $(test-crypto-obj-y)
|
2015-09-02 11:57:27 +02:00
|
|
|
tests/test-crypto-cipher$(EXESUF): tests/test-crypto-cipher.o $(test-crypto-obj-y)
|
2017-07-14 20:04:09 +02:00
|
|
|
tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-crypto-obj-y)
|
crypto: add QCryptoSecret object class for password/key handling
Introduce a new QCryptoSecret object class which will be used
for providing passwords and keys to other objects which need
sensitive credentials.
The new object can provide secret values directly as properties,
or indirectly via a file. The latter includes support for file
descriptor passing syntax on UNIX platforms. Ordinarily passing
secret values directly as properties is insecure, since they
are visible in process listings, or in log files showing the
CLI args / QMP commands. It is possible to use AES-256-CBC to
encrypt the secret values though, in which case all that is
visible is the ciphertext. For ad hoc developer testing though,
it is fine to provide the secrets directly without encryption
so this is not explicitly forbidden.
The anticipated scenario is that libvirtd will create a random
master key per QEMU instance (eg /var/run/libvirt/qemu/$VMNAME.key)
and will use that key to encrypt all passwords it provides to
QEMU via '-object secret,....'. This avoids the need for libvirt
(or other mgmt apps) to worry about file descriptor passing.
It also makes life easier for people who are scripting the
management of QEMU, for whom FD passing is significantly more
complex.
Providing data inline (insecure, only for ad hoc dev testing)
$QEMU -object secret,id=sec0,data=letmein
Providing data indirectly in raw format
printf "letmein" > mypasswd.txt
$QEMU -object secret,id=sec0,file=mypasswd.txt
Providing data indirectly in base64 format
$QEMU -object secret,id=sec0,file=mykey.b64,format=base64
Providing data with encryption
$QEMU -object secret,id=master0,file=mykey.b64,format=base64 \
-object secret,id=sec0,data=[base64 ciphertext],\
keyid=master0,iv=[base64 IV],format=base64
Note that 'format' here refers to the format of the ciphertext
data. The decrypted data must always be in raw byte format.
More examples are shown in the updated docs.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2015-10-14 10:58:38 +02:00
|
|
|
tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y)
|
2016-02-11 15:00:17 +01:00
|
|
|
tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y)
|
2015-09-21 18:25:34 +02:00
|
|
|
|
|
|
|
tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS)
|
|
|
|
tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS)
|
|
|
|
tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS)
|
|
|
|
|
|
|
|
tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS)
|
2015-04-13 15:01:39 +02:00
|
|
|
tests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \
|
|
|
|
tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y)
|
2015-09-21 18:25:34 +02:00
|
|
|
|
|
|
|
tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS)
|
2015-03-02 18:23:31 +01:00
|
|
|
tests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \
|
crypto: Implement TLS Pre-Shared Keys (PSK).
Pre-Shared Keys (PSK) is a simpler mechanism for enabling TLS
connections than using certificates. It requires only a simple secret
key:
$ mkdir -m 0700 /tmp/keys
$ psktool -u rjones -p /tmp/keys/keys.psk
$ cat /tmp/keys/keys.psk
rjones:d543770c15ad93d76443fb56f501a31969235f47e999720ae8d2336f6a13fcbc
The key can be secretly shared between clients and servers. Clients
must specify the directory containing the "keys.psk" file and a
username (defaults to "qemu"). Servers must specify only the
directory.
Example NBD client:
$ qemu-img info \
--object tls-creds-psk,id=tls0,dir=/tmp/keys,username=rjones,endpoint=client \
--image-opts \
file.driver=nbd,file.host=localhost,file.port=10809,file.tls-creds=tls0,file.export=/
Example NBD server using qemu-nbd:
$ qemu-nbd -t -x / \
--object tls-creds-psk,id=tls0,endpoint=server,dir=/tmp/keys \
--tls-creds tls0 \
image.qcow2
Example NBD server using nbdkit:
$ nbdkit -n -e / -fv \
--tls=on --tls-psk=/tmp/keys/keys.psk \
file file=disk.img
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-03 10:03:03 +02:00
|
|
|
tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
|
|
|
|
tests/crypto-tls-psk-helpers.o \
|
|
|
|
$(test-crypto-obj-y)
|
2017-12-21 13:55:20 +01:00
|
|
|
tests/test-util-sockets$(EXESUF): tests/test-util-sockets.o \
|
|
|
|
tests/socket-helpers.o $(test-util-obj-y)
|
2015-03-18 18:25:45 +01:00
|
|
|
tests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
|
2015-02-27 17:19:33 +01:00
|
|
|
tests/test-io-channel-socket$(EXESUF): tests/test-io-channel-socket.o \
|
2017-12-22 12:45:24 +01:00
|
|
|
tests/io-channel-helpers.o tests/socket-helpers.o $(test-io-obj-y)
|
2018-03-07 20:45:06 +01:00
|
|
|
tests/tpm-crb-swtpm-test$(EXESUF): tests/tpm-crb-swtpm-test.o tests/tpm-emu.o \
|
2018-05-30 18:30:26 +02:00
|
|
|
tests/tpm-util.o tests/tpm-tests.o $(test-io-obj-y)
|
2018-02-15 14:53:56 +01:00
|
|
|
tests/tpm-crb-test$(EXESUF): tests/tpm-crb-test.o tests/tpm-emu.o $(test-io-obj-y)
|
2018-05-30 19:44:41 +02:00
|
|
|
tests/tpm-tis-swtpm-test$(EXESUF): tests/tpm-tis-swtpm-test.o tests/tpm-emu.o \
|
|
|
|
tests/tpm-util.o tests/tpm-tests.o $(test-io-obj-y)
|
2018-02-15 01:51:48 +01:00
|
|
|
tests/tpm-tis-test$(EXESUF): tests/tpm-tis-test.o tests/tpm-emu.o $(test-io-obj-y)
|
2015-02-27 19:25:25 +01:00
|
|
|
tests/test-io-channel-file$(EXESUF): tests/test-io-channel-file.o \
|
|
|
|
tests/io-channel-helpers.o $(test-io-obj-y)
|
2015-03-02 19:13:13 +01:00
|
|
|
tests/test-io-channel-tls$(EXESUF): tests/test-io-channel-tls.o \
|
|
|
|
tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o \
|
|
|
|
tests/io-channel-helpers.o $(test-io-obj-y)
|
2015-08-27 17:25:30 +02:00
|
|
|
tests/test-io-channel-command$(EXESUF): tests/test-io-channel-command.o \
|
|
|
|
tests/io-channel-helpers.o $(test-io-obj-y)
|
2015-09-15 18:27:33 +02:00
|
|
|
tests/test-io-channel-buffer$(EXESUF): tests/test-io-channel-buffer.o \
|
|
|
|
tests/io-channel-helpers.o $(test-io-obj-y)
|
2015-10-14 14:14:04 +02:00
|
|
|
tests/test-crypto-pbkdf$(EXESUF): tests/test-crypto-pbkdf.o $(test-crypto-obj-y)
|
2015-10-15 13:35:28 +02:00
|
|
|
tests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
|
2015-10-23 17:14:25 +02:00
|
|
|
tests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
|
2015-10-24 12:44:13 +02:00
|
|
|
tests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
|
2013-02-16 21:47:01 +01:00
|
|
|
|
2014-10-23 10:12:42 +02:00
|
|
|
libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o tests/libqos/malloc.o
|
2015-01-19 21:15:55 +01:00
|
|
|
libqos-obj-y += tests/libqos/i2c.o tests/libqos/libqos.o
|
2016-09-13 14:52:44 +02:00
|
|
|
libqos-spapr-obj-y = $(libqos-obj-y) tests/libqos/malloc-spapr.o
|
|
|
|
libqos-spapr-obj-y += tests/libqos/libqos-spapr.o
|
2016-09-13 14:52:45 +02:00
|
|
|
libqos-spapr-obj-y += tests/libqos/rtas.o
|
2016-09-29 12:32:44 +02:00
|
|
|
libqos-spapr-obj-y += tests/libqos/pci-spapr.o
|
2013-06-26 15:52:22 +02:00
|
|
|
libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o
|
2015-01-19 21:15:55 +01:00
|
|
|
libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o
|
2015-01-19 21:16:03 +01:00
|
|
|
libqos-pc-obj-y += tests/libqos/ahci.o
|
2013-05-02 15:56:26 +02:00
|
|
|
libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
|
2015-09-07 11:39:31 +02:00
|
|
|
libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
|
2016-09-29 12:32:47 +02:00
|
|
|
libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o
|
2016-10-17 12:30:24 +02:00
|
|
|
libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
|
2013-04-16 16:45:16 +02:00
|
|
|
|
2017-03-03 13:32:23 +01:00
|
|
|
tests/qmp-test$(EXESUF): tests/qmp-test.o
|
2018-08-23 18:39:32 +02:00
|
|
|
tests/qmp-cmd-test$(EXESUF): tests/qmp-cmd-test.o
|
2015-10-01 10:59:56 +02:00
|
|
|
tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o
|
2012-12-21 09:45:20 +01:00
|
|
|
tests/rtc-test$(EXESUF): tests/rtc-test.o
|
|
|
|
tests/m48t59-test$(EXESUF): tests/m48t59-test.o
|
2018-08-16 15:05:28 +02:00
|
|
|
tests/hexloader-test$(EXESUF): tests/hexloader-test.o
|
2013-07-22 15:54:34 +02:00
|
|
|
tests/endianness-test$(EXESUF): tests/endianness-test.o
|
2014-02-10 04:52:56 +01:00
|
|
|
tests/spapr-phb-test$(EXESUF): tests/spapr-phb-test.o $(libqos-obj-y)
|
2016-06-14 15:57:56 +02:00
|
|
|
tests/prom-env-test$(EXESUF): tests/prom-env-test.o $(libqos-obj-y)
|
2016-09-13 14:52:45 +02:00
|
|
|
tests/rtas-test$(EXESUF): tests/rtas-test.o $(libqos-spapr-obj-y)
|
2012-12-21 09:45:20 +01:00
|
|
|
tests/fdc-test$(EXESUF): tests/fdc-test.o
|
2013-05-08 11:18:41 +02:00
|
|
|
tests/ide-test$(EXESUF): tests/ide-test.o $(libqos-pc-obj-y)
|
2015-01-19 21:15:55 +01:00
|
|
|
tests/ahci-test$(EXESUF): tests/ahci-test.o $(libqos-pc-obj-y)
|
2015-12-17 19:50:09 +01:00
|
|
|
tests/ipmi-kcs-test$(EXESUF): tests/ipmi-kcs-test.o
|
|
|
|
tests/ipmi-bt-test$(EXESUF): tests/ipmi-bt-test.o
|
2012-12-21 09:45:20 +01:00
|
|
|
tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
|
2013-06-26 15:52:16 +02:00
|
|
|
tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
|
2016-09-03 11:57:51 +02:00
|
|
|
tests/boot-serial-test$(EXESUF): tests/boot-serial-test.o $(libqos-obj-y)
|
2016-02-14 17:59:27 +01:00
|
|
|
tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o \
|
2017-02-17 00:15:38 +01:00
|
|
|
tests/boot-sector.o tests/acpi-utils.o $(libqos-obj-y)
|
2016-02-14 17:59:27 +01:00
|
|
|
tests/pxe-test$(EXESUF): tests/pxe-test.o tests/boot-sector.o $(libqos-obj-y)
|
2013-05-02 15:56:26 +02:00
|
|
|
tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
|
2018-06-08 14:15:32 +02:00
|
|
|
tests/pca9552-test$(EXESUF): tests/pca9552-test.o $(libqos-omap-obj-y)
|
2015-09-07 11:39:31 +02:00
|
|
|
tests/ds1338-test$(EXESUF): tests/ds1338-test.o $(libqos-imx-obj-y)
|
2019-01-07 16:23:47 +01:00
|
|
|
tests/microbit-test$(EXESUF): tests/microbit-test.o
|
2016-10-17 20:22:17 +02:00
|
|
|
tests/m25p80-test$(EXESUF): tests/m25p80-test.o
|
2013-04-16 16:45:19 +02:00
|
|
|
tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
|
2015-04-14 15:11:36 +02:00
|
|
|
tests/q35-test$(EXESUF): tests/q35-test.o $(libqos-pc-obj-y)
|
2013-04-16 16:45:21 +02:00
|
|
|
tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
|
2013-11-07 18:25:10 +01:00
|
|
|
tests/e1000-test$(EXESUF): tests/e1000-test.o
|
2016-06-01 10:23:46 +02:00
|
|
|
tests/e1000e-test$(EXESUF): tests/e1000e-test.o $(libqos-pc-obj-y)
|
2015-01-08 19:38:23 +01:00
|
|
|
tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y)
|
2013-11-07 18:53:28 +01:00
|
|
|
tests/pcnet-test$(EXESUF): tests/pcnet-test.o
|
2016-11-15 00:09:46 +01:00
|
|
|
tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o
|
2013-11-07 19:18:46 +01:00
|
|
|
tests/eepro100-test$(EXESUF): tests/eepro100-test.o
|
2013-11-07 18:37:34 +01:00
|
|
|
tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
|
2014-02-09 04:01:37 +01:00
|
|
|
tests/ne2000-test$(EXESUF): tests/ne2000-test.o
|
2014-07-15 14:57:06 +02:00
|
|
|
tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o
|
2015-06-28 19:58:57 +02:00
|
|
|
tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y)
|
2017-10-18 16:20:28 +02:00
|
|
|
tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o $(libqos-virtio-obj-y)
|
2014-09-01 12:07:54 +02:00
|
|
|
tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y)
|
2018-08-01 15:26:22 +02:00
|
|
|
tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
|
2015-07-17 09:25:53 +02:00
|
|
|
tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y)
|
2014-09-26 11:28:09 +02:00
|
|
|
tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y)
|
2015-04-24 13:35:16 +02:00
|
|
|
tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
|
2016-09-16 08:58:35 +02:00
|
|
|
tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o $(libqos-virtio-obj-y)
|
2017-10-18 16:20:28 +02:00
|
|
|
tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o $(libqos-virtio-obj-y)
|
|
|
|
tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o $(libqos-virtio-obj-y)
|
2014-02-09 03:48:44 +01:00
|
|
|
tests/tpci200-test$(EXESUF): tests/tpci200-test.o
|
2014-04-28 11:01:13 +02:00
|
|
|
tests/display-vga-test$(EXESUF): tests/display-vga-test.o
|
2014-02-09 12:24:15 +01:00
|
|
|
tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
|
2013-07-29 05:44:47 +02:00
|
|
|
tests/qom-test$(EXESUF): tests/qom-test.o
|
2017-04-25 07:16:47 +02:00
|
|
|
tests/test-hmp$(EXESUF): tests/test-hmp.o
|
2018-02-07 11:40:24 +01:00
|
|
|
tests/machine-none-test$(EXESUF): tests/machine-none-test.o
|
2017-08-31 16:40:08 +02:00
|
|
|
tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y)
|
2018-11-20 19:41:48 +01:00
|
|
|
tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y)
|
2014-02-21 20:38:48 +01:00
|
|
|
tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
|
2014-02-21 22:43:43 +01:00
|
|
|
tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
|
2014-03-30 19:00:05 +02:00
|
|
|
tests/ac97-test$(EXESUF): tests/ac97-test.o
|
2014-03-30 19:05:20 +02:00
|
|
|
tests/es1370-test$(EXESUF): tests/es1370-test.o
|
2014-03-30 19:22:48 +02:00
|
|
|
tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
|
2014-03-30 20:02:00 +02:00
|
|
|
tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
|
2014-09-26 11:28:14 +02:00
|
|
|
tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y)
|
2014-09-26 11:28:13 +02:00
|
|
|
tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y)
|
2014-09-26 11:28:12 +02:00
|
|
|
tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y)
|
2014-09-26 11:28:14 +02:00
|
|
|
tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
|
2017-10-06 12:13:51 +02:00
|
|
|
tests/cpu-plug-test$(EXESUF): tests/cpu-plug-test.o
|
2017-10-11 11:03:22 +02:00
|
|
|
tests/migration-test$(EXESUF): tests/migration-test.o
|
2017-02-13 14:52:18 +01:00
|
|
|
tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o $(test-util-obj-y) \
|
2016-12-12 13:49:01 +01:00
|
|
|
$(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y) $(libqos-pc-obj-y) \
|
|
|
|
$(chardev-obj-y)
|
2013-09-06 05:24:32 +02:00
|
|
|
tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o $(test-util-obj-y)
|
2017-03-20 13:55:46 +01:00
|
|
|
tests/test-keyval$(EXESUF): tests/test-keyval.o $(test-util-obj-y) $(test-qapi-obj-y)
|
2015-09-02 12:35:52 +02:00
|
|
|
tests/test-write-threshold$(EXESUF): tests/test-write-threshold.o $(test-block-obj-y)
|
2015-10-07 05:52:22 +02:00
|
|
|
tests/test-netfilter$(EXESUF): tests/test-netfilter.o $(qtest-obj-y)
|
tests/test-filter-mirror:add filter-mirror unit test
In this unit test we will test the mirror function.
start qemu with:
-netdev socket,id=qtest-bn0,fd=sockfd
-device e1000,netdev=qtest-bn0,id=qtest-e0
-chardev socket,id=mirror0,path=/tmp/filter-mirror-test.sock,server,nowait
-object filter-mirror,id=qtest-f0,netdev=qtest-bn0,queue=tx,outdev=mirror0
We inject packet to netdev socket id = qtest-bn0,
filter-mirror will copy and mirror the packet to mirror0.
we read packet from mirror0 and then compare to what we injected.
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-03-15 08:41:34 +01:00
|
|
|
tests/test-filter-mirror$(EXESUF): tests/test-filter-mirror.o $(qtest-obj-y)
|
tests/test-filter-redirector: Add unit test for filter-redirector
In this unit test,we will test the filter redirector function.
Case 1, tx traffic flow:
qemu side | test side
|
+---------+ | +-------+
| backend <---------------+ sock0 |
+----+----+ | +-------+
| |
+----v----+ +-------+ |
| rd0 +->+chardev| |
+---------+ +---+---+ |
| |
+---------+ | |
| rd1 <------+ |
+----+----+ |
| |
+----v----+ | +-------+
| rd2 +--------------->sock1 |
+---------+ | +-------+
+
a. we(sock0) inject packet to qemu socket backend
b. backend pass packet to filter redirector0(rd0)
c. rd0 redirect packet to out_dev(chardev) which is connected with
filter redirector1's(rd1) in_dev
d. rd1 read this packet from in_dev, and pass to next filter redirector2(rd2)
e. rd2 redirect packet to rd2's out_dev which is connected with an opened socketed(sock1)
f. we read packet from sock1 and compare to what we inject
Start qemu with:
"-netdev socket,id=qtest-bn0,fd=%d "
"-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
"-chardev socket,id=redirector0,path=%s,server,nowait "
"-chardev socket,id=redirector1,path=%s,server,nowait "
"-chardev socket,id=redirector2,path=%s,nowait "
"-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
"queue=tx,outdev=redirector0 "
"-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
"queue=tx,indev=redirector2 "
"-object filter-redirector,id=qtest-f2,netdev=qtest-bn0,"
"queue=tx,outdev=redirector1 "
--------------------------------------
Case 2, rx traffic flow
qemu side | test side
|
+---------+ | +-------+
| backend +---------------> sock1 |
+----^----+ | +-------+
| |
+----+----+ +-------+ |
| rd0 +<-+chardev| |
+---------+ +---+---+ |
^ |
+---------+ | |
| rd1 +------+ |
+----^----+ |
| |
+----+----+ | +-------+
| rd2 <---------------+sock0 |
+---------+ | +-------+
a. we(sock0) insert packet to filter redirector2(rd2)
b. rd2 pass packet to filter redirector1(rd1)
c. rd1 redirect packet to out_dev(chardev) which is connected with
filter redirector0's(rd0) in_dev
d. rd0 read this packet from in_dev, and pass ti to qemu backend which is
connected with an opened socketed(sock1)
e. we read packet from sock1 and compare to what we inject
Start qemu with:
"-netdev socket,id=qtest-bn0,fd=%d "
"-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
"-chardev socket,id=redirector0,path=%s,server,nowait "
"-chardev socket,id=redirector1,path=%s,server,nowait "
"-chardev socket,id=redirector2,path=%s,nowait "
"-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
"queue=rx,outdev=redirector0 "
"-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
"queue=rx,indev=redirector2 "
"-object filter-redirector,id=qtest-f2,netdev=qtest-bn0,"
"queue=rx,outdev=redirector1 "
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2016-03-17 09:16:27 +01:00
|
|
|
tests/test-filter-redirector$(EXESUF): tests/test-filter-redirector.o $(qtest-obj-y)
|
2016-09-20 22:11:39 +02:00
|
|
|
tests/test-x86-cpuid-compat$(EXESUF): tests/test-x86-cpuid-compat.o $(qtest-obj-y)
|
2017-01-05 16:29:48 +01:00
|
|
|
tests/ivshmem-test$(EXESUF): tests/ivshmem-test.o contrib/ivshmem-server/ivshmem-server.o $(libqos-pc-obj-y) $(libqos-spapr-obj-y)
|
2017-06-01 16:45:16 +02:00
|
|
|
tests/megasas-test$(EXESUF): tests/megasas-test.o $(libqos-spapr-obj-y) $(libqos-pc-obj-y)
|
2017-08-17 20:56:08 +02:00
|
|
|
tests/vhost-user-bridge$(EXESUF): tests/vhost-user-bridge.o $(test-util-obj-y) libvhost-user.a
|
2016-09-21 06:27:24 +02:00
|
|
|
tests/test-uuid$(EXESUF): tests/test-uuid.o $(test-util-obj-y)
|
2016-10-24 17:26:54 +02:00
|
|
|
tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o
|
2017-02-28 22:27:03 +01:00
|
|
|
tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
|
2017-05-03 14:56:55 +02:00
|
|
|
tests/numa-test$(EXESUF): tests/numa-test.o
|
2017-07-14 17:30:45 +02:00
|
|
|
tests/vmgenid-test$(EXESUF): tests/vmgenid-test.o tests/boot-sector.o tests/acpi-utils.o
|
2018-02-08 17:47:50 +01:00
|
|
|
tests/sdhci-test$(EXESUF): tests/sdhci-test.o $(libqos-pc-obj-y)
|
2018-06-08 19:17:39 +02:00
|
|
|
tests/cdrom-test$(EXESUF): tests/cdrom-test.o tests/boot-sector.o $(libqos-obj-y)
|
2012-03-30 19:39:33 +02:00
|
|
|
|
tests: introduce a framework for testing migration performance
This introduces a moderately general purpose framework for
testing performance of migration.
The initial guest workload is provided by the included 'stress'
program, which is configured to spawn one thread per guest CPU
and run a maximally memory intensive workload. It will loop
over GB of memory, xor'ing each byte with data from a 4k array
of random bytes. This ensures heavy read and write load across
all of guest memory to stress the migration performance. While
running the 'stress' program will record how long it takes to
xor each GB of memory and print this data for later reporting.
The test engine will spawn a pair of QEMU processes, either on
the same host, or with the target on a remote host via ssh,
using the host kernel and a custom initrd built with 'stress'
as the /init binary. Kernel command line args are set to ensure
a fast kernel boot time (< 1 second) between launching QEMU and
the stress program starting execution.
None the less, the test engine will initially wait N seconds for
the guest workload to stablize, before starting the migration
operation. When migration is running, the engine will use pause,
post-copy, autoconverge, xbzrle compression and multithread
compression features, as well as downtime & bandwidth tuning
to encourage completion. If migration completes, the test engine
will wait N seconds again for the guest workooad to stablize on
the target host. If migration does not complete after a preset
number of iterations, it will be aborted.
While the QEMU process is running on the source host, the test
engine will sample the host CPU usage of QEMU as a whole, and
each vCPU thread. While migration is running, it will record
all the stats reported by 'query-migration'. Finally, it will
capture the output of the stress program running in the guest.
All the data produced from a single test execution is recorded
in a structured JSON file. A separate program is then able to
create interactive charts using the "plotly" python + javascript
libraries, showing the characteristics of the migration.
The data output provides visualization of the effect on guest
vCPU workloads from the migration process, the corresponding
vCPU utilization on the host, and the overall CPU hit from
QEMU on the host. This is correlated from statistics from the
migration process, such as downtime, vCPU throttling and iteration
number.
While the tests can be run individually with arbitrary parameters,
there is also a facility for producing batch reports for a number
of pre-defined scenarios / comparisons, in order to be able to
get standardized results across different hardware configurations
(eg TCP vs RDMA, or comparing different VCPU counts / memory
sizes, etc).
To use this, first you must build the initrd image
$ make tests/migration/initrd-stress.img
To run a a one-shot test with all default parameters
$ ./tests/migration/guestperf.py > result.json
This has many command line args for varying its behaviour.
For example, to increase the RAM size and CPU count and
bind it to specific host NUMA nodes
$ ./tests/migration/guestperf.py \
--mem 4 --cpus 2 \
--src-mem-bind 0 --src-cpu-bind 0,1 \
--dst-mem-bind 1 --dst-cpu-bind 2,3 \
> result.json
Using mem + cpu binding is strongly recommended on NUMA
machines, otherwise the guest performance results will
vary wildly between runs of the test due to lucky/unlucky
NUMA placement, making sensible data analysis impossible.
To make it run across separate hosts:
$ ./tests/migration/guestperf.py \
--dst-host somehostname > result.json
To request that post-copy is enabled, with switchover
after 5 iterations
$ ./tests/migration/guestperf.py \
--post-copy --post-copy-iters 5 > result.json
Once a result.json file is created, a graph of the data
can be generated, showing guest workload performance per
thread and the migration iteration points:
$ ./tests/migration/guestperf-plot.py --output result.html \
--migration-iters --split-guest-cpu result.json
To further include host vCPU utilization and overall QEMU
utilization
$ ./tests/migration/guestperf-plot.py --output result.html \
--migration-iters --split-guest-cpu \
--qemu-cpu --vcpu-cpu result.json
NB, the 'guestperf-plot.py' command requires that you have
the plotly python library installed. eg you must do
$ pip install --user plotly
Viewing the result.html file requires that you have the
plotly.min.js file in the same directory as the HTML
output. This js file is installed as part of the plotly
python library, so can be found in
$HOME/.local/lib/python2.7/site-packages/plotly/offline/plotly.min.js
The guestperf-plot.py program can accept multiple json files
to plot, enabling results from different configurations to
be compared.
Finally, to run the entire standardized set of comparisons
$ ./tests/migration/guestperf-batch.py \
--dst-host somehost \
--mem 4 --cpus 2 \
--src-mem-bind 0 --src-cpu-bind 0,1 \
--dst-mem-bind 1 --dst-cpu-bind 2,3
--output tcp-somehost-4gb-2cpu
will store JSON files from all scenarios in the directory
named tcp-somehost-4gb-2cpu
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1469020993-29426-7-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-07-20 15:23:13 +02:00
|
|
|
tests/migration/stress$(EXESUF): tests/migration/stress.o
|
2016-10-04 18:27:21 +02:00
|
|
|
$(call quiet-command, $(LINKPROG) -static -O3 $(PTHREAD_LIB) -o $@ $< ,"LINK","$(TARGET_DIR)$@")
|
tests: introduce a framework for testing migration performance
This introduces a moderately general purpose framework for
testing performance of migration.
The initial guest workload is provided by the included 'stress'
program, which is configured to spawn one thread per guest CPU
and run a maximally memory intensive workload. It will loop
over GB of memory, xor'ing each byte with data from a 4k array
of random bytes. This ensures heavy read and write load across
all of guest memory to stress the migration performance. While
running the 'stress' program will record how long it takes to
xor each GB of memory and print this data for later reporting.
The test engine will spawn a pair of QEMU processes, either on
the same host, or with the target on a remote host via ssh,
using the host kernel and a custom initrd built with 'stress'
as the /init binary. Kernel command line args are set to ensure
a fast kernel boot time (< 1 second) between launching QEMU and
the stress program starting execution.
None the less, the test engine will initially wait N seconds for
the guest workload to stablize, before starting the migration
operation. When migration is running, the engine will use pause,
post-copy, autoconverge, xbzrle compression and multithread
compression features, as well as downtime & bandwidth tuning
to encourage completion. If migration completes, the test engine
will wait N seconds again for the guest workooad to stablize on
the target host. If migration does not complete after a preset
number of iterations, it will be aborted.
While the QEMU process is running on the source host, the test
engine will sample the host CPU usage of QEMU as a whole, and
each vCPU thread. While migration is running, it will record
all the stats reported by 'query-migration'. Finally, it will
capture the output of the stress program running in the guest.
All the data produced from a single test execution is recorded
in a structured JSON file. A separate program is then able to
create interactive charts using the "plotly" python + javascript
libraries, showing the characteristics of the migration.
The data output provides visualization of the effect on guest
vCPU workloads from the migration process, the corresponding
vCPU utilization on the host, and the overall CPU hit from
QEMU on the host. This is correlated from statistics from the
migration process, such as downtime, vCPU throttling and iteration
number.
While the tests can be run individually with arbitrary parameters,
there is also a facility for producing batch reports for a number
of pre-defined scenarios / comparisons, in order to be able to
get standardized results across different hardware configurations
(eg TCP vs RDMA, or comparing different VCPU counts / memory
sizes, etc).
To use this, first you must build the initrd image
$ make tests/migration/initrd-stress.img
To run a a one-shot test with all default parameters
$ ./tests/migration/guestperf.py > result.json
This has many command line args for varying its behaviour.
For example, to increase the RAM size and CPU count and
bind it to specific host NUMA nodes
$ ./tests/migration/guestperf.py \
--mem 4 --cpus 2 \
--src-mem-bind 0 --src-cpu-bind 0,1 \
--dst-mem-bind 1 --dst-cpu-bind 2,3 \
> result.json
Using mem + cpu binding is strongly recommended on NUMA
machines, otherwise the guest performance results will
vary wildly between runs of the test due to lucky/unlucky
NUMA placement, making sensible data analysis impossible.
To make it run across separate hosts:
$ ./tests/migration/guestperf.py \
--dst-host somehostname > result.json
To request that post-copy is enabled, with switchover
after 5 iterations
$ ./tests/migration/guestperf.py \
--post-copy --post-copy-iters 5 > result.json
Once a result.json file is created, a graph of the data
can be generated, showing guest workload performance per
thread and the migration iteration points:
$ ./tests/migration/guestperf-plot.py --output result.html \
--migration-iters --split-guest-cpu result.json
To further include host vCPU utilization and overall QEMU
utilization
$ ./tests/migration/guestperf-plot.py --output result.html \
--migration-iters --split-guest-cpu \
--qemu-cpu --vcpu-cpu result.json
NB, the 'guestperf-plot.py' command requires that you have
the plotly python library installed. eg you must do
$ pip install --user plotly
Viewing the result.html file requires that you have the
plotly.min.js file in the same directory as the HTML
output. This js file is installed as part of the plotly
python library, so can be found in
$HOME/.local/lib/python2.7/site-packages/plotly/offline/plotly.min.js
The guestperf-plot.py program can accept multiple json files
to plot, enabling results from different configurations to
be compared.
Finally, to run the entire standardized set of comparisons
$ ./tests/migration/guestperf-batch.py \
--dst-host somehost \
--mem 4 --cpus 2 \
--src-mem-bind 0 --src-cpu-bind 0,1 \
--dst-mem-bind 1 --dst-cpu-bind 2,3
--output tcp-somehost-4gb-2cpu
will store JSON files from all scenarios in the directory
named tcp-somehost-4gb-2cpu
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <1469020993-29426-7-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-07-20 15:23:13 +02:00
|
|
|
|
|
|
|
INITRD_WORK_DIR=tests/migration/initrd
|
|
|
|
|
|
|
|
tests/migration/initrd-stress.img: tests/migration/stress$(EXESUF)
|
|
|
|
mkdir -p $(INITRD_WORK_DIR)
|
|
|
|
cp $< $(INITRD_WORK_DIR)/init
|
|
|
|
(cd $(INITRD_WORK_DIR) && (find | cpio --quiet -o -H newc | gzip -9)) > $@
|
|
|
|
rm $(INITRD_WORK_DIR)/init
|
|
|
|
rmdir $(INITRD_WORK_DIR)
|
|
|
|
|
2012-03-28 15:42:05 +02:00
|
|
|
# QTest rules
|
|
|
|
|
2018-07-04 08:30:11 +02:00
|
|
|
TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
|
2014-03-28 10:55:54 +01:00
|
|
|
ifeq ($(CONFIG_POSIX),y)
|
tests: Fix how qom-test is run
We want to run qom-test for every architecture, without having to
manually add it to every architecture's list of tests. Commit 3687d53
accomplished this by adding it to every architecture's list
automatically.
However, some architectures inherit their tests from others, like this:
check-qtest-x86_64-y = $(check-qtest-i386-y)
check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
For such architectures, we ended up running the (slow!) test twice.
Commit 2b8419c attempted to avoid this by adding the test only when
it's not already present. Works only as long as we consider adding
the test to the architectures on the left hand side *after* the ones
on the right hand side: x86_64 after i386, microblazeel after
microblaze, xtensaeb after xtensa.
Turns out we consider them in $(SYSEMU_TARGET_LIST) order. Defined as
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
$(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
On my machine, this results in the oder xtensa, x86_64, microblazeel,
microblaze, i386. Consequently, qom-test runs twice for microblazeel
and x86_64.
Replace this complex and flawed machinery with a much simpler one: add
generic tests (currently just qom-test) to check-qtest-generic-y
instead of check-qtest-$(target)-y for every target, then run
$(check-qtest-generic-y) for every target.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-Id: <1443689999-12182-5-git-send-email-armbru@redhat.com>
2015-10-01 10:59:53 +02:00
|
|
|
QTEST_TARGETS = $(TARGETS)
|
2014-03-28 10:55:54 +01:00
|
|
|
check-qtest-y=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
|
tests: Fix how qom-test is run
We want to run qom-test for every architecture, without having to
manually add it to every architecture's list of tests. Commit 3687d53
accomplished this by adding it to every architecture's list
automatically.
However, some architectures inherit their tests from others, like this:
check-qtest-x86_64-y = $(check-qtest-i386-y)
check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
For such architectures, we ended up running the (slow!) test twice.
Commit 2b8419c attempted to avoid this by adding the test only when
it's not already present. Works only as long as we consider adding
the test to the architectures on the left hand side *after* the ones
on the right hand side: x86_64 after i386, microblazeel after
microblaze, xtensaeb after xtensa.
Turns out we consider them in $(SYSEMU_TARGET_LIST) order. Defined as
SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
$(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
On my machine, this results in the oder xtensa, x86_64, microblazeel,
microblaze, i386. Consequently, qom-test runs twice for microblazeel
and x86_64.
Replace this complex and flawed machinery with a much simpler one: add
generic tests (currently just qom-test) to check-qtest-generic-y
instead of check-qtest-$(target)-y for every target, then run
$(check-qtest-generic-y) for every target.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-Id: <1443689999-12182-5-git-send-email-armbru@redhat.com>
2015-10-01 10:59:53 +02:00
|
|
|
check-qtest-y += $(check-qtest-generic-y)
|
|
|
|
else
|
|
|
|
QTEST_TARGETS =
|
2014-03-28 10:55:54 +01:00
|
|
|
endif
|
2012-03-28 15:42:05 +02:00
|
|
|
|
2015-09-02 12:35:52 +02:00
|
|
|
qtest-obj-y = tests/libqtest.o $(test-util-obj-y)
|
2012-03-28 15:42:05 +02:00
|
|
|
$(check-qtest-y): $(qtest-obj-y)
|
|
|
|
|
2017-09-11 23:01:29 +02:00
|
|
|
tests/test-qga$(EXESUF): qemu-ga$(EXESUF)
|
|
|
|
tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y)
|
2015-10-02 14:58:18 +02:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
SPEED = quick
|
2012-01-10 20:10:43 +01:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
# gtester tests, possibly with verbose output
|
2018-11-29 18:45:31 +01:00
|
|
|
# do_test_tap runs all tests, even if some of them fail, while do_test_human
|
|
|
|
# stops at the first failure unless -k is given on the command line
|
|
|
|
|
|
|
|
define do_test_human_k
|
|
|
|
$(quiet-@)rc=0; $(foreach COMMAND, $1, \
|
|
|
|
$(call quiet-command-run, \
|
|
|
|
export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
|
|
|
|
$(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
|
|
|
|
| ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only) \
|
|
|
|
|| rc=$$?;, "TEST", "$@: $(COMMAND)")) exit $$rc
|
|
|
|
endef
|
|
|
|
define do_test_human_no_k
|
|
|
|
$(foreach COMMAND, $1, \
|
|
|
|
$(call quiet-command, \
|
|
|
|
MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2 \
|
|
|
|
$(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
|
|
|
|
| ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" $(if $(V),, --show-failures-only), \
|
|
|
|
"TEST", "$@: $(COMMAND)")
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
do_test_human = \
|
|
|
|
$(if $(findstring k, $(MAKEFLAGS)), $(do_test_human_k), $(do_test_human_no_k))
|
|
|
|
|
|
|
|
define do_test_tap
|
|
|
|
$(call quiet-command, \
|
|
|
|
{ export MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} $2; \
|
|
|
|
$(foreach COMMAND, $1, \
|
|
|
|
$(COMMAND) -m=$(SPEED) -k --tap < /dev/null \
|
|
|
|
| sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \
|
|
|
|
| ./scripts/tap-merge.pl | tee "$@" \
|
|
|
|
| ./scripts/tap-driver.pl $(if $(V),, --show-failures-only), \
|
|
|
|
"TAP","$@")
|
|
|
|
endef
|
2012-01-10 20:10:43 +01:00
|
|
|
|
2012-03-28 15:42:05 +02:00
|
|
|
.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
|
2017-07-27 04:42:06 +02:00
|
|
|
$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: subdir-%-softmmu $(check-qtest-y)
|
2018-11-29 18:45:31 +01:00
|
|
|
$(call do_test_human,$(check-qtest-$*-y) $(check-qtest-generic-y), \
|
|
|
|
QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
|
|
|
|
QTEST_QEMU_IMG=qemu-img$(EXESUF))
|
2012-03-28 15:42:05 +02:00
|
|
|
|
2018-11-29 18:45:31 +01:00
|
|
|
check-unit: $(check-unit-y)
|
|
|
|
$(call do_test_human, $^)
|
2012-01-10 20:10:43 +01:00
|
|
|
|
2018-11-29 18:45:31 +01:00
|
|
|
check-speed: $(check-speed-y)
|
|
|
|
$(call do_test_human, $^)
|
2012-03-08 12:29:00 +01:00
|
|
|
|
2018-11-29 18:45:31 +01:00
|
|
|
# gtester tests with TAP output
|
2012-03-28 15:42:05 +02:00
|
|
|
|
2018-11-29 18:45:31 +01:00
|
|
|
$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: $(check-qtest-y)
|
|
|
|
$(call do_test_tap, $(check-qtest-$*-y) $(check-qtest-generic-y), \
|
|
|
|
QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
|
|
|
|
QTEST_QEMU_IMG=qemu-img$(EXESUF))
|
2012-03-09 13:37:40 +01:00
|
|
|
|
2018-11-29 18:45:31 +01:00
|
|
|
check-report-unit.tap: $(check-unit-y)
|
|
|
|
$(call do_test_tap,$^)
|
2012-03-09 13:37:40 +01:00
|
|
|
|
2018-11-29 18:45:31 +01:00
|
|
|
# Reports and overall runs
|
2012-03-09 13:37:40 +01:00
|
|
|
|
2018-11-29 18:45:31 +01:00
|
|
|
check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap
|
|
|
|
$(call quiet-command,./scripts/tap-merge.py $^ > $@,"GEN","$@")
|
2012-03-28 15:42:01 +02:00
|
|
|
|
2019-01-07 18:22:19 +01:00
|
|
|
# FPU Emulation tests (aka softfloat)
|
|
|
|
#
|
|
|
|
# As we still have some places that need fixing the rules are a little
|
|
|
|
# more complex than they need to be and have to override some of the
|
|
|
|
# generic Makefile expansions. Once we are cleanly passing all
|
|
|
|
# the tests we can simplify the make syntax.
|
|
|
|
|
|
|
|
FP_TEST_BIN=$(BUILD_DIR)/tests/fp/fp-test
|
|
|
|
|
|
|
|
# the build dir is created by configure
|
|
|
|
.PHONY: $(FP_TEST_BIN)
|
|
|
|
$(FP_TEST_BIN):
|
|
|
|
$(call quiet-command, \
|
|
|
|
$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" $(notdir $@), \
|
|
|
|
"BUILD", "$(notdir $@)")
|
|
|
|
|
|
|
|
# The full test suite can take a bit of time, default to a quick run
|
|
|
|
ifeq ($(SPEED), quick)
|
|
|
|
FP_TL=-l 1
|
|
|
|
else
|
|
|
|
FP_TL=-l 2 -r all
|
|
|
|
endif
|
|
|
|
|
|
|
|
# $1 = tests, $2 = description
|
|
|
|
test-softfloat = $(call quiet-command, \
|
|
|
|
cd $(BUILD_DIR)/tests/fp && \
|
|
|
|
./fp-test -s $(FP_TL) $1 > $2.out 2>&1 || \
|
|
|
|
(cat $2.out && exit 1;), \
|
|
|
|
"FLOAT TEST", $2)
|
|
|
|
|
|
|
|
# Conversion Routines:
|
|
|
|
# FIXME: i32_to_extF80 (broken), i64_to_extF80 (broken)
|
|
|
|
# ui32_to_f128 (not implemented), f128_to_ui32 (not implemented)
|
|
|
|
# extF80_roundToInt (broken)
|
|
|
|
#
|
|
|
|
check-softfloat-conv: $(FP_TEST_BIN)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
i32_to_f16 i64_to_f16 \
|
|
|
|
i32_to_f32 i64_to_f32 \
|
|
|
|
i32_to_f64 i64_to_f64 \
|
|
|
|
i32_to_f128 i64_to_f128, int-to-float)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
ui32_to_f16 ui64_to_f16 \
|
|
|
|
ui32_to_f32 ui64_to_f32 \
|
|
|
|
ui32_to_f64 ui64_to_f64 \
|
|
|
|
ui64_to_f128, uint-to-float)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
f16_to_i32 f16_to_i32_r_minMag \
|
|
|
|
f32_to_i32 f32_to_i32_r_minMag \
|
|
|
|
f64_to_i32 f64_to_i32_r_minMag \
|
|
|
|
extF80_to_i32 extF80_to_i32_r_minMag \
|
|
|
|
f128_to_i32 f128_to_i32_r_minMag \
|
|
|
|
f16_to_i64 f16_to_i64_r_minMag \
|
|
|
|
f32_to_i64 f32_to_i64_r_minMag \
|
|
|
|
f64_to_i64 f64_to_i64_r_minMag \
|
|
|
|
extF80_to_i64 extF80_to_i64_r_minMag \
|
|
|
|
f128_to_i64 f128_to_i64_r_minMag, \
|
|
|
|
float-to-int)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
f16_to_ui32 f16_to_ui32_r_minMag \
|
|
|
|
f32_to_ui32 f32_to_ui32_r_minMag \
|
|
|
|
f64_to_ui32 f64_to_ui32_r_minMag \
|
|
|
|
f16_to_ui64 f16_to_ui64_r_minMag \
|
|
|
|
f32_to_ui64 f32_to_ui64_r_minMag \
|
|
|
|
f64_to_ui64 f64_to_ui64_r_minMag, \
|
|
|
|
float-to-uint)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
f16_roundToInt f32_roundToInt \
|
|
|
|
f64_roundToInt f128_roundToInt, \
|
|
|
|
round-to-integer)
|
|
|
|
|
|
|
|
# Generic rule for all float operations
|
|
|
|
#
|
|
|
|
# Some patterns are overidden due to broken or missing tests.
|
|
|
|
# Hopefully these can be removed over time.
|
|
|
|
|
|
|
|
check-softfloat-%: $(FP_TEST_BIN)
|
|
|
|
$(call test-softfloat, f16_$* f32_$* f64_$* extF80_$* f128_$*, $*)
|
|
|
|
|
|
|
|
# Float Compare routines
|
|
|
|
SF_COMPARE_OPS=eq eq_signaling le le_quiet lt_quiet
|
|
|
|
SF_COMPARE_RULES=$(patsubst %,check-softfloat-%, $(SF_COMPARE_OPS))
|
|
|
|
|
|
|
|
# FIXME: extF80_le_quiet (broken)
|
|
|
|
check-softfloat-le_quiet: $(FP_TEST_BIN)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
f16_le_quiet f32_le_quiet f64_le_quiet \
|
|
|
|
f128_le_quiet, \
|
|
|
|
le_quiet)
|
|
|
|
|
|
|
|
# FIXME: extF80_lt_quiet (broken)
|
|
|
|
check-softfloat-lt_quiet: $(FP_TEST_BIN)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
f16_lt_quiet f32_lt_quiet f64_lt_quiet \
|
|
|
|
f128_lt_quiet, \
|
|
|
|
lt_quiet)
|
|
|
|
|
|
|
|
.PHONY: check-softfloat-compare
|
|
|
|
check-softfloat-compare: $(SF_COMPARE_RULES)
|
|
|
|
|
|
|
|
# Math Operations
|
|
|
|
|
|
|
|
# FIXME: extF80_mulAdd (missing)
|
|
|
|
check-softfloat-mulAdd: $(FP_TEST_BIN)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
f16_mulAdd f32_mulAdd f64_mulAdd f128_mulAdd, \
|
|
|
|
mulAdd)
|
|
|
|
|
|
|
|
# FIXME: extF80_rem (broken)
|
|
|
|
check-softfloat-rem: $(FP_TEST_BIN)
|
|
|
|
$(call test-softfloat, \
|
|
|
|
f16_rem f32_rem f64_rem f128_rem, \
|
|
|
|
rem)
|
|
|
|
|
|
|
|
SF_MATH_OPS=add sub mul mulAdd div rem sqrt
|
|
|
|
SF_MATH_RULES=$(patsubst %,check-softfloat-%, $(SF_MATH_OPS))
|
|
|
|
|
|
|
|
.PHONY: check-softfloat-ops
|
|
|
|
check-softfloat-ops: $(SF_MATH_RULES)
|
|
|
|
|
2019-01-07 18:25:44 +01:00
|
|
|
# Finally a generic rule to test all of softfoat. If TCG isnt't
|
|
|
|
# enabled we define a null operation which skips the tests.
|
|
|
|
|
|
|
|
.PHONY: check-softfloat
|
|
|
|
ifeq ($(CONFIG_TCG),y)
|
|
|
|
check-softfloat: check-softfloat-conv check-softfloat-compare check-softfloat-ops
|
|
|
|
else
|
|
|
|
check-softfloat:
|
|
|
|
$(call quiet-command, /bin/true, "FLOAT TEST", \
|
|
|
|
"SKIPPED for non-TCG builds")
|
|
|
|
endif
|
|
|
|
|
2018-04-06 23:08:36 +02:00
|
|
|
# Per guest TCG tests
|
|
|
|
|
2018-07-04 08:30:11 +02:00
|
|
|
LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_DIRS))
|
2018-04-06 23:08:36 +02:00
|
|
|
BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
|
|
|
|
CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
|
|
|
|
RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
|
|
|
|
|
2018-06-08 13:12:46 +02:00
|
|
|
ifeq ($(HAVE_USER_DOCKER),y)
|
|
|
|
# Probe for the Docker Builds needed for each build
|
2018-07-04 08:30:11 +02:00
|
|
|
$(foreach PROBE_TARGET,$(TARGET_DIRS), \
|
2018-06-08 13:12:46 +02:00
|
|
|
$(eval -include $(SRC_PATH)/tests/tcg/Makefile.probe) \
|
|
|
|
$(if $(DOCKER_PREREQ), \
|
|
|
|
$(eval build-tcg-tests-$(PROBE_TARGET): $(DOCKER_PREREQ))))
|
|
|
|
endif
|
|
|
|
|
2018-04-06 23:08:36 +02:00
|
|
|
build-tcg-tests-%:
|
2018-06-15 20:20:55 +02:00
|
|
|
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" \
|
|
|
|
SKIP_DOCKER_BUILD=1 TARGET_DIR="$*/" guest-tests, \
|
|
|
|
"BUILD", "TCG tests for $*")
|
2018-04-06 23:08:36 +02:00
|
|
|
|
|
|
|
run-tcg-tests-%: % build-tcg-tests-%
|
2018-06-15 20:20:55 +02:00
|
|
|
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" \
|
|
|
|
SKIP_DOCKER_BUILD=1 TARGET_DIR="$*/" run-guest-tests, \
|
|
|
|
"RUN", "TCG tests for $*")
|
2018-04-06 23:08:36 +02:00
|
|
|
|
|
|
|
clean-tcg-tests-%:
|
|
|
|
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)
|
|
|
|
|
|
|
|
.PHONY: build-tcg
|
|
|
|
build-tcg: $(BUILD_TCG_TARGET_RULES)
|
|
|
|
|
|
|
|
.PHONY: check-tcg
|
2019-01-07 18:25:44 +01:00
|
|
|
check-tcg: check-softfloat $(RUN_TCG_TARGET_RULES)
|
2018-04-06 23:08:36 +02:00
|
|
|
|
|
|
|
.PHONY: clean-tcg
|
|
|
|
clean-tcg: $(CLEAN_TCG_TARGET_RULES)
|
2012-03-28 15:42:01 +02:00
|
|
|
|
|
|
|
# Other tests
|
|
|
|
|
2018-06-05 18:09:58 +02:00
|
|
|
QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
|
2013-09-26 02:42:55 +02:00
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
.PHONY: check-tests/qemu-iotests-quick.sh
|
2013-09-26 02:42:55 +02:00
|
|
|
check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
|
2012-03-28 15:42:01 +02:00
|
|
|
$<
|
|
|
|
|
2013-07-27 17:41:53 +02:00
|
|
|
.PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
|
|
|
|
$(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
|
2014-05-02 15:52:24 +02:00
|
|
|
$(call quiet-command, PYTHONPATH=$(SRC_PATH)/scripts \
|
2018-06-18 19:59:58 +02:00
|
|
|
$(PYTHON) $(SRC_PATH)/tests/qapi-schema/test-qapi.py \
|
2014-05-02 15:52:35 +02:00
|
|
|
$^ >$*.test.out 2>$*.test.err; \
|
2014-05-02 15:52:24 +02:00
|
|
|
echo $$? >$*.test.exit, \
|
2016-10-04 18:27:21 +02:00
|
|
|
"TEST","$*.out")
|
2014-05-02 15:52:35 +02:00
|
|
|
@# Sanitize error messages (make them independent of build directory)
|
2018-03-15 13:51:16 +01:00
|
|
|
@perl -p -e 's|\Q$(SRC_PATH)\E/||g' $*.test.err | diff -u $(SRC_PATH)/$*.err -
|
|
|
|
@diff -u $(SRC_PATH)/$*.out $*.test.out
|
|
|
|
@diff -u $(SRC_PATH)/$*.exit $*.test.exit
|
2013-07-27 17:41:53 +02:00
|
|
|
|
2017-03-20 14:11:54 +01:00
|
|
|
.PHONY: check-tests/qapi-schema/doc-good.texi
|
|
|
|
check-tests/qapi-schema/doc-good.texi: tests/qapi-schema/doc-good.test.texi
|
2018-03-15 13:51:16 +01:00
|
|
|
@diff -u $(SRC_PATH)/tests/qapi-schema/doc-good.texi $<
|
2017-03-20 14:11:54 +01:00
|
|
|
|
2017-12-07 21:44:09 +01:00
|
|
|
.PHONY: check-decodetree
|
|
|
|
check-decodetree:
|
|
|
|
$(call quiet-command, \
|
|
|
|
cd $(SRC_PATH)/tests/decode && \
|
|
|
|
./check.sh "$(PYTHON)" "$(SRC_PATH)/scripts/decodetree.py", \
|
|
|
|
TEST, decodetree.py)
|
|
|
|
|
2018-10-18 17:31:32 +02:00
|
|
|
# Python venv for running tests
|
|
|
|
|
2018-10-18 17:31:33 +02:00
|
|
|
.PHONY: check-venv check-acceptance
|
2018-10-18 17:31:32 +02:00
|
|
|
|
|
|
|
TESTS_VENV_DIR=$(BUILD_DIR)/tests/venv
|
|
|
|
TESTS_VENV_REQ=$(SRC_PATH)/tests/requirements.txt
|
2018-10-18 17:31:33 +02:00
|
|
|
TESTS_RESULTS_DIR=$(BUILD_DIR)/tests/results
|
|
|
|
# Controls the output generated by Avocado when running tests.
|
|
|
|
# Any number of command separated loggers are accepted. For more
|
|
|
|
# information please refer to "avocado --help".
|
|
|
|
AVOCADO_SHOW=none
|
2018-10-18 17:31:32 +02:00
|
|
|
|
2018-11-09 16:07:08 +01:00
|
|
|
ifneq ($(findstring v2,"v$(PYTHON_VERSION)"),v2)
|
2018-10-18 17:31:32 +02:00
|
|
|
$(TESTS_VENV_DIR): $(TESTS_VENV_REQ)
|
|
|
|
$(call quiet-command, \
|
|
|
|
$(PYTHON) -m venv --system-site-packages $@, \
|
|
|
|
VENV, $@)
|
|
|
|
$(call quiet-command, \
|
|
|
|
$(TESTS_VENV_DIR)/bin/python -m pip -q install -r $(TESTS_VENV_REQ), \
|
|
|
|
PIP, $(TESTS_VENV_REQ))
|
|
|
|
$(call quiet-command, touch $@)
|
|
|
|
else
|
|
|
|
$(TESTS_VENV_DIR):
|
|
|
|
$(error "venv directory for tests requires Python 3")
|
|
|
|
endif
|
|
|
|
|
2018-10-18 17:31:33 +02:00
|
|
|
$(TESTS_RESULTS_DIR):
|
|
|
|
$(call quiet-command, mkdir -p $@, \
|
|
|
|
MKDIR, $@)
|
|
|
|
|
2018-10-18 17:31:32 +02:00
|
|
|
check-venv: $(TESTS_VENV_DIR)
|
|
|
|
|
2018-10-18 17:31:33 +02:00
|
|
|
check-acceptance: check-venv $(TESTS_RESULTS_DIR)
|
|
|
|
$(call quiet-command, \
|
|
|
|
$(TESTS_VENV_DIR)/bin/python -m avocado \
|
|
|
|
--show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
|
|
|
|
--failfast=on $(SRC_PATH)/tests/acceptance, \
|
|
|
|
"AVOCADO", "tests/acceptance")
|
|
|
|
|
2012-03-28 15:42:01 +02:00
|
|
|
# Consolidated targets
|
|
|
|
|
2013-09-26 02:42:56 +02:00
|
|
|
.PHONY: check-qapi-schema check-qtest check-unit check check-clean
|
2017-03-20 14:11:54 +01:00
|
|
|
check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-tests/qapi-schema/doc-good.texi
|
2012-03-28 15:42:05 +02:00
|
|
|
check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
|
2012-03-28 15:42:01 +02:00
|
|
|
check-block: $(patsubst %,check-%, $(check-block-y))
|
2019-01-07 18:25:44 +01:00
|
|
|
check: check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
|
2013-09-26 02:42:56 +02:00
|
|
|
check-clean:
|
2014-04-07 18:33:22 +02:00
|
|
|
rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
|
2015-11-21 02:20:06 +01:00
|
|
|
rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
|
2018-02-26 20:48:58 +01:00
|
|
|
rm -f tests/test-qapi-gen-timestamp
|
2018-10-18 17:31:33 +02:00
|
|
|
rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
|
2013-09-26 02:42:56 +02:00
|
|
|
|
|
|
|
clean: check-clean
|
2012-07-18 19:22:27 +02:00
|
|
|
|
2013-09-26 02:42:55 +02:00
|
|
|
# Build the help program automatically
|
|
|
|
|
|
|
|
all: $(QEMU_IOTESTS_HELPERS-y)
|
|
|
|
|
2012-07-18 19:22:27 +02:00
|
|
|
-include $(wildcard tests/*.d)
|
2013-06-26 15:52:14 +02:00
|
|
|
-include $(wildcard tests/libqos/*.d)
|
2017-08-10 10:50:25 +02:00
|
|
|
|
|
|
|
endif
|