selftests/powerpc: Don't run DSCR tests on old systems
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 19 Aug 2020 01:57:23 +0000 (11:57 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 8 Sep 2020 12:24:02 +0000 (22:24 +1000)
The DSCR tests fail on systems that don't have DSCR, so check for the
DSCR in hwcap and skip if it's not present.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200819015727.1977134-5-mpe@ellerman.id.au
tools/testing/selftests/powerpc/dscr/Makefile
tools/testing/selftests/powerpc/dscr/dscr_default_test.c
tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
tools/testing/selftests/powerpc/dscr/dscr_inherit_exec_test.c
tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c
tools/testing/selftests/powerpc/dscr/dscr_sysfs_test.c
tools/testing/selftests/powerpc/dscr/dscr_sysfs_thread_test.c
tools/testing/selftests/powerpc/dscr/dscr_user_test.c

index cfa6eed..845db62 100644 (file)
@@ -10,4 +10,4 @@ include ../../lib.mk
 
 $(OUTPUT)/dscr_default_test: LDLIBS += -lpthread
 
-$(TEST_GEN_PROGS): ../harness.c
+$(TEST_GEN_PROGS): ../harness.c ../utils.c
index 288a4e2..e76611e 100644 (file)
@@ -63,6 +63,8 @@ int dscr_default(void)
        unsigned long i, *status[THREADS];
        unsigned long orig_dscr_default;
 
+       SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
+
        orig_dscr_default = get_default_dscr();
 
        /* Initial DSCR default */
index aefcd8d..32fcf2b 100644 (file)
@@ -21,6 +21,8 @@ int dscr_explicit(void)
 {
        unsigned long i, dscr = 0;
 
+       SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
+
        srand(getpid());
        set_dscr(dscr);
 
index 7c1cb46..c6a81b2 100644 (file)
@@ -44,6 +44,8 @@ int dscr_inherit_exec(void)
        unsigned long i, dscr = 0;
        pid_t pid;
 
+       SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
+
        for (i = 0; i < COUNT; i++) {
                dscr++;
                if (dscr > DSCR_MAX)
index 04297a6..f9dfd3d 100644 (file)
@@ -22,6 +22,8 @@ int dscr_inherit(void)
        unsigned long i, dscr = 0;
        pid_t pid;
 
+       SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
+
        srand(getpid());
        set_dscr(dscr);
 
index 02f6b4e..fbbdffd 100644 (file)
@@ -77,6 +77,8 @@ int dscr_sysfs(void)
        unsigned long orig_dscr_default;
        int i, j;
 
+       SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
+
        orig_dscr_default = get_default_dscr();
        for (i = 0; i < COUNT; i++) {
                for (j = 0; j < DSCR_MAX; j++) {
index 37be2c2..191ed12 100644 (file)
@@ -56,6 +56,8 @@ int dscr_sysfs_thread(void)
        unsigned long orig_dscr_default;
        int i, j;
 
+       SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
+
        orig_dscr_default = get_default_dscr();
        for (i = 0; i < COUNT; i++) {
                for (j = 0; j < DSCR_MAX; j++) {
index eaf785d..e090724 100644 (file)
@@ -36,6 +36,8 @@ int dscr_user(void)
 {
        int i;
 
+       SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));
+
        check_dscr("");
 
        for (i = 0; i < COUNT; i++) {