summaryrefslogtreecommitdiffstats
path: root/tests/qtest/vhost-user-test.c
Commit message (Collapse)AuthorAgeFilesLines
* tests/qtest: vhost-user-test: Fix [-Werror=format-overflow=] build warningBin Meng2022-10-221-2/+2
| | | | | | | | | | | | | | | When tmpfs is NULL, a build warning is seen with GCC 9.3.0. It's strange that GCC 11.2.0 on Ubuntu 22.04 does not catch this, neither did the QEMU CI. While we are here, improve the error message as well. Reported-by: Shengjiang Wu <shengjiang.wu@windriver.com> Fixes: e6efe236c1d1 ("tests/qtest: vhost-user-test: Avoid using hardcoded /tmp") Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221017132023.2228641-2-bmeng.cn@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* tests/qtest: enable tests for virtio-gpioAlex Bennée2022-10-071-0/+66
| | | | | | | | | | | | | | | | | | We don't have a virtio-gpio implementation in QEMU and only support a vhost-user backend. The QEMU side of the code is minimal so it should be enough to instantiate the device and pass some vhost-user messages over the control socket. To do this we hook into the existing vhost-user-test code and just add the bits required for gpio. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Cc: Viresh Kumar <viresh.kumar@linaro.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Eric Auger <eric.auger@redhat.com> Message-Id: <20220408155704.2777166-1-alex.bennee@linaro.org> Message-Id: <20220802095010.3330793-23-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tests/qtest: add a get_features op to vhost-user-testAlex Bennée2022-10-071-10/+27
| | | | | | | | | | | As we expand this test for more virtio devices we will need to support different feature sets. Add a mandatory op field to fetch the list of features needed for the test itself. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220802095010.3330793-22-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tests/qtest: implement stub for VHOST_USER_GET_CONFIGAlex Bennée2022-10-071-0/+13
| | | | | | | | | | | We don't implement the full solution because frankly none of the tests need to at the moment. We may end up re-implementing libvhostuser in the end. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220802095010.3330793-21-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tests/qtest: plain g_assert for VHOST_USER_F_PROTOCOL_FEATURESAlex Bennée2022-10-071-2/+1Star
| | | | | | | | | | checkpatch.pl warns that non-plain asserts should be avoided so convert the check to a plain g_assert. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220802095010.3330793-19-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tests/qtest: catch unhandled vhost-user messagesAlex Bennée2022-10-071-0/+43
| | | | | | | | | | | | We don't need to action every message but lets document the ones we are expecting to consume so future tests don't get confused about unhandled bits. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220802095010.3330793-18-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tests/qtest: use qos_printf instead of g_test_messageAlex Bennée2022-10-071-6/+7
| | | | | | | | | | | | The vhost-user tests respawn qos-test as a standalone process. As a result the gtester framework squashes all messages coming out of it which make it hard to debug. As the test does not care about asserting certain messages just convert the tests to use the direct qos_printf. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220802095010.3330793-17-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tests/qtest: vhost-user-test: Avoid using hardcoded /tmpBin Meng2022-09-271-4/+6
| | | | | | | | | | This case was written to use hardcoded /tmp directory for temporary files. Update to use g_dir_make_tmp() for a portable implementation. Signed-off-by: Bin Meng <bin.meng@windriver.com> Message-Id: <20220927110632.1973965-19-bmeng.cn@gmail.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests/qtest: Use g_mkdtemp()Bin Meng2022-08-251-2/+2
| | | | | | | | | | Windows does not provide a mkdtemp() API, but glib does. Replace mkdtemp() call with the glib version. Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220824094029.1634519-3-bmeng.cn@gmail.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests/qtest: use g_autofree for test_server_create_chrAlex Bennée2022-06-031-4/+3Star
| | | | | | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220524154056.2896913-12-alex.bennee@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests: replace qemu_set_nonblock()Marc-André Lureau2022-05-031-1/+3
| | | | | | | | | | The call is POSIX-specific. Use the dedicated GLib API. (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
* tests/qtest/vhost-user-test.c: Use vhostforce=onEric Auger2022-02-211-1/+1
| | | | | | | | | | -netdev vhost-user,vhostforce is deprecated and vhostforce=on should be used instead. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220210145254.157790-2-eric.auger@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* tests/qtest: enable more vhost-user tests by defaultAlex Bennée2022-02-091-12/+9Star
| | | | | | | | If this starts causing failures again we should probably fix that. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Thomas Huth <thuth@redhat.com> Message-Id: <20220204204335.1689602-3-alex.bennee@linaro.org>
* migrate: remove QMP/HMP commands for speed, downtime and cache sizeDaniel P. Berrangé2021-03-181-4/+4
| | | | | | | | | | | | The generic 'migrate_set_parameters' command handle all types of param. Only the QMP commands were documented in the deprecations page, but the rationale for deprecating applies equally to HMP, and the replacements exist. Furthermore the HMP commands are just shims to the QMP commands, so removing the latter breaks the former unless they get re-implemented. Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* treewide: do not use short-form boolean optionsPaolo Bonzini2020-12-101-4/+4
| | | | | | | They are going to be deprecated, avoid warnings on stdout while the tests run. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* tests/qtest/vhost-user-test: prepare the tests for adding new dev classDima Stepanov2020-09-291-29/+76
| | | | | | | | | | | | | | | For now only vhost-user-net device is supported by the test. Other vhost-user devices are not tested. As a first step make source code refactoring so new devices can reuse the same test routines. To make this provide a new vhost_user_ops structure with the methods to initialize device, its command line or make a proper vhost-user responses. Signed-off-by: Dima Stepanov <dimastep@yandex-team.ru> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <a48b60fb96fef230b75fff72a2d77040dcb5ef7c.1599813294.git.dimastep@yandex-team.ru> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tests/qtest/vhost-user-test: Fix memory leaksThomas Huth2020-01-161-3/+8
| | | | | | | | | | | Do not allocate resources in case we return early, and make sure to free dest_cmdline at the end. Reported-by: Euler Robot <euler.robot@huawei.com> Reported-by: Pan Nengyuan <pannengyuan@huawei.com> Message-Id: <20200116140736.9498-1-thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
* Merge remote-tracking branch ↵Peter Maydell2020-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 'remotes/huth-gitlab/tags/pull-request-2020-01-12' into staging * Move qtests into a separate directory * Build index.html for docs # gpg: Signature made Sun 12 Jan 2020 11:21:41 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * remotes/huth-gitlab/tags/pull-request-2020-01-12: docs: build an index page for the HTML docs tests/libqos: Move the libqos files under tests/qtest/ tests/Makefile: Move qtest-related settings to a separate Makefile.include test: Move qtests to a separate directory tests/Makefile: Separate unit test dependencies from qtest dependencies tests/Makefile: Remove 'tests/' and '$(EXESUF)' from the check-qtest variables tests/ptimer: Remove unnecessary inclusion of libqtest.h tests/Makefile: test-char does not need libqtest Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* test: Move qtests to a separate directoryThomas Huth2020-01-121-0/+967
The tests directory itself is pretty overcrowded, and it's hard to see which test belongs to which test subsystem (unit, qtest, ...). Let's move the qtests to a separate folder for more clarity. Message-Id: <20191218103059.11729-6-thuth@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>