All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 02/10] syscalls/uname: Make use of TST_EXP_MACROS
Date: Thu, 10 Dec 2020 15:15:40 +0100	[thread overview]
Message-ID: <20201210141548.10982-3-chrubis@suse.cz> (raw)
In-Reply-To: <20201210141548.10982-1-chrubis@suse.cz>

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/uname/uname01.c | 13 +++----------
 testcases/kernel/syscalls/uname/uname02.c | 17 +----------------
 2 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/testcases/kernel/syscalls/uname/uname01.c b/testcases/kernel/syscalls/uname/uname01.c
index bd3b05303..5e2f5ffac 100644
--- a/testcases/kernel/syscalls/uname/uname01.c
+++ b/testcases/kernel/syscalls/uname/uname01.c
@@ -18,24 +18,17 @@ static void verify_uname(void)
 
 	memset(&un, 0, sizeof(un));
 
-	TEST(uname(&un));
-	if (TST_RET == -1) {
-		tst_res(TFAIL | TTERRNO, "uname() failed");
-		return;
-	}
+	TST_EXP_PASS(uname(&un));
 
-	if (TST_RET != 0) {
-		tst_res(TFAIL | TTERRNO,
-			"uname() returned invalid value %ld", TST_RET);
+	if (!TST_PASS)
 		return;
-	}
 
 	if (strcmp(un.sysname, "Linux")) {
 		tst_res(TFAIL, "sysname is not Linux");
 		return;
 	}
 
-	tst_res(TPASS, "uname() succeeded");
+	tst_res(TPASS, "sysname set to Linux");
 }
 
 static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/uname/uname02.c b/testcases/kernel/syscalls/uname/uname02.c
index 1903dae24..cd4b15487 100644
--- a/testcases/kernel/syscalls/uname/uname02.c
+++ b/testcases/kernel/syscalls/uname/uname02.c
@@ -16,22 +16,7 @@ static void *bad_addr;
 
 static void verify_uname(void)
 {
-	TEST(uname(bad_addr));
-	if (TST_RET == 0) {
-		tst_res(TFAIL, "uname() succeed when failure expected");
-		return;
-	}
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "Invalid uname() return value %ld", TST_RET);
-		return;
-	}
-
-	if (TST_ERR == EFAULT)
-		tst_res(TPASS, "uname() got EFAULT as expected");
-	else
-		tst_res(TFAIL | TTERRNO, "uname() failed unexpectedly");
-
+	TST_EXP_FAIL(uname(bad_addr), EFAULT);
 }
 
 static void setup(void)
-- 
2.26.2


  parent reply	other threads:[~2020-12-10 14:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 14:15 [LTP] [PATCH v2 00/10] Introduce TST_EXP_MACROS Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 01/10] lib: Introduce TST_EXP_* macros Cyril Hrubis
2020-12-10 14:15 ` Cyril Hrubis [this message]
2020-12-10 14:15 ` [LTP] [PATCH v2 03/10] syscalls/accept: Make use of TST_EXP_MACROS Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 04/10] syscalls/access: " Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 05/10] syscalls/bind: " Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 06/10] syscalls/brk01: " Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 07/10] syscalls/cacheflush: " Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 08/10] syscalls/capget: Make use of TEST_MACROS Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 09/10] syscalls/capset: Make use of TST_EXP_MACROS Cyril Hrubis
2020-12-10 14:15 ` [LTP] [PATCH v2 10/10] syscalls/open: " Cyril Hrubis
2020-12-11 10:45 ` [LTP] [PATCH v2 00/10] Introduce TST_EXP_MACROS Li Wang
2020-12-11 13:34   ` Cyril Hrubis
2020-12-11 12:45 ` Petr Vorel
2020-12-11 13:34   ` Cyril Hrubis

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=20201210141548.10982-3-chrubis@suse.cz \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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.