[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent fro
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator |
Date: |
Wed, 28 Apr 2021 18:39:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
Hi Thomas, Markus, do you mind reviewing this one please?
On 4/15/21 6:33 PM, Philippe Mathieu-Daudé wrote:
> Now than we can probe if the TCG accelerator is available
> at runtime with a QMP command, do it once at the beginning
> and only register the tests we can run.
> We can then replace the #ifdef'ry by a runtime check.
>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> tests/qtest/qmp-cmd-test.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c
> index c98b78d0339..8902d2f169f 100644
> --- a/tests/qtest/qmp-cmd-test.c
> +++ b/tests/qtest/qmp-cmd-test.c
> @@ -21,19 +21,24 @@ const char common_args[] = "-nodefaults -machine none";
>
> /* Query smoke tests */
>
> +static bool tcg_accel_available;
> +
> static int query_error_class(const char *cmd)
> {
> - static struct {
> + static const struct {
> const char *cmd;
> int err_class;
> + /*
> + * Pointer to boolean.
> + * If non-NULL and value is %true, the error class is skipped.
> + */
> + bool *skip_err_class;
> } fails[] = {
> /* Success depends on build configuration: */
> #ifndef CONFIG_SPICE
> { "query-spice", ERROR_CLASS_COMMAND_NOT_FOUND },
> #endif
> -#ifndef CONFIG_TCG
> - { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND },
> -#endif
> + { "query-replay", ERROR_CLASS_COMMAND_NOT_FOUND,
> &tcg_accel_available },
> #ifndef CONFIG_VNC
> { "query-vnc", ERROR_CLASS_GENERIC_ERROR },
> { "query-vnc-servers", ERROR_CLASS_GENERIC_ERROR },
> @@ -51,6 +56,9 @@ static int query_error_class(const char *cmd)
> int i;
>
> for (i = 0; fails[i].cmd; i++) {
> + if (fails[i].skip_err_class && *fails[i].skip_err_class) {
> + continue;
> + }
> if (!strcmp(cmd, fails[i].cmd)) {
> return fails[i].err_class;
> }
> @@ -334,6 +342,8 @@ int main(int argc, char *argv[])
> QmpSchema schema;
> int ret;
>
> + tcg_accel_available = qtest_has_accel("tcg");
> +
> g_test_init(&argc, &argv, NULL);
>
> qmp_schema_init(&schema);
>
- Re: [PATCH v4 07/12] qtest/arm-cpu-features: Use generic qtest_has_accel() to check for TCG, (continued)
- [PATCH v4 08/12] qtest/bios-tables-test: Make test build-independent from accelerator, Philippe Mathieu-Daudé, 2021/04/15
- [PATCH v4 09/12] qtest/migration-test: Skip tests if KVM not builtin on s390x/ppc64, Philippe Mathieu-Daudé, 2021/04/15
- [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator, Philippe Mathieu-Daudé, 2021/04/15
- Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator,
Philippe Mathieu-Daudé <=
- Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator, Markus Armbruster, 2021/04/29
- Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator, Philippe Mathieu-Daudé, 2021/04/29
- Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator, Markus Armbruster, 2021/04/29
- Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator, Philippe Mathieu-Daudé, 2021/04/29
- Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator, Markus Armbruster, 2021/04/30
- Re: [PATCH v4 10/12] qtest/qmp-cmd-test: Make test build-independent from accelerator, Philippe Mathieu-Daudé, 2021/04/30
[PATCH v4 11/12] tests/qtest: Do not restrict bios-tables-test to Aarch64 hosts anymore, Philippe Mathieu-Daudé, 2021/04/15
[PATCH v4 12/12] tests/meson: Only build softfloat objects if TCG is selected, Philippe Mathieu-Daudé, 2021/04/15