From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Cc: maz@kernel.org, ricarkol@google.com, eric.auger@redhat.com,
alexandru.elisei@arm.com, pbonzini@redhat.com
Subject: [PATCH v2 4/5] KVM: arm64: selftests: get-reg-list: Remove get-reg-list-sve
Date: Wed, 19 May 2021 16:07:25 +0200 [thread overview]
Message-ID: <20210519140726.892632-5-drjones@redhat.com> (raw)
In-Reply-To: <20210519140726.892632-1-drjones@redhat.com>
Now that we can easily run the test for multiple vcpu configs, let's
merge get-reg-list and get-reg-list-sve into just get-reg-list. We
also add a final change to make it more possible to run multiple
tests, which is to fork the test, rather than directly run it. That
allows a test to fail, but subsequent tests can still run.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
tools/testing/selftests/kvm/.gitignore | 1 -
tools/testing/selftests/kvm/Makefile | 1 -
.../selftests/kvm/aarch64/get-reg-list-sve.c | 3 --
.../selftests/kvm/aarch64/get-reg-list.c | 31 +++++++++++++------
4 files changed, 21 insertions(+), 15 deletions(-)
delete mode 100644 tools/testing/selftests/kvm/aarch64/get-reg-list-sve.c
diff --git a/tools/testing/selftests/kvm/.gitignore b/tools/testing/selftests/kvm/.gitignore
index bd83158e0e0b..e3745c90d8b2 100644
--- a/tools/testing/selftests/kvm/.gitignore
+++ b/tools/testing/selftests/kvm/.gitignore
@@ -1,6 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
/aarch64/get-reg-list
-/aarch64/get-reg-list-sve
/aarch64/vgic_init
/s390x/memop
/s390x/resets
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index e439d027939d..bf54fc23bcff 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -78,7 +78,6 @@ TEST_GEN_PROGS_x86_64 += set_memory_region_test
TEST_GEN_PROGS_x86_64 += steal_time
TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list
-TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list-sve
TEST_GEN_PROGS_aarch64 += aarch64/vgic_init
TEST_GEN_PROGS_aarch64 += demand_paging_test
TEST_GEN_PROGS_aarch64 += dirty_log_test
diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list-sve.c b/tools/testing/selftests/kvm/aarch64/get-reg-list-sve.c
deleted file mode 100644
index efba76682b4b..000000000000
--- a/tools/testing/selftests/kvm/aarch64/get-reg-list-sve.c
+++ /dev/null
@@ -1,3 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#define REG_LIST_SVE
-#include "get-reg-list.c"
diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
index be1a2877d7fa..dc06a28bfb74 100644
--- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
+++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
@@ -27,16 +27,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include "kvm_util.h"
#include "test_util.h"
#include "processor.h"
-#ifdef REG_LIST_SVE
-#define reg_list_sve() (true)
-#else
-#define reg_list_sve() (false)
-#endif
-
static struct kvm_reg_list *reg_list;
static __u64 *blessed_reg, blessed_n;
@@ -539,7 +536,8 @@ static struct vcpu_config *parse_config(const char *config)
int main(int ac, char **av)
{
struct vcpu_config *c, *sel = NULL;
- int i;
+ int i, ret = 0;
+ pid_t pid;
for (i = 1; i < ac; ++i) {
if (strcmp(av[i], "--core-reg-fixup") == 0)
@@ -568,10 +566,22 @@ int main(int ac, char **av)
c = vcpu_configs[i];
if (sel && c != sel)
continue;
- run_test(c);
+
+ pid = fork();
+
+ if (!pid) {
+ run_test(c);
+ exit(0);
+ } else {
+ int wstatus;
+ pid_t wpid = wait(&wstatus);
+ TEST_ASSERT(wpid == pid && WIFEXITED(wstatus), "wait: Unexpected return");
+ if (WEXITSTATUS(wstatus) && WEXITSTATUS(wstatus) != KSFT_SKIP)
+ ret = KSFT_FAIL;
+ }
}
- return 0;
+ return ret;
}
/*
@@ -970,6 +980,7 @@ static struct vcpu_config sve_config = {
};
static struct vcpu_config *vcpu_configs[] = {
- reg_list_sve() ? &sve_config : &vregs_config,
+ &vregs_config,
+ &sve_config,
};
static int vcpu_configs_n = ARRAY_SIZE(vcpu_configs);
--
2.30.2
next prev parent reply other threads:[~2021-05-19 14:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 14:07 [PATCH v2 0/5] KVM: arm64: selftests: Fix get-reg-list Andrew Jones
2021-05-19 14:07 ` [PATCH v2 1/5] KVM: arm64: selftests: get-reg-list: Introduce vcpu configs Andrew Jones
2021-05-19 14:07 ` [PATCH v2 2/5] KVM: arm64: selftests: get-reg-list: Prepare to run multiple configs at once Andrew Jones
2021-05-19 14:07 ` [PATCH v2 3/5] KVM: arm64: selftests: get-reg-list: Provide config selection option Andrew Jones
2021-05-19 14:07 ` Andrew Jones [this message]
2021-05-19 14:07 ` [PATCH v2 5/5] KVM: arm64: selftests: get-reg-list: Split base and pmu registers Andrew Jones
2021-05-25 20:09 ` Ricardo Koller
2021-05-26 6:57 ` Andrew Jones
2021-05-26 17:37 ` Ricardo Koller
2021-05-26 8:44 ` Marc Zyngier
2021-05-26 9:32 ` Andrew Jones
2021-05-26 10:15 ` Marc Zyngier
2021-05-26 11:53 ` Andrew Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210519140726.892632-5-drjones@redhat.com \
--to=drjones@redhat.com \
--cc=alexandru.elisei@arm.com \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=pbonzini@redhat.com \
--cc=ricarkol@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox