kselftest: breakpoints: convert breakpoint_test to TAP13 output
Make the breakpoints test output in the TAP13 format by using the TAP13 output functions defined in kselftest.h Signed-off-by: Paul Elder <paul.elder@pitt.edu> Signed-off-by: Alice Ferrazzi <alice.ferrazzi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
This commit is contained in:
parent
326f57a4c3
commit
748e84b79a
tools/testing/selftests/breakpoints
|
@ -42,10 +42,8 @@ static void set_breakpoint_addr(void *addr, int n)
|
||||||
|
|
||||||
ret = ptrace(PTRACE_POKEUSER, child_pid,
|
ret = ptrace(PTRACE_POKEUSER, child_pid,
|
||||||
offsetof(struct user, u_debugreg[n]), addr);
|
offsetof(struct user, u_debugreg[n]), addr);
|
||||||
if (ret) {
|
if (ret)
|
||||||
perror("Can't set breakpoint addr\n");
|
ksft_exit_fail_msg("Can't set breakpoint addr");
|
||||||
ksft_exit_fail();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void toggle_breakpoint(int n, int type, int len,
|
static void toggle_breakpoint(int n, int type, int len,
|
||||||
|
@ -105,10 +103,8 @@ static void toggle_breakpoint(int n, int type, int len,
|
||||||
|
|
||||||
ret = ptrace(PTRACE_POKEUSER, child_pid,
|
ret = ptrace(PTRACE_POKEUSER, child_pid,
|
||||||
offsetof(struct user, u_debugreg[7]), dr7);
|
offsetof(struct user, u_debugreg[7]), dr7);
|
||||||
if (ret) {
|
if (ret)
|
||||||
perror("Can't set dr7");
|
ksft_exit_fail_msg("Can't set dr7");
|
||||||
ksft_exit_fail();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dummy variables to test read/write accesses */
|
/* Dummy variables to test read/write accesses */
|
||||||
|
@ -264,26 +260,29 @@ static void check_success(const char *msg)
|
||||||
const char *msg2;
|
const char *msg2;
|
||||||
int child_nr_tests;
|
int child_nr_tests;
|
||||||
int status;
|
int status;
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Wait for the child to SIGTRAP */
|
/* Wait for the child to SIGTRAP */
|
||||||
wait(&status);
|
wait(&status);
|
||||||
|
|
||||||
msg2 = "Failed";
|
msg2 = "Failed";
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
if (WSTOPSIG(status) == SIGTRAP) {
|
if (WSTOPSIG(status) == SIGTRAP) {
|
||||||
child_nr_tests = ptrace(PTRACE_PEEKDATA, child_pid,
|
child_nr_tests = ptrace(PTRACE_PEEKDATA, child_pid,
|
||||||
&nr_tests, 0);
|
&nr_tests, 0);
|
||||||
if (child_nr_tests == nr_tests)
|
if (child_nr_tests == nr_tests)
|
||||||
msg2 = "Ok";
|
ret = 1;
|
||||||
if (ptrace(PTRACE_POKEDATA, child_pid, &trapped, 1)) {
|
if (ptrace(PTRACE_POKEDATA, child_pid, &trapped, 1))
|
||||||
perror("Can't poke\n");
|
ksft_exit_fail_msg("Can't poke");
|
||||||
ksft_exit_fail();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nr_tests++;
|
nr_tests++;
|
||||||
|
|
||||||
printf("%s [%s]\n", msg, msg2);
|
if (ret)
|
||||||
|
ksft_test_result_pass(msg);
|
||||||
|
else
|
||||||
|
ksft_test_result_fail(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void launch_instruction_breakpoints(char *buf, int local, int global)
|
static void launch_instruction_breakpoints(char *buf, int local, int global)
|
||||||
|
@ -378,6 +377,8 @@ int main(int argc, char **argv)
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ksft_print_header();
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
trigger_tests();
|
trigger_tests();
|
||||||
|
|
Loading…
Reference in New Issue