]> git.dujemihanovic.xyz Git - linux.git/commitdiff
selftests/powerpc/ptrace: Explain why tests are skipped
authorBenjamin Gray <bgray@linux.ibm.com>
Tue, 25 Jul 2023 00:58:39 +0000 (10:58 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 2 Aug 2023 12:22:19 +0000 (22:22 +1000)
Many tests require specific hardware features/configurations that a
typical machine might not have. As a result, it's common to see a test
is skipped. But it is tedious to find out why a test is skipped
when all it gives is the file location of the skip macro.

Convert SKIP_IF() to SKIP_IF_MSG(), with appropriate descriptions of why
the test is being skipped. This gives a general idea of why a test is
skipped, which can be looked into further if it doesn't make sense.

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230725005841.28854-3-bgray@linux.ibm.com
15 files changed:
tools/testing/selftests/powerpc/ptrace/child.h
tools/testing/selftests/powerpc/ptrace/core-pkey.c
tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c
tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c
tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c
tools/testing/selftests/powerpc/ptrace/ptrace-tar.c
tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-tar.c
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c
tools/testing/selftests/powerpc/ptrace/ptrace-tm-tar.c
tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c
tools/testing/selftests/powerpc/ptrace/ptrace-vsx.c

index d7275b7b33dc9f6e476270ccdedac039cb4c6f89..df62ff0735f79026201cf530c12d52dc36153081 100644 (file)
@@ -48,12 +48,12 @@ struct child_sync {
                }                                                       \
        } while (0)
 
-#define PARENT_SKIP_IF_UNSUPPORTED(x, sync)                            \
+#define PARENT_SKIP_IF_UNSUPPORTED(x, sync, msg)                       \
        do {                                                            \
                if ((x) == -1 && (errno == ENODEV || errno == EINVAL)) { \
                        (sync)->parent_gave_up = true;                  \
                        prod_child(sync);                               \
-                       SKIP_IF(1);                                     \
+                       SKIP_IF_MSG(1, msg);                            \
                }                                                       \
        } while (0)
 
index f6f8596ce8e12d5e5359672514bf1f7bd49ca999..f6da4cb30cd6d0a1cd1cdc2149ce6eae9d83d3e9 100644 (file)
@@ -266,7 +266,7 @@ static int parent(struct shared_info *info, pid_t pid)
         * to the child.
         */
        ret = ptrace_read_regs(pid, NT_PPC_PKEY, regs, 3);
-       PARENT_SKIP_IF_UNSUPPORTED(ret, &info->child_sync);
+       PARENT_SKIP_IF_UNSUPPORTED(ret, &info->child_sync, "PKEYs not supported");
        PARENT_FAIL_IF(ret, &info->child_sync);
 
        info->amr = regs[0];
index f75739bbad28cd22c2b55aaa245a93d1d21e00f7..e374c6b7ace68cea969eeb500cabcc458fdf766b 100644 (file)
@@ -884,7 +884,7 @@ static int perf_hwbreak(void)
 {
        srand ( time(NULL) );
 
-       SKIP_IF(!perf_breakpoint_supported());
+       SKIP_IF_MSG(!perf_breakpoint_supported(), "Perf breakpoints not supported");
 
        return runtest();
 }
index 1345e9b9af0fb9d9dc751cd3d9dbc6a95be3cb45..a16239277a6f2e1bb9ef44adf10192dbe0a18107 100644 (file)
@@ -603,7 +603,7 @@ static int ptrace_hwbreak(void)
        wait(NULL);
 
        get_dbginfo(child_pid, &dbginfo);
-       SKIP_IF(dbginfo.num_data_bps == 0);
+       SKIP_IF_MSG(dbginfo.num_data_bps == 0, "No data breakpoints present");
 
        dawr = dawr_present(&dbginfo);
        run_tests(child_pid, &dbginfo, dawr);
index 3344e74a97b4f8fec2426f84371822b00f931f72..16c6536001244995b376b32d15710a63f67924be 100644 (file)
@@ -641,10 +641,10 @@ static int ptrace_perf_hwbreak(void)
        wait(NULL); /* <-- child (SIGUSR1) */
 
        get_dbginfo(child_pid, &dbginfo);
-       SKIP_IF(dbginfo.num_data_bps <= 1);
+       SKIP_IF_MSG(dbginfo.num_data_bps <= 1, "Not enough data watchpoints (need at least 2)");
 
        ret = perf_cpu_event_open(0, (__u64)perf_data1, sizeof(*perf_data1));
-       SKIP_IF(ret < 0);
+       SKIP_IF_MSG(ret < 0, "perf_event_open syscall failed");
        close(ret);
 
        ret = test(child_pid);
index bc454f8991246560a7236db3fdec76205475e000..d89474377f11a61096cb684f8432bef3aa49e2cf 100644 (file)
@@ -192,7 +192,7 @@ static int parent(struct shared_info *info, pid_t pid)
         * to the child.
         */
        ret = ptrace_read_regs(pid, NT_PPC_PKEY, regs, 3);
