Commit b9012164 authored by Paul Elder's avatar Paul Elder Committed by Shuah Khan
Browse files

kselftest: breakpoints: convert step_after_suspend_test to TAP13 output



Make the step_after_suspend test output in the TAP13 format by using the
TAP13 output functions defined in kselftest.h

Signed-off-by: default avatarPaul Elder <paul.elder@pitt.edu>
Signed-off-by: default avatarAlice Ferrazzi <alice.ferrazzi@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
parent 748e84b7
Loading
Loading
Loading
Loading
+17 −26
Original line number Original line Diff line number Diff line
@@ -135,28 +135,21 @@ void suspend(void)
	struct itimerspec spec = {};
	struct itimerspec spec = {};


	power_state_fd = open("/sys/power/state", O_RDWR);
	power_state_fd = open("/sys/power/state", O_RDWR);
	if (power_state_fd < 0) {
	if (power_state_fd < 0)
		perror("open(\"/sys/power/state\") failed (is this test running as root?)");
		ksft_exit_fail_msg(
		ksft_exit_fail();
			"open(\"/sys/power/state\") failed (is this test running as root?)");
	}


	timerfd = timerfd_create(CLOCK_BOOTTIME_ALARM, 0);
	timerfd = timerfd_create(CLOCK_BOOTTIME_ALARM, 0);
	if (timerfd < 0) {
	if (timerfd < 0)
		perror("timerfd_create() failed");
		ksft_exit_fail_msg("timerfd_create() failed");
		ksft_exit_fail();
	}


	spec.it_value.tv_sec = 5;
	spec.it_value.tv_sec = 5;
	err = timerfd_settime(timerfd, 0, &spec, NULL);
	err = timerfd_settime(timerfd, 0, &spec, NULL);
	if (err < 0) {
	if (err < 0)
		perror("timerfd_settime() failed");
		ksft_exit_fail_msg("timerfd_settime() failed");
		ksft_exit_fail();
	}


	if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem")) {
	if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem"))
		perror("entering suspend failed");
		ksft_exit_fail_msg("entering suspend failed");
		ksft_exit_fail();
	}


	close(timerfd);
	close(timerfd);
	close(power_state_fd);
	close(power_state_fd);
@@ -170,6 +163,9 @@ int main(int argc, char **argv)
	cpu_set_t available_cpus;
	cpu_set_t available_cpus;
	int err;
	int err;
	int cpu;
	int cpu;
	char buf[10];

	ksft_print_header();


	while ((opt = getopt(argc, argv, "n")) != -1) {
	while ((opt = getopt(argc, argv, "n")) != -1) {
		switch (opt) {
		switch (opt) {
@@ -187,10 +183,8 @@ int main(int argc, char **argv)
		suspend();
		suspend();


	err = sched_getaffinity(0, sizeof(available_cpus), &available_cpus);
	err = sched_getaffinity(0, sizeof(available_cpus), &available_cpus);
	if (err < 0) {
	if (err < 0)
		perror("sched_getaffinity() failed");
		ksft_exit_fail_msg("sched_getaffinity() failed");
		ksft_exit_fail();
	}


	for (cpu = 0; cpu < CPU_SETSIZE; cpu++) {
	for (cpu = 0; cpu < CPU_SETSIZE; cpu++) {
		bool test_success;
		bool test_success;
@@ -199,18 +193,15 @@ int main(int argc, char **argv)
			continue;
			continue;


		test_success = run_test(cpu);
		test_success = run_test(cpu);
		printf("CPU %d: ", cpu);
		sprintf(buf, "CPU %d", cpu);
		if (test_success) {
		if (test_success) {
			printf("[OK]\n");
			ksft_test_result_pass(buf);
			ksft_inc_pass_cnt();
		} else {
		} else {
			printf("[FAILED]\n");
			ksft_test_result_fail(buf);
			ksft_inc_fail_cnt();
			succeeded = false;
			succeeded = false;
		}
		}
	}
	}


	ksft_print_cnts();
	if (succeeded)
	if (succeeded)
		ksft_exit_pass();
		ksft_exit_pass();
	else
	else