All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <shuahkh@osg.samsung.com>
To: akpm@linux-foundation.org, gregkh@linuxfoundation.org,
	colin.king@canonical.com, dbueso@suse.de, ebiederm@xmission.com,
	serge.hallyn@ubuntu.com, thierry@linux.vnet.ibm.com,
	felipensp@gmail.com
Cc: Shuah Khan <shuahkh@osg.samsung.com>,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/7] selftests/ptrace: change ptrace test to use kselftest exit codes
Date: Mon, 15 Sep 2014 16:34:01 -0600	[thread overview]
Message-ID: <1410820442-8774-7-git-send-email-shuahkh@osg.samsung.com> (raw)
In-Reply-To: <1410820442-8774-1-git-send-email-shuahkh@osg.samsung.com>

Change ptrace test to use kselftest exit codes in kselftest.h
to report test results.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 tools/testing/selftests/ptrace/peeksiginfo.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/ptrace/peeksiginfo.c b/tools/testing/selftests/ptrace/peeksiginfo.c
index c34cd8a..4d18964 100644
--- a/tools/testing/selftests/ptrace/peeksiginfo.c
+++ b/tools/testing/selftests/ptrace/peeksiginfo.c
@@ -10,6 +10,7 @@
 #include <sys/mman.h>
 
 #include "linux/ptrace.h"
+#include "../kselftest.h"
 
 static int sys_rt_sigqueueinfo(pid_t tgid, int sig, siginfo_t *uinfo)
 {
@@ -43,7 +44,7 @@ static int sys_ptrace(int request, pid_t pid, void *addr, void *data)
 static int check_error_paths(pid_t child)
 {
 	struct ptrace_peeksiginfo_args arg;
-	int ret, exit_code = -1;
+	int ret, exit_code = EXIT_FAIL;
 	void *addr_rw, *addr_ro;
 
 	/*
@@ -95,7 +96,7 @@ static int check_error_paths(pid_t child)
 		goto out;
 	}
 
-	exit_code = 0;
+	exit_code = EXIT_PASS;
 out:
 	munmap(addr_rw, 2 * PAGE_SIZE);
 	return exit_code;
@@ -104,7 +105,7 @@ out:
 int check_direct_path(pid_t child, int shared, int nr)
 {
 	struct ptrace_peeksiginfo_args arg = {.flags = 0, .nr = nr, .off = 0};
-	int i, j, ret, exit_code = -1;
+	int i, j, ret, exit_code = EXIT_FAIL;
 	siginfo_t siginfo[SIGNR];
 	int si_code;
 
@@ -143,7 +144,7 @@ int check_direct_path(pid_t child, int shared, int nr)
 		goto out;
 	}
 
-	exit_code = 0;
+	exit_code = EXIT_PASS;
 out:
 	return exit_code;
 }
@@ -151,7 +152,7 @@ out:
 int main(int argc, char *argv[])
 {
 	siginfo_t siginfo[SIGNR];
-	int i, exit_code = 1;
+	int i, exit_code = EXIT_FAIL;
 	sigset_t blockmask;
 	pid_t child;
 
@@ -162,7 +163,7 @@ int main(int argc, char *argv[])
 	child = fork();
 	if (child == -1) {
 		err("fork() failed: %m");
-		return 1;
+		return exit_code;
 	} else if (child == 0) {
 		pid_t ppid = getppid();
 		while (1) {
@@ -170,7 +171,7 @@ int main(int argc, char *argv[])
 				break;
 			sleep(1);
 		}
-		return 1;
+		return exit_code;
 	}
 
 	/* Send signals in process-wide and per-thread queues */
@@ -185,7 +186,7 @@ int main(int argc, char *argv[])
 	}
 
 	if (sys_ptrace(PTRACE_ATTACH, child, NULL, NULL) == -1)
-		return 1;
+		return exit_code;
 
 	waitpid(child, NULL, 0);
 
@@ -207,10 +208,10 @@ int main(int argc, char *argv[])
 		goto out;
 
 	printf("PASS\n");
-	exit_code = 0;
+	exit_code = EXIT_PASS;
 out:
 	if (sys_ptrace(PTRACE_KILL, child, NULL, NULL) == -1)
-		return 1;
+		return exit_code;
 
 	waitpid(child, NULL, 0);
 
-- 
1.9.1


  parent reply	other threads:[~2014-09-15 22:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 22:33 [PATCH 0/7] kselftest new exit codes and test changes to use them Shuah Khan
2014-09-15 22:33 ` [PATCH 1/7] selftests: add header file for test exit code defines Shuah Khan
2014-09-16 16:04   ` Davidlohr Bueso
2014-09-16 16:04     ` Davidlohr Bueso
2014-09-16 17:31     ` Shuah Khan
2014-09-16 17:31       ` Shuah Khan
2014-09-16 17:40       ` Andy Lutomirski
2014-09-16 17:40         ` Andy Lutomirski
2014-09-16 17:47         ` Shuah Khan
2014-09-16 17:47           ` Shuah Khan
2014-09-15 22:33 ` [PATCH 2/7] selftests/breakpoints: change breakpoints test to use kselftest exit codes Shuah Khan
2014-09-15 22:33 ` [PATCH 3/7] selftests/ipc: change ipc " Shuah Khan
2014-09-15 22:33   ` Shuah Khan
2014-09-15 22:33 ` [PATCH 4/7] selftests/kcmp: change kcmp " Shuah Khan
2014-09-15 22:34 ` [PATCH 5/7] selftests/mount: change mount " Shuah Khan
2014-09-15 22:34 ` Shuah Khan [this message]
2014-09-15 22:34 ` [PATCH 7/7] selftests/timers: change timers " Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410820442-8774-7-git-send-email-shuahkh@osg.samsung.com \
    --to=shuahkh@osg.samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=colin.king@canonical.com \
    --cc=dbueso@suse.de \
    --cc=ebiederm@xmission.com \
    --cc=felipensp@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge.hallyn@ubuntu.com \
    --cc=thierry@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.