qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/4] tests: Add tests for query-netdev command


From: Thomas Huth
Subject: Re: [PATCH v4 2/4] tests: Add tests for query-netdev command
Date: Sat, 24 Oct 2020 09:07:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 21/09/2020 21.19, Alexey Kirillov wrote:
> Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru>
> ---
>  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 <thuth@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]