[PATCH] selftests/powerpc: Fix subpage_prot test to return !0 on failure

Subsystems: kernel selftest framework, the rest

STALE3755d

4 messages, 2 authors, 2016-05-04 · open the first message on its own page

[PATCH] selftests/powerpc: Fix subpage_prot test to return !0 on failure

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-05-02 04:54:35

It's helpful for automated testing if the test returns error codes back
to the calling program.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 tools/testing/selftests/powerpc/mm/subpage_prot.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/powerpc/mm/subpage_prot.c b/tools/testing/selftests/powerpc/mm/subpage_prot.c
index 440180ff8089..7ccdc96b977d 100644
--- a/tools/testing/selftests/powerpc/mm/subpage_prot.c
+++ b/tools/testing/selftests/powerpc/mm/subpage_prot.c
@@ -207,14 +207,16 @@ int test_file(void)
 
 int main(int argc, char *argv[])
 {
-	test_harness(test_anon, "subpage_prot_anon");
+	int rc;
+
+	rc = test_harness(test_anon, "subpage_prot_anon");
+	if (rc)
+		return rc;
 
 	if (argc > 1)
 		file_name = argv[1];
 	else
 		file_name = "tempfile";
 
-	test_harness(test_file, "subpage_prot_file");
-
-	return 0;
+	return test_harness(test_file, "subpage_prot_file");
 }
-- 
2.5.0

Re: [PATCH] selftests/powerpc: Fix subpage_prot test to return !0 on failure

From: Aneesh Kumar K.V <hidden>
Date: 2016-05-02 11:18:12

Michael Ellerman [off-list ref] writes:
It's helpful for automated testing if the test returns error codes back
to the calling program.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Reviewed-by: Aneesh Kumar K.V <redacted>
quoted hunk
---
 tools/testing/selftests/powerpc/mm/subpage_prot.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/powerpc/mm/subpage_prot.c b/tools/testing/selftests/powerpc/mm/subpage_prot.c
index 440180ff8089..7ccdc96b977d 100644
--- a/tools/testing/selftests/powerpc/mm/subpage_prot.c
+++ b/tools/testing/selftests/powerpc/mm/subpage_prot.c
@@ -207,14 +207,16 @@ int test_file(void)

 int main(int argc, char *argv[])
 {
-	test_harness(test_anon, "subpage_prot_anon");
+	int rc;
+
+	rc = test_harness(test_anon, "subpage_prot_anon");
+	if (rc)
+		return rc;

 	if (argc > 1)
 		file_name = argv[1];
 	else
 		file_name = "tempfile";

-	test_harness(test_file, "subpage_prot_file");
-
-	return 0;
+	return test_harness(test_file, "subpage_prot_file");
 }
-- 
2.5.0

Re: [PATCH] selftests/powerpc: Fix subpage_prot test to return !0 on failure

From: Aneesh Kumar K.V <hidden>
Date: 2016-05-03 05:57:39

"Aneesh Kumar K.V" [off-list ref] writes:
Michael Ellerman [off-list ref] writes:
quoted
It's helpful for automated testing if the test returns error codes back
to the calling program.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Reviewed-by: Aneesh Kumar K.V <redacted>
quoted
---
 tools/testing/selftests/powerpc/mm/subpage_prot.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/powerpc/mm/subpage_prot.c b/tools/testing/selftests/powerpc/mm/subpage_prot.c
index 440180ff8089..7ccdc96b977d 100644
--- a/tools/testing/selftests/powerpc/mm/subpage_prot.c
+++ b/tools/testing/selftests/powerpc/mm/subpage_prot.c
@@ -207,14 +207,16 @@ int test_file(void)

 int main(int argc, char *argv[])
 {
-	test_harness(test_anon, "subpage_prot_anon");
+	int rc;
+
+	rc = test_harness(test_anon, "subpage_prot_anon");
+	if (rc)
+		return rc;

 	if (argc > 1)
 		file_name = argv[1];
 	else
 		file_name = "tempfile";

-	test_harness(test_file, "subpage_prot_file");
-
-	return 0;
+	return test_harness(test_file, "subpage_prot_file");
 }
-- 
2.5.0
While doing this fix the error print ?

520175565: (4520111850): Failed at 0x0x3fffad4b0000 (p=13,sp=0,w=0), want=fault, got=pass !
diff --git a/tools/testing/selftests/powerpc/mm/subpage_prot.c b/tools/testing/selftests/powerpc/mm/subpage_prot.c
index 440180ff8089..5929866aa444 100644
--- a/tools/testing/selftests/powerpc/mm/subpage_prot.c
+++ b/tools/testing/selftests/powerpc/mm/subpage_prot.c
@@ -73,7 +73,7 @@ static inline void check_faulted(void *addr, long page, long subpage, int write)
 		want_fault |= (subpage == ((page + 1) % 16));
 
 	if (faulted != want_fault) {
-		printf("Failed at 0x%p (p=%ld,sp=%ld,w=%d), want=%s, got=%s !\n",
+		printf("Failed at %p (p=%ld,sp=%ld,w=%d), want=%s, got=%s !\n",
 		       addr, page, subpage, write,
 		       want_fault ? "fault" : "pass",
 		       faulted ? "fault" : "pass");

Re: selftests/powerpc: Fix subpage_prot test to return !0 on failure

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2016-05-04 22:40:31

On Mon, 2016-02-05 at 04:54:29 UTC, Michael Ellerman wrote:
It's helpful for automated testing if the test returns error codes back
to the calling program.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Aneesh Kumar K.V <redacted>
Applied to powerpc next.

https://git.kernel.org/powerpc/c/3a19e500d8cdb39ef9ce128933

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help