On 21/09/2020 21.19, Alexey Kirillov wrote:
> Signed-off-by: Alexey Kirillov <[email protected]>
> ---
> tests/qtest/meson.build | 3 +
> tests/qtest/test-query-netdev.c | 115 ++++++++++++++++++++++++++++++++
> 2 files changed, 118 insertions(+)
> create mode 100644 tests/qtest/test-query-netdev.c
[...]
> +static void test_query_netdev(void)
> +{
> + const char *arch = qtest_get_arch();
> + QObject *resp;
> + QTestState *state;
> +
> + /* Skip test for some MCU */
> + if (g_str_equal(arch, "avr") ||
> + g_str_equal(arch, "rx")) {
> + return;
> + }
> +
> + 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 {
> + state = qtest_init(
> + "-nodefaults "
> + "-netdev user,id=slirp0");
> + }
> + g_assert(state);
Have you tried manually selecting a machine for the avr and rx targets? It
worked with the iotests, see commit
733dafe4914ef2e6d6a9d546b7fdbb429f3590e7, i.e. on avr you could try "-M
mega2560" and on rx you could try "-M gdbsim-r5f562n8".
> + 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;
> +}
>
Acked-by: Thomas Huth <[email protected]>