-       PARENT_SKIP_IF_UNSUPPORTED(ret, &info->child_sync);
+       PARENT_SKIP_IF_UNSUPPORTED(ret, &info->child_sync, "PKEYs not supported");
        PARENT_FAIL_IF(ret, &info->child_sync);
 
        info->amr1 = info->amr2 = regs[0];
index 4436ca9d3caf803bd68a3d69df5c3ed7520c2ace..14726c77a6ce032910a9a00863a5b942c57370c4 100644 (file)
@@ -79,7 +79,7 @@ int ptrace_tar(void)
        int ret, status;
 
        // TAR was added in v2.07
-       SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_2_07));
+       SKIP_IF_MSG(!have_hwcap2(PPC_FEATURE2_ARCH_2_07), "TAR requires ISA 2.07 compatible hardware");
 
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
        pid = fork();
index 5dc152b162df6d23c66b79390f3c13da3341ec5c..7c70d62587c2c8bfc2b47bdae84607b8f78067a5 100644 (file)
@@ -112,8 +112,8 @@ int ptrace_tm_gpr(void)
        pid_t pid;
        int ret, status;
 
-       SKIP_IF(!have_htm());
-       SKIP_IF(htm_is_synthetic());
+       SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
+       SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);
        pid = fork();
        if (pid < 0) {
index 458cc1a70ccfe8e0087296c53f17a96b304818d3..6c17ed09996924d43f89770caecce79cc762904f 100644 (file)
@@ -118,8 +118,8 @@ int ptrace_tm_spd_gpr(void)
        pid_t pid;
        int ret, status;
 
-       SKIP_IF(!have_htm());
-       SKIP_IF(htm_is_synthetic());
+       SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
+       SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
        pid = fork();
        if (pid < 0) {
index e112a34fbe59c77ab9d2984f5c6819a68b2d454f..afd8dc2e20970d23c4e5c20b4e5192e0ce2549ff 100644 (file)
@@ -128,8 +128,8 @@ int ptrace_tm_spd_tar(void)
        pid_t pid;
        int ret, status;
 
-       SKIP_IF(!have_htm());
-       SKIP_IF(htm_is_synthetic());
+       SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
+       SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
        pid = fork();
        if (pid == 0)
index 40133d49fe39e4b18842ceafccc80423e7098a69..14d2fac8f237f596d4791d686731a4af64220b9b 100644 (file)
@@ -128,8 +128,8 @@ int ptrace_tm_spd_vsx(void)
        pid_t pid;
        int ret, status, i;
 
-       SKIP_IF(!have_htm());
-       SKIP_IF(htm_is_synthetic());
+       SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
+       SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
 
        for (i = 0; i < 128; i++) {
index 880ba6a29a48317293bf311c61e3e69f62065631..e64cdb04cecf7fc52d0f48ad849f1da6c478bb92 100644 (file)
@@ -113,8 +113,8 @@ int ptrace_tm_spr(void)
        pid_t pid;
        int ret, status;
 
-       SKIP_IF(!have_htm());
-       SKIP_IF(htm_is_synthetic());
+       SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
+       SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
        shm_id = shmget(IPC_PRIVATE, sizeof(struct shared), 0777|IPC_CREAT);
        shm_id1 = shmget(IPC_PRIVATE, sizeof(int), 0777|IPC_CREAT);
        pid = fork();
index d0db6df0f0eaed3681743714d0e38fdfbf6cb4e9..3963d4b0429fb53f9cd0f4f7164cae488b84286d 100644 (file)
@@ -116,8 +116,8 @@ int ptrace_tm_tar(void)
        pid_t pid;
        int ret, status;
 
-       SKIP_IF(!have_htm());
-       SKIP_IF(htm_is_synthetic());
+       SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
+       SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);
        pid = fork();
        if (pid == 0)
index 4f05ce4fd28232f4fe85794d8dd1907d6692fd42..8c925d734a72d68c539499f8252fa79b8b38aba0 100644 (file)
@@ -112,8 +112,8 @@ int ptrace_tm_vsx(void)
        pid_t pid;
        int ret, status, i;
 
-       SKIP_IF(!have_htm());
-       SKIP_IF(htm_is_synthetic());
+       SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
+       SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);
 
        for (i = 0; i < 128; i++) {
index cb9875f764ca23c45d923e8e466fd2ea363cbdba..11bc624574feb91738c7c9dac59c0c6c8be98dbd 100644 (file)
@@ -61,7 +61,7 @@ int ptrace_vsx(void)
        pid_t pid;
        int ret, status, i;
 
-       SKIP_IF(!have_hwcap(PPC_FEATURE_HAS_VSX));
+       SKIP_IF_MSG(!have_hwcap(PPC_FEATURE_HAS_VSX), "Don't have VSX");
 
        shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);