Commit 68877ff2 authored by Benjamin Gray's avatar Benjamin Gray Committed by Michael Ellerman

selftests/powerpc/ptrace: Explain why tests are skipped

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: default avatarBenjamin Gray <bgray@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230725005841.28854-3-bgray@linux.ibm.com
parent 81d7cac4
...@@ -48,12 +48,12 @@ struct child_sync { ...@@ -48,12 +48,12 @@ struct child_sync {
} \ } \
} while (0) } while (0)
#define PARENT_SKIP_IF_UNSUPPORTED(x, sync) \ #define PARENT_SKIP_IF_UNSUPPORTED(x, sync, msg) \
do { \ do { \
if ((x) == -1 && (errno == ENODEV || errno == EINVAL)) { \ if ((x) == -1 && (errno == ENODEV || errno == EINVAL)) { \
(sync)->parent_gave_up = true; \ (sync)->parent_gave_up = true; \
prod_child(sync); \ prod_child(sync); \
SKIP_IF(1); \ SKIP_IF_MSG(1, msg); \
} \ } \
} while (0) } while (0)
......
...@@ -266,7 +266,7 @@ static int parent(struct shared_info *info, pid_t pid) ...@@ -266,7 +266,7 @@ static int parent(struct shared_info *info, pid_t pid)
* to the child. * to the child.
*/ */
ret = ptrace_read_regs(pid, NT_PPC_PKEY, regs, 3); 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); PARENT_FAIL_IF(ret, &info->child_sync);
info->amr = regs[0]; info->amr = regs[0];
......
...@@ -884,7 +884,7 @@ static int perf_hwbreak(void) ...@@ -884,7 +884,7 @@ static int perf_hwbreak(void)
{ {
srand ( time(NULL) ); srand ( time(NULL) );
SKIP_IF(!perf_breakpoint_supported()); SKIP_IF_MSG(!perf_breakpoint_supported(), "Perf breakpoints not supported");
return runtest(); return runtest();
} }
......
...@@ -603,7 +603,7 @@ static int ptrace_hwbreak(void) ...@@ -603,7 +603,7 @@ static int ptrace_hwbreak(void)
wait(NULL); wait(NULL);
get_dbginfo(child_pid, &dbginfo); 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); dawr = dawr_present(&dbginfo);
run_tests(child_pid, &dbginfo, dawr); run_tests(child_pid, &dbginfo, dawr);
......
...@@ -641,10 +641,10 @@ static int ptrace_perf_hwbreak(void) ...@@ -641,10 +641,10 @@ static int ptrace_perf_hwbreak(void)
wait(NULL); /* <-- child (SIGUSR1) */ wait(NULL); /* <-- child (SIGUSR1) */
get_dbginfo(child_pid, &dbginfo); 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)); 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); close(ret);
ret = test(child_pid); ret = test(child_pid);
......
...@@ -192,7 +192,7 @@ static int parent(struct shared_info *info, pid_t pid) ...@@ -192,7 +192,7 @@ static int parent(struct shared_info *info, pid_t pid)
* to the child. * to the child.
*/ */
ret = ptrace_read_regs(pid, NT_PPC_PKEY, regs, 3); 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); PARENT_FAIL_IF(ret, &info->child_sync);
info->amr1 = info->amr2 = regs[0]; info->amr1 = info->amr2 = regs[0];
......
...@@ -79,7 +79,7 @@ int ptrace_tar(void) ...@@ -79,7 +79,7 @@ int ptrace_tar(void)
int ret, status; int ret, status;
// TAR was added in v2.07 // 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); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
pid = fork(); pid = fork();
......
...@@ -112,8 +112,8 @@ int ptrace_tm_gpr(void) ...@@ -112,8 +112,8 @@ int ptrace_tm_gpr(void)
pid_t pid; pid_t pid;
int ret, status; int ret, status;
SKIP_IF(!have_htm()); SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
SKIP_IF(htm_is_synthetic()); SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
......
...@@ -118,8 +118,8 @@ int ptrace_tm_spd_gpr(void) ...@@ -118,8 +118,8 @@ int ptrace_tm_spd_gpr(void)
pid_t pid; pid_t pid;
int ret, status; int ret, status;
SKIP_IF(!have_htm()); SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
SKIP_IF(htm_is_synthetic()); SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
......
...@@ -128,8 +128,8 @@ int ptrace_tm_spd_tar(void) ...@@ -128,8 +128,8 @@ int ptrace_tm_spd_tar(void)
pid_t pid; pid_t pid;
int ret, status; int ret, status;
SKIP_IF(!have_htm()); SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
SKIP_IF(htm_is_synthetic()); SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
pid = fork(); pid = fork();
if (pid == 0) if (pid == 0)
......
...@@ -128,8 +128,8 @@ int ptrace_tm_spd_vsx(void) ...@@ -128,8 +128,8 @@ int ptrace_tm_spd_vsx(void)
pid_t pid; pid_t pid;
int ret, status, i; int ret, status, i;
SKIP_IF(!have_htm()); SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
SKIP_IF(htm_is_synthetic()); SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3, 0777|IPC_CREAT);
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
......
...@@ -113,8 +113,8 @@ int ptrace_tm_spr(void) ...@@ -113,8 +113,8 @@ int ptrace_tm_spr(void)
pid_t pid; pid_t pid;
int ret, status; int ret, status;
SKIP_IF(!have_htm()); SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
SKIP_IF(htm_is_synthetic()); SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
shm_id = shmget(IPC_PRIVATE, sizeof(struct shared), 0777|IPC_CREAT); shm_id = shmget(IPC_PRIVATE, sizeof(struct shared), 0777|IPC_CREAT);
shm_id1 = shmget(IPC_PRIVATE, sizeof(int), 0777|IPC_CREAT); shm_id1 = shmget(IPC_PRIVATE, sizeof(int), 0777|IPC_CREAT);
pid = fork(); pid = fork();
......
...@@ -116,8 +116,8 @@ int ptrace_tm_tar(void) ...@@ -116,8 +116,8 @@ int ptrace_tm_tar(void)
pid_t pid; pid_t pid;
int ret, status; int ret, status;
SKIP_IF(!have_htm()); SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
SKIP_IF(htm_is_synthetic()); SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);
pid = fork(); pid = fork();
if (pid == 0) if (pid == 0)
......
...@@ -112,8 +112,8 @@ int ptrace_tm_vsx(void) ...@@ -112,8 +112,8 @@ int ptrace_tm_vsx(void)
pid_t pid; pid_t pid;
int ret, status, i; int ret, status, i;
SKIP_IF(!have_htm()); SKIP_IF_MSG(!have_htm(), "Don't have transactional memory");
SKIP_IF(htm_is_synthetic()); SKIP_IF_MSG(htm_is_synthetic(), "Transactional memory is synthetic");
shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
......
...@@ -61,7 +61,7 @@ int ptrace_vsx(void) ...@@ -61,7 +61,7 @@ int ptrace_vsx(void)
pid_t pid; pid_t pid;
int ret, status, i; 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); shm_id = shmget(IPC_PRIVATE, sizeof(int) * 2, 0777|IPC_CREAT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment