diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-04-08 16:45:31 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-04-08 16:45:31 +0100 |
commit | ce69aa92d71e13db9c3702a8e8305e8d2463aeb8 (patch) | |
tree | db523c9f40dd1e69e3f0a829d20eb36898c25597 /tests | |
parent | d8724020dd13c88a72fc391a6a2cf63abbd3dcca (diff) | |
parent | 21df394d9e2ffce9fa308f496d1ae228cf6cdb57 (diff) |
Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging
# gpg: Signature made Thu 08 Apr 2021 10:34:24 BST
# gpg: using RSA key EF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <jasowang@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg: It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F 3562 EF04 965B 398D 6211
* remotes/jasowang/tags/net-pull-request:
tap-win32: correctly recycle buffers
Revert "qapi: net: Add query-netdev command"
Revert "tests: Add tests for query-netdev command"
Revert "net: Move NetClientState.info_str to dynamic allocations"
Revert "hmp: Use QAPI NetdevInfo in hmp_info_network"
Revert "net: Do not fill legacy info_str for backends"
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/meson.build | 3 | ||||
-rw-r--r-- | tests/qtest/test-query-netdev.c | 120 |
2 files changed, 0 insertions, 123 deletions
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 902cfef7cb..420cd9986e 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -33,9 +33,6 @@ qtests_generic = \ if config_host.has_key('CONFIG_MODULES') qtests_generic += [ 'modules-test' ] endif -if slirp.found() - qtests_generic += [ 'test-query-netdev' ] -endif qtests_pci = \ (config_all_devices.has_key('CONFIG_VGA') ? ['display-vga-test'] : []) + \ diff --git a/tests/qtest/test-query-netdev.c b/tests/qtest/test-query-netdev.c deleted file mode 100644 index 1118537a9f..0000000000 --- a/tests/qtest/test-query-netdev.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * QTest testcase for the query-netdev - * - * Copyright Yandex N.V., 2019 - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#include "qemu/osdep.h" - -#include "libqos/libqtest.h" -#include "qapi/qmp/qdict.h" -#include "qapi/qmp/qlist.h" - -/* - * Events can get in the way of responses we are actually waiting for. - */ -GCC_FMT_ATTR(2, 3) -static QObject *wait_command(QTestState *who, const char *command, ...) -{ - va_list ap; - QDict *response; - QObject *result; - - va_start(ap, command); - qtest_qmp_vsend(who, command, ap); - va_end(ap); - - response = qtest_qmp_receive(who); - - result = qdict_get(response, "return"); - g_assert(result); - qobject_ref(result); - qobject_unref(response); - - return result; -} - -static void qmp_query_netdev_no_error(QTestState *qts, size_t netdevs_count) -{ - QObject *resp; - QList *netdevs; - - resp = wait_command(qts, "{'execute': 'query-netdev'}"); - - netdevs = qobject_to(QList, resp); - g_assert(netdevs); - g_assert(qlist_size(netdevs) == netdevs_count); - - qobject_unref(resp); -} - -static void test_query_netdev(void) -{ - const char *arch = qtest_get_arch(); - QObject *resp; - QTestState *state; - - /* Choosing machine for platforms without default one */ - if (g_str_equal(arch, "arm") || - g_str_equal(arch, "aarch64")) { - state = qtest_init( - "-nodefaults " - "-M virt " - "-netdev user,id=slirp0"); - } else if (g_str_equal(arch, "tricore")) { - state = qtest_init( - "-nodefaults " - "-M tricore_testboard " - "-netdev user,id=slirp0"); - } else if (g_str_equal(arch, "avr")) { - state = qtest_init( - "-nodefaults " - "-M mega2560 " - "-netdev user,id=slirp0"); - } else if (g_str_equal(arch, "rx")) { - state = qtest_init( - "-nodefaults " - "-M gdbsim-r5f562n8 " - "-netdev user,id=slirp0"); - } else { - state = qtest_init( - "-nodefaults " - "-netdev user,id=slirp0"); - } - g_assert(state); - - qmp_query_netdev_no_error(state, 1); - - resp = wait_command(state, - "{'execute': 'netdev_add', 'arguments': {" - " 'id': 'slirp1'," - " 'type': 'user'}}"); - qobject_unref(resp); - - qmp_query_netdev_no_error(state, 2); - - resp = wait_command(state, - "{'execute': 'netdev_del', 'arguments': {" - " 'id': 'slirp1'}}"); - qobject_unref(resp); - - qmp_query_netdev_no_error(state, 1); - - qtest_quit(state); -} - -int main(int argc, char **argv) -{ - int ret = 0; - g_test_init(&argc, &argv, NULL); - - qtest_add_func("/net/qapi/query_netdev", test_query_netdev); - - ret = g_test_run(); - - return ret; -} |