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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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)

+1 −1
Original line number Diff line number Diff line
@@ -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];
+1 −1
Original line number Diff line number Diff line
@@ -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();
}
+1 −1
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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);
Loading