[patch 2/2] selftests: kcmp: used the reason on kcmp.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alice Ferrazzi <alice.ferrazzi@xxxxxxxxx>

converted kcmp_test using reason output.

Signed-off-by: alice ferrazzi <alice.ferrazzi@xxxxxxxxx>
---
 tools/testing/selftests/kcmp/kcmp_test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c
index 034d3a7263..7f5770a87d 100644
--- a/tools/testing/selftests/kcmp/kcmp_test.c
+++ b/tools/testing/selftests/kcmp/kcmp_test.c
@@ -47,6 +47,7 @@ int main(int argc, char **argv)
 		int pid2 = getpid();
 		int ret;
 		char buf[512];
+		char buf2[512];
 
 		fd2 = open(kpath, O_RDWR, 0644);
 		if (fd2 < 0) {
@@ -54,7 +55,7 @@ int main(int argc, char **argv)
 		}
 
 		/* An example of output and arguments */
-		snprintf(buf, sizeof(buf) ,"pid1: %6d pid2: %6d FD: %2ld FILES: %2ld VM: %2ld "
+		snprintf(buf2, sizeof(buf2), "pid1: %6d pid2: %6d FD: %2ld FILES: %2ld VM: %2ld "
 		       "FS: %2ld SIGHAND: %2ld IO: %2ld SYSVSEM: %2ld "
 		       "INV: %2ld",
 		       pid1, pid2,
@@ -71,14 +72,13 @@ int main(int argc, char **argv)
 
 		/* This one should return same fd */
 		ret = sys_kcmp(pid1, pid2, KCMP_FILE, fd1, fd1);
-		ksft_test_result_pass(buf);
 		if (ret) {
 			snprintf(buf, sizeof(buf), "0 expected but %d returned (%s)",
 				ret, strerror(errno));
-			ksft_test_result_fail(buf);
+			ksft_test_result_fail(buf, buf2);
 			ret = -1;
 		} else {
-			ksft_test_result_pass("0 returned as expected");
+			ksft_test_result_pass("0 returned as expected", buf2);
 		}
 
 		/* Compare with self */
@@ -86,10 +86,10 @@ int main(int argc, char **argv)
 		if (ret) {
 			snprintf(buf, sizeof(buf), "0 expected but %d returned (%s)",
 				ret, strerror(errno));
-			ksft_test_result_fail(buf);
+			ksft_test_result_fail(buf, NULL);
 			ret = -1;
 		} else {
-			ksft_test_result_pass("0 returned as expected");
+			ksft_test_result_pass("0 returned as expected", NULL);
 		}
 
 		if (ret)
-- 
2.13.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux