All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 00/10] Introduce TEST_MACROS
@ 2020-11-13 13:14 Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros Cyril Hrubis
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

This is a RFC for a TEST_MACROS() implementation.

These macros are intended to simplify and unify syscall unit tests.

This patchset converts a few testcases to use TEST_MACROS it's
intenteded to serve as an example since there is a lot of testcases that
could use them as well.

Also the documentation for these macros is ommited at this point, I will
add it in a case that we agree to include them in the test library.

Cyril Hrubis (10):
  lib: Introduce more TEST_* macros
  syscalls/uname: Make use of TEST_MACROS
  syscalls/accept: Make use of TEST_MACROS
  syscalls/access: Make use of TEST_MACROS
  syscalls/bind: Make use of TEST_MACROS
  syscalls/brk01: Make use of TEST_MACROS
  syscalls/cacheflush: Make use of TEST_MACROS
  syscalls/capget: Make use of TEST_MACROS
  syscalls/capset: Make use of TEST_MACROS
  syscalls/open: Make use of TEST_MACROS

 include/tst_test.h                            |  28 +---
 include/tst_test_macros.h                     | 131 ++++++++++++++++++
 lib/newlib_tests/.gitignore                   |   3 +
 lib/newlib_tests/test_macros01.c              |  40 ++++++
 lib/newlib_tests/test_macros02.c              |  42 ++++++
 lib/newlib_tests/test_macros03.c              |  40 ++++++
 lib/tst_test.c                                |   1 +
 testcases/kernel/syscalls/accept/accept01.c   |  17 +--
 testcases/kernel/syscalls/access/access01.c   |  43 +-----
 testcases/kernel/syscalls/access/access02.c   |   8 +-
 testcases/kernel/syscalls/access/access03.c   |  28 +---
 testcases/kernel/syscalls/bind/bind01.c       |  12 +-
 testcases/kernel/syscalls/bind/bind02.c       |  11 +-
 testcases/kernel/syscalls/bind/bind03.c       |  26 +---
 testcases/kernel/syscalls/bind/bind04.c       |   5 +-
 testcases/kernel/syscalls/bind/bind05.c       |   5 +-
 testcases/kernel/syscalls/brk/brk01.c         |   9 +-
 .../kernel/syscalls/cacheflush/cacheflush01.c |   8 +-
 testcases/kernel/syscalls/capget/capget01.c   |  17 +--
 testcases/kernel/syscalls/capget/capget02.c   |  26 ++--
 testcases/kernel/syscalls/capset/capset01.c   |  14 +-
 testcases/kernel/syscalls/capset/capset02.c   |  28 ++--
 testcases/kernel/syscalls/capset/capset03.c   |  10 +-
 testcases/kernel/syscalls/capset/capset04.c   |  13 +-
 testcases/kernel/syscalls/open/open01.c       |  11 +-
 testcases/kernel/syscalls/open/open02.c       |  25 +---
 testcases/kernel/syscalls/open/open11.c       |  22 ++-
 testcases/kernel/syscalls/uname/uname01.c     |  13 +-
 testcases/kernel/syscalls/uname/uname02.c     |  17 +--
 29 files changed, 348 insertions(+), 305 deletions(-)
 create mode 100644 include/tst_test_macros.h
 create mode 100644 lib/newlib_tests/test_macros01.c
 create mode 100644 lib/newlib_tests/test_macros02.c
 create mode 100644 lib/newlib_tests/test_macros03.c

-- 
2.26.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 20:28   ` Petr Vorel
  2020-11-25 16:54   ` Martin Doucha
  2020-11-13 13:14 ` [LTP] [PATCH 02/10] syscalls/uname: Make use of TEST_MACROS Cyril Hrubis
                   ` (8 subsequent siblings)
  9 siblings, 2 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

In order to simplify common return value checks.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 include/tst_test.h               |  28 +------
 include/tst_test_macros.h        | 131 +++++++++++++++++++++++++++++++
 lib/newlib_tests/.gitignore      |   3 +
 lib/newlib_tests/test_macros01.c |  40 ++++++++++
 lib/newlib_tests/test_macros02.c |  42 ++++++++++
 lib/newlib_tests/test_macros03.c |  40 ++++++++++
 lib/tst_test.c                   |   1 +
 7 files changed, 258 insertions(+), 27 deletions(-)
 create mode 100644 include/tst_test_macros.h
 create mode 100644 lib/newlib_tests/test_macros01.c
 create mode 100644 lib/newlib_tests/test_macros02.c
 create mode 100644 lib/newlib_tests/test_macros03.c

diff --git a/include/tst_test.h b/include/tst_test.h
index c91d3f18a..6d188a650 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -18,6 +18,7 @@
 
 #include "tst_common.h"
 #include "tst_res_flags.h"
+#include "tst_test_macros.h"
 #include "tst_checkpoint.h"
 #include "tst_device.h"
 #include "tst_mkfs.h"
@@ -269,33 +270,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
  */
 void tst_reinit(void);
 
-//TODO Clean?
-#define TEST(SCALL) \
-	do { \
-		errno = 0; \
-		TST_RET = SCALL; \
-		TST_ERR = errno; \
-	} while (0)
-
-#define TEST_VOID(SCALL) \
-	do { \
-		errno = 0; \
-		SCALL; \
-		TST_ERR = errno; \
-	} while (0)
-
-extern long TST_RET;
-extern int TST_ERR;
-
-extern void *TST_RET_PTR;
-
-#define TESTPTR(SCALL) \
-	do { \
-		errno = 0; \
-		TST_RET_PTR = (void*)SCALL; \
-		TST_ERR = errno; \
-	} while (0)
-
 /*
  * Functions to convert ERRNO to its name and SIGNAL to its name.
  */
diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
new file mode 100644
index 000000000..69de2ce3d
--- /dev/null
+++ b/include/tst_test_macros.h
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2015-2020 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef TST_TEST_MACROS_H__
+#define TST_TEST_MACROS_H__
+
+#define TEST(SCALL) \
+	do { \
+		errno = 0; \
+		TST_RET = SCALL; \
+		TST_ERR = errno; \
+	} while (0)
+
+#define TEST_VOID(SCALL) \
+	do { \
+		errno = 0; \
+		SCALL; \
+		TST_ERR = errno; \
+	} while (0)
+
+extern long TST_RET;
+extern int TST_ERR;
+extern int TST_PASS;
+
+extern void *TST_RET_PTR;
+
+#define TESTPTR(SCALL) \
+	do { \
+		errno = 0; \
+		TST_RET_PTR = (void*)SCALL; \
+		TST_ERR = errno; \
+	} while (0)
+
+
+#define TEST_2(_1, _2, ...) _2
+
+#define TEST_FMT_(FMT, _1, ...) FMT, ##__VA_ARGS__
+
+#define TEST_MSG(RES, FMT, SCALL, ...) \
+	tst_res_(__FILE__, __LINE__, RES, \
+		TEST_FMT_(TEST_2(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__))
+
+#define TEST_MSGP(RES, FMT, PAR, SCALL, ...) \
+	tst_res_(__FILE__, __LINE__, RES, \
+		TEST_FMT_(TEST_2(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__), PAR)
+
+#define TEST_FD(SCALL, ...)                                                    \
+	do {                                                                   \
+		TEST(SCALL);                                                   \
+		                                                               \
+		TST_PASS = 0;                                                  \
+		                                                               \
+		if (TST_RET == -1) {                                           \
+			TEST_MSG(TFAIL | TTERRNO, " failed",                   \
+			         #SCALL, ##__VA_ARGS__);                       \
+		        break;                                                 \
+		}                                                              \
+		                                                               \
+		if (TST_RET < 0) {                                             \
+			TEST_MSGP(TFAIL | TTERRNO, " invalid retval %ld",      \
+				  TST_RET, #SCALL, ##__VA_ARGS__);             \
+			break;                                                 \
+		}                                                              \
+                                                                               \
+		TEST_MSGP(TPASS, " returned fd %ld", TST_RET,                  \
+		          #SCALL, ##__VA_ARGS__);                              \
+                                                                               \
+                TST_PASS = 1;                                                  \
+                                                                               \
+	} while (0)
+
+#define TEST_PASS(SCALL, ...)                                                  \
+	do {                                                                   \
+		TEST(SCALL);                                                   \
+		                                                               \
+		TST_PASS = 0;                                                  \
+		                                                               \
+		if (TST_RET == -1) {                                           \
+			TEST_MSG(TFAIL | TTERRNO, " failed",                   \
+			         #SCALL, ##__VA_ARGS__);                       \
+		        break;                                                 \
+		}                                                              \
+		                                                               \
+		if (TST_RET != 0) {                                            \
+			TEST_MSGP(TFAIL | TTERRNO, " invalid retval %ld",      \
+                                  TST_RET, #SCALL, ##__VA_ARGS__);             \
+			break;                                                 \
+		}                                                              \
+                                                                               \
+		TEST_MSG(TPASS, " passed", #SCALL, ##__VA_ARGS__);             \
+                                                                               \
+                TST_PASS = 1;                                                  \
+                                                                               \
+	} while (0)
+
+
+#define TEST_FAIL(SCALL, ERRNO, ...)                                           \
+	do {                                                                   \
+		TEST(SCALL);                                                   \
+		                                                               \
+		TST_PASS = 0;                                                  \
+		                                                               \
+		if (TST_RET == 0) {                                            \
+			TEST_MSG(TFAIL | TTERRNO, " succeeded",                \
+			         #SCALL, ##__VA_ARGS__);                       \
+		        break;                                                 \
+		}                                                              \
+		                                                               \
+		if (TST_RET != -1) {                                           \
+			TEST_MSGP(TFAIL | TTERRNO, " invalid retval %ld",      \
+                                  TST_RET, #SCALL, ##__VA_ARGS__);             \
+			break;                                                 \
+		}                                                              \
+		                                                               \
+		if (ERRNO) {                                                   \
+			if (TST_ERR == ERRNO) {                                \
+				TEST_MSG(TPASS | TERRNO, "",                   \
+				         #SCALL, ##__VA_ARGS__);               \
+				TST_PASS = 1;                                  \
+			} else {                                               \
+				TEST_MSGP(TFAIL | TERRNO, " expected %s",      \
+				          tst_strerrno(ERRNO),                 \
+				          #SCALL, ##__VA_ARGS__);              \
+			}                                                      \
+		}                                                              \
+	} while (0)
+
+
+#endif	/* TST_TEST_MACROS_H__ */
diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
index ac1d19be0..a5c652c99 100644
--- a/lib/newlib_tests/.gitignore
+++ b/lib/newlib_tests/.gitignore
@@ -36,3 +36,6 @@ test_kconfig02
 variant
 test_guarded_buf
 tst_bool_expr
+test_macros01
+test_macros02
+test_macros03
diff --git a/lib/newlib_tests/test_macros01.c b/lib/newlib_tests/test_macros01.c
new file mode 100644
index 000000000..8b315b30f
--- /dev/null
+++ b/lib/newlib_tests/test_macros01.c
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * Test macros.
+ */
+
+#include "tst_test.h"
+
+static int fail_fd(void)
+{
+	errno = EINVAL;
+	return -1;
+}
+
+static int pass_fd(void)
+{
+	return 42;
+}
+
+static int inval_val(void)
+{
+	return -42;
+}
+
+static void do_test(void)
+{
+	TEST_FD(fail_fd(), "TEST DESCRIPTION");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TEST_FD(pass_fd(), "%s", "TEST DESCRIPTION PARAM");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TEST_FD(inval_val());
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+}
+
+static struct tst_test test = {
+	.test_all = do_test,
+};
diff --git a/lib/newlib_tests/test_macros02.c b/lib/newlib_tests/test_macros02.c
new file mode 100644
index 000000000..41b685a36
--- /dev/null
+++ b/lib/newlib_tests/test_macros02.c
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * Test macros.
+ */
+
+#include "tst_test.h"
+
+static int fail_fn(void)
+{
+	errno = EINVAL;
+	return -1;
+}
+
+static int pass_fn(void)
+{
+	return 0;
+}
+
+static int inval_ret_fn(void)
+{
+	return 42;
+}
+
+static void do_test(void)
+{
+	TEST_FAIL(fail_fn(), EINVAL);
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TEST_FAIL(fail_fn(), ENOTTY);
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TEST_FAIL(pass_fn(), ENOTTY);
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TEST_FAIL(inval_ret_fn(), ENOTTY, "TEST DESCRIPTION");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+}
+
+static struct tst_test test = {
+	.test_all = do_test,
+};
diff --git a/lib/newlib_tests/test_macros03.c b/lib/newlib_tests/test_macros03.c
new file mode 100644
index 000000000..731715308
--- /dev/null
+++ b/lib/newlib_tests/test_macros03.c
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+/*
+ * Test macros.
+ */
+
+#include "tst_test.h"
+
+static int fail_fn(void)
+{
+	errno = EINVAL;
+	return -1;
+}
+
+static int pass_fn(void)
+{
+	return 0;
+}
+
+static int inval_ret_fn(void)
+{
+	return 42;
+}
+
+static void do_test(void)
+{
+	TEST_PASS(fail_fn());
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TEST_PASS(pass_fn(), "TEST DESCRIPTION");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TEST_PASS(inval_ret_fn());
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+}
+
+static struct tst_test test = {
+	.test_all = do_test,
+};
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 535c0ff4c..6700a4eef 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -74,6 +74,7 @@ const char *tst_ipc_path = ipc_path;
 static char shm_path[1024];
 
 int TST_ERR;
+int TST_PASS;
 long TST_RET;
 
 static void do_cleanup(void);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 02/10] syscalls/uname: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 03/10] syscalls/accept: " Cyril Hrubis
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

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..999a9efd2 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;
-	}
+	TEST_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..b4c5457cd 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");
-
+	TEST_FAIL(uname(bad_addr), EFAULT);
 }
 
 static void setup(void)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 03/10] syscalls/accept: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 02/10] syscalls/uname: Make use of TEST_MACROS Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 04/10] syscalls/access: " Cyril Hrubis
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/accept/accept01.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/testcases/kernel/syscalls/accept/accept01.c b/testcases/kernel/syscalls/accept/accept01.c
index 4e30906f2..141400e54 100644
--- a/testcases/kernel/syscalls/accept/accept01.c
+++ b/testcases/kernel/syscalls/accept/accept01.c
@@ -95,21 +95,8 @@ void verify_accept(unsigned int nr)
 {
 	struct test_case *tcase = &tcases[nr];
 
-	TEST(accept(*tcase->fd, tcase->sockaddr, &tcase->salen));
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "%s: returned %li, expected -1",
-				tcase->desc, TST_RET);
-		return;
-	}
-
-	if (TST_ERR != tcase->experrno) {
-		tst_res(TFAIL | TTERRNO, "%s: expected errno %s, got ",
-				tcase->desc, tst_strerrno(tcase->experrno));
-		return;
-	}
-
-	tst_res(TPASS | TTERRNO, "%s successful", tcase->desc);
+	TEST_FAIL(accept(*tcase->fd, tcase->sockaddr, &tcase->salen),
+	          tcase->experrno, "%s", tcase->desc);
 }
 
 static struct tst_test test = {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 04/10] syscalls/access: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
                   ` (2 preceding siblings ...)
  2020-11-13 13:14 ` [LTP] [PATCH 03/10] syscalls/accept: " Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 05/10] syscalls/bind: " Cyril Hrubis
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/access/access01.c | 43 ++++-----------------
 testcases/kernel/syscalls/access/access02.c |  8 ++--
 testcases/kernel/syscalls/access/access03.c | 28 ++------------
 3 files changed, 14 insertions(+), 65 deletions(-)

diff --git a/testcases/kernel/syscalls/access/access01.c b/testcases/kernel/syscalls/access/access01.c
index 1b73058d4..13cd2a51a 100644
--- a/testcases/kernel/syscalls/access/access01.c
+++ b/testcases/kernel/syscalls/access/access01.c
@@ -231,46 +231,17 @@ static struct tcase {
 	{DNAME_WX"/"FNAME_X, W_OK, "W_OK", EACCES, 1}
 };
 
-static void verify_success(struct tcase *tc, const char *user)
-{
-	if (TST_RET == -1) {
-		tst_res(TFAIL | TTERRNO,
-		        "access(%s, %s) as %s failed unexpectedly",
-		        tc->fname, tc->name, user);
-		return;
-	}
-
-	tst_res(TPASS, "access(%s, %s) as %s", tc->fname, tc->name, user);
-}
-
-static void verify_failure(struct tcase *tc, const char *user)
-{
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "access(%s, %s) as %s succeded unexpectedly",
-		        tc->fname, tc->name, user);
-		return;
-	}
-
-	if (TST_ERR != tc->exp_errno) {
-		tst_res(TFAIL | TTERRNO,
-		        "access(%s, %s) as %s should fail with %s",
-		        tc->fname, tc->name, user,
-		        tst_strerrno(tc->exp_errno));
-		return;
-	}
-
-	tst_res(TPASS | TTERRNO, "access(%s, %s) as %s",
-	        tc->fname, tc->name, user);
-}
-
 static void access_test(struct tcase *tc, const char *user)
 {
 	TEST(access(tc->fname, tc->mode));
 
-	if (tc->exp_errno)
-		verify_failure(tc, user);
-	else
-		verify_success(tc, user);
+	if (tc->exp_errno) {
+		TEST_FAIL(access(tc->fname, tc->mode), tc->exp_errno,
+		          "access(%s, %s) as %s", tc->fname, tc->name, user);
+	} else {
+		TEST_PASS(access(tc->fname, tc->mode),
+		          "access(%s, %s) as %s", tc->fname, tc->name, user);
+	}
 }
 
 static void verify_access(unsigned int n)
diff --git a/testcases/kernel/syscalls/access/access02.c b/testcases/kernel/syscalls/access/access02.c
index db1d350bf..3c4c1bb5e 100644
--- a/testcases/kernel/syscalls/access/access02.c
+++ b/testcases/kernel/syscalls/access/access02.c
@@ -59,13 +59,11 @@ static void access_test(struct tcase *tc, const char *user)
 	struct stat stat_buf;
 	char command[64];
 
-	TEST(access(tc->pathname, tc->mode));
+	TEST_PASS(access(tc->pathname, tc->mode),
+		  "access(%s, %s) as %s", tc->pathname, tc->name, user);
 
-	if (TST_RET == -1) {
-		tst_res(TFAIL | TTERRNO, "access(%s, %s) as %s failed",
-			tc->pathname, tc->name, user);
+	if (!TST_PASS)
 		return;
-	}
 
 	switch (tc->mode) {
 	case F_OK:
diff --git a/testcases/kernel/syscalls/access/access03.c b/testcases/kernel/syscalls/access/access03.c
index 612256c17..df20060d5 100644
--- a/testcases/kernel/syscalls/access/access03.c
+++ b/testcases/kernel/syscalls/access/access03.c
@@ -26,34 +26,13 @@ static struct tcase {
 	{(void *)-1, X_OK, "X_OK"},
 };
 
-static void access_test(struct tcase *tc, const char *user)
-{
-	TEST(access(tc->addr, tc->mode));
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "access(%p, %s) as %s succeeded unexpectedly",
-			tc->addr, tc->name, user);
-		return;
-	}
-
-	if (TST_ERR != EFAULT) {
-		tst_res(TFAIL | TTERRNO,
-			"access(%p, %s) as %s should fail with EFAULT",
-			tc->addr, tc->name, user);
-		return;
-	}
-
-	tst_res(TPASS | TTERRNO, "access(%p, %s) as %s",
-		tc->addr, tc->name, user);
-}
-
 static void verify_access(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
 	pid_t pid;
 
-	/* test as root */
-	access_test(tc, "root");
+	TEST_FAIL(access(tc->addr, tc->mode), EFAULT,
+	          "invalid address as root");
 
 	/* test as nobody */
 	pid = SAFE_FORK();
@@ -61,7 +40,8 @@ static void verify_access(unsigned int n)
 		SAFE_WAITPID(pid, NULL, 0);
 	} else {
 		SAFE_SETUID(uid);
-		access_test(tc, "nobody");
+		TEST_FAIL(access(tc->addr, tc->mode), EFAULT,
+		          "invalid address as nobody");
 	}
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 05/10] syscalls/bind: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
                   ` (3 preceding siblings ...)
  2020-11-13 13:14 ` [LTP] [PATCH 04/10] syscalls/access: " Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 06/10] syscalls/brk01: " Cyril Hrubis
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/bind/bind01.c | 12 +++++-------
 testcases/kernel/syscalls/bind/bind02.c | 11 ++---------
 testcases/kernel/syscalls/bind/bind03.c | 26 ++++---------------------
 testcases/kernel/syscalls/bind/bind04.c |  5 ++---
 testcases/kernel/syscalls/bind/bind05.c |  5 ++---
 5 files changed, 15 insertions(+), 44 deletions(-)

diff --git a/testcases/kernel/syscalls/bind/bind01.c b/testcases/kernel/syscalls/bind/bind01.c
index 2054996ac..ce5cae298 100644
--- a/testcases/kernel/syscalls/bind/bind01.c
+++ b/testcases/kernel/syscalls/bind/bind01.c
@@ -47,14 +47,12 @@ void verify_bind(unsigned int nr)
 {
 	struct test_case *tcase = &tcases[nr];
 
-	TEST(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen));
-	if (TST_RET != tcase->retval && TST_ERR != tcase->experrno) {
-		tst_res(TFAIL, "%s ; returned"
-			" %ld (expected %d), errno %d (expected"
-			" %d)", tcase->desc, TST_RET, tcase->retval,
-			TST_ERR, tcase->experrno);
+	if (tcase->experrno) {
+		TEST_FAIL(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen),
+		               tcase->experrno, "%s", tcase->desc);
 	} else {
-		tst_res(TPASS, "%s successful", tcase->desc);
+		TEST_PASS(bind(*tcase->socket_fd, tcase->sockaddr, tcase->salen),
+		          "%s", tcase->desc);
 	}
 }
 
diff --git a/testcases/kernel/syscalls/bind/bind02.c b/testcases/kernel/syscalls/bind/bind02.c
index 65944cbe3..ffde994f8 100644
--- a/testcases/kernel/syscalls/bind/bind02.c
+++ b/testcases/kernel/syscalls/bind/bind02.c
@@ -36,16 +36,9 @@ static void run(void)
 	servaddr.sin_family = AF_INET;
 	servaddr.sin_port = htons(TCP_PRIVILEGED_PORT);
 	servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
-	TEST(bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)));
+	TEST_FAIL(bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)),
+	          EACCES, "bind()");
 	SAFE_CLOSE(sockfd);
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "bind() returned %li, expected -1", TST_RET);
-	} else if (TST_ERR == EACCES) {
-		tst_res(TPASS | TTERRNO, "bind() failed as expected");
-	} else {
-		tst_res(TFAIL | TTERRNO, "Unexpected error");
-	}
 }
 
 static void setup(void)
diff --git a/testcases/kernel/syscalls/bind/bind03.c b/testcases/kernel/syscalls/bind/bind03.c
index dda5ca374..8e9aeb7b3 100644
--- a/testcases/kernel/syscalls/bind/bind03.c
+++ b/testcases/kernel/syscalls/bind/bind03.c
@@ -51,17 +51,8 @@ void run(void)
 	 * Once a STREAM UNIX domain socket has been bound, it can't be
 	 * rebound.
 	 */
-	if (bind(sock1, (struct sockaddr *)&sun2, sizeof(sun2)) == 0) {
-		tst_res(TFAIL, "re-binding of socket succeeded");
-		return;
-	}
-
-	if (errno != EINVAL) {
-		tst_res(TFAIL | TERRNO, "expected EINVAL");
-		return;
-	}
-
-	tst_res(TPASS, "bind() failed with EINVAL as expected");
+	TEST_FAIL(bind(sock1, (struct sockaddr *)&sun2, sizeof(sun2)),
+	          EINVAL, "re-bind() socket");
 
 	sock2 = SAFE_SOCKET(PF_UNIX, SOCK_STREAM, 0);
 
@@ -69,17 +60,8 @@ void run(void)
 	 * Since a socket is already bound to the pathname, it can't be bound
 	 * to a second socket. Expected error is EADDRINUSE.
 	 */
-	if (bind(sock2, (struct sockaddr *)&sun1, sizeof(sun1)) == 0) {
-		tst_res(TFAIL, "bind() succeeded with already bound pathname!");
-		return;
-	}
-
-	if (errno != EADDRINUSE) {
-		tst_res(TFAIL | TERRNO, "expected to fail with EADDRINUSE");
-		return;
-	}
-
-	tst_res(TPASS, "bind() failed with EADDRINUSE as expected");
+	TEST_FAIL(bind(sock2, (struct sockaddr *)&sun1, sizeof(sun1)),
+	          EADDRINUSE, "bind() with bound pathname");
 }
 
 static void cleanup(void)
diff --git a/testcases/kernel/syscalls/bind/bind04.c b/testcases/kernel/syscalls/bind/bind04.c
index 51f19c6cd..f78520750 100644
--- a/testcases/kernel/syscalls/bind/bind04.c
+++ b/testcases/kernel/syscalls/bind/bind04.c
@@ -118,10 +118,9 @@ static void test_bind(unsigned int n)
 	listen_sock = SAFE_SOCKET(tc->address->sa_family, tc->type,
 		tc->protocol);
 
-	TEST(bind(listen_sock, tc->address, tc->addrlen));
+	TEST_PASS(bind(listen_sock, tc->address, tc->addrlen), "bind()");
 
-	if (TST_RET) {
-		tst_res(TFAIL | TERRNO, "bind() failed");
+	if (!TST_PASS) {
 		SAFE_CLOSE(listen_sock);
 		return;
 	}
diff --git a/testcases/kernel/syscalls/bind/bind05.c b/testcases/kernel/syscalls/bind/bind05.c
index 16c9c711d..194cc3d69 100644
--- a/testcases/kernel/syscalls/bind/bind05.c
+++ b/testcases/kernel/syscalls/bind/bind05.c
@@ -131,10 +131,9 @@ static void test_bind(unsigned int n)
 	tst_res(TINFO, "Testing %s", tc->description);
 	sock = SAFE_SOCKET(tc->address->sa_family, tc->type, tc->protocol);
 
-	TEST(bind(sock, tc->address, tc->addrlen));
+	TEST_PASS(bind(sock, tc->address, tc->addrlen), "bind()");
 
-	if (TST_RET) {
-		tst_res(TFAIL | TERRNO, "bind() failed");
+	if (!TST_PASS) {
 		SAFE_CLOSE(sock);
 		return;
 	}
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 06/10] syscalls/brk01: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
                   ` (4 preceding siblings ...)
  2020-11-13 13:14 ` [LTP] [PATCH 05/10] syscalls/bind: " Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 07/10] syscalls/cacheflush: " Cyril Hrubis
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/brk/brk01.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/testcases/kernel/syscalls/brk/brk01.c b/testcases/kernel/syscalls/brk/brk01.c
index c50791d40..9e38c9abd 100644
--- a/testcases/kernel/syscalls/brk/brk01.c
+++ b/testcases/kernel/syscalls/brk/brk01.c
@@ -31,12 +31,7 @@ void verify_brk(void)
 		break;
 		}
 
-		TEST(brk((void *)new_brk));
-
-		if (TST_RET == -1) {
-			tst_res(TFAIL | TERRNO, "brk() failed");
-			return;
-		}
+		TEST_PASS(brk((void *)new_brk), "brk()");
 
 		cur_brk = (uintptr_t)sbrk(0);
 
@@ -51,8 +46,6 @@ void verify_brk(void)
 		if (i % 3 == 0)
 			*((char *)cur_brk) = 0;
 	}
-
-	tst_res(TPASS, "brk() works fine");
 }
 
 static struct tst_test test = {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 07/10] syscalls/cacheflush: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
                   ` (5 preceding siblings ...)
  2020-11-13 13:14 ` [LTP] [PATCH 06/10] syscalls/brk01: " Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 08/10] syscalls/capget: " Cyril Hrubis
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/cacheflush/cacheflush01.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/syscalls/cacheflush/cacheflush01.c b/testcases/kernel/syscalls/cacheflush/cacheflush01.c
index 6ad8b953a..d53fcdcd0 100644
--- a/testcases/kernel/syscalls/cacheflush/cacheflush01.c
+++ b/testcases/kernel/syscalls/cacheflush/cacheflush01.c
@@ -45,12 +45,8 @@ static void test_cacheflush(unsigned int i)
 {
 	struct test_case_t *tc = &test_cases[i];
 
-	TEST(tst_syscall(__NR_cacheflush, addr, getpagesize(), tc->cache));
-	if (TST_RET == 0) {
-		tst_res(TPASS, "%s passed", tc->desc);
-	} else {
-		tst_res(TFAIL | TTERRNO, "%s failed", tc->desc);
-	}
+	TEST_PASS(tst_syscall(__NR_cacheflush, addr, getpagesize(), tc->cache),
+	          "%s", tc->desc);
 }
 
 static struct tst_test test = {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 08/10] syscalls/capget: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
                   ` (6 preceding siblings ...)
  2020-11-13 13:14 ` [LTP] [PATCH 07/10] syscalls/cacheflush: " Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 09/10] syscalls/capset: " Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 10/10] syscalls/open: " Cyril Hrubis
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/capget/capget01.c | 17 +++++---------
 testcases/kernel/syscalls/capget/capget02.c | 26 +++++++--------------
 2 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/testcases/kernel/syscalls/capget/capget01.c b/testcases/kernel/syscalls/capget/capget01.c
index f3767594b..87a866453 100644
--- a/testcases/kernel/syscalls/capget/capget01.c
+++ b/testcases/kernel/syscalls/capget/capget01.c
@@ -20,25 +20,20 @@ static struct tcase {
 	int version;
 	char *message;
 } tcases[] = {
-	{0x19980330, "Test on LINUX_CAPABILITY_VERSION_1"},
-	{0x20071026, "Test on LINUX_CAPABILITY_VERSION_2"},
-	{0x20080522, "Test on LINUX_CAPABILITY_VERSION_3"},
+	{0x19980330, "LINUX_CAPABILITY_VERSION_1"},
+	{0x20071026, "LINUX_CAPABILITY_VERSION_2"},
+	{0x20080522, "LINUX_CAPABILITY_VERSION_3"},
 };
 
 static void verify_capget(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
 
-	tst_res(TINFO, "%s", tc->message);
-
 	hdr->version = tc->version;
 	hdr->pid = pid;
-	TEST(tst_syscall(__NR_capget, hdr, data));
-	if (TST_RET == 0)
-		tst_res(TPASS, "capget() returned %ld", TST_RET);
-	else
-		tst_res(TFAIL | TTERRNO, "Test Failed, capget() returned %ld",
-				TST_RET);
+
+	TEST_PASS(tst_syscall(__NR_capget, hdr, data),
+	          "capget() with %s", tc->message);
 
 	if (data[0].effective & 1 << CAP_NET_RAW)
 		tst_res(TFAIL, "capget() gets CAP_NET_RAW unexpectedly in pE");
diff --git a/testcases/kernel/syscalls/capget/capget02.c b/testcases/kernel/syscalls/capget/capget02.c
index e770ea0a9..befd8924d 100644
--- a/testcases/kernel/syscalls/capget/capget02.c
+++ b/testcases/kernel/syscalls/capget/capget02.c
@@ -31,11 +31,11 @@ static struct tcase {
 	int flag;
 	char *message;
 } tcases[] = {
-	{0x20080522, 0, EFAULT, 1, "Test bad address header"},
-	{0x20080522, 0, EFAULT, 2, "Test bad address data"},
-	{0, 0, EINVAL, 0, "Test bad version"},
-	{0x20080522, -1, EINVAL, 0, "Test bad pid"},
-	{0x20080522, 1, ESRCH, 0, "Test unused pid"},
+	{0x20080522, 0, EFAULT, 1, "bad address header"},
+	{0x20080522, 0, EFAULT, 2, "bad address data"},
+	{0, 0, EINVAL, 0, "bad version"},
+	{0x20080522, -1, EINVAL, 0, "bad pid"},
+	{0x20080522, 1, ESRCH, 0, "unused pid"},
 };
 
 static void verify_capget(unsigned int n)
@@ -48,25 +48,15 @@ static void verify_capget(unsigned int n)
 	else
 		header->pid = tc->pid;
 
-	tst_res(TINFO, "%s", tc->message);
-
 	/*
 	 * header must not be NULL. data may be NULL only when the user is
 	 * trying to determine the preferred capability version format
 	 * supported by the kernel. So use tst_get_bad_addr() to get
 	 * this error.
 	 */
-	TEST(tst_syscall(__NR_capget, tc->flag - 1 ? header : NULL,
-				tc->flag - 2 ? data : bad_data));
-	if (TST_RET == 0) {
-		tst_res(TFAIL, "capget() succeed unexpectedly");
-		return;
-	}
-	if (TST_ERR == tc->exp_err)
-		tst_res(TPASS | TTERRNO, "capget() failed as expected");
-	else
-		tst_res(TFAIL | TTERRNO, "capget() expected %s got ",
-			tst_strerrno(tc->exp_err));
+	TEST_FAIL(tst_syscall(__NR_capget, tc->flag - 1 ? header : NULL,
+	                      tc->flag - 2 ? data : bad_data),
+		  tc->exp_err, "capget() with %s", tc->message);
 
 	/*
 	 * When an unsupported version value is specified, it will
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 09/10] syscalls/capset: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
                   ` (7 preceding siblings ...)
  2020-11-13 13:14 ` [LTP] [PATCH 08/10] syscalls/capget: " Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  2020-11-13 13:14 ` [LTP] [PATCH 10/10] syscalls/open: " Cyril Hrubis
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/capset/capset01.c | 14 ++++-------
 testcases/kernel/syscalls/capset/capset02.c | 28 +++++++--------------
 testcases/kernel/syscalls/capset/capset03.c | 10 +-------
 testcases/kernel/syscalls/capset/capset04.c | 13 +++-------
 4 files changed, 18 insertions(+), 47 deletions(-)

diff --git a/testcases/kernel/syscalls/capset/capset01.c b/testcases/kernel/syscalls/capset/capset01.c
index f8540539d..da0fc8113 100644
--- a/testcases/kernel/syscalls/capset/capset01.c
+++ b/testcases/kernel/syscalls/capset/capset01.c
@@ -20,16 +20,15 @@ static struct tcase {
 	int version;
 	char *message;
 } tcases[] = {
-	{0x19980330, "Test on LINUX_CAPABILITY_VERSION_1"},
-	{0x20071026, "Test on LINUX_CAPABILITY_VERSION_2"},
-	{0x20080522, "Test on LINUX_CAPABILITY_VERSION_3"},
+	{0x19980330, "LINUX_CAPABILITY_VERSION_1"},
+	{0x20071026, "LINUX_CAPABILITY_VERSION_2"},
+	{0x20080522, "LINUX_CAPABILITY_VERSION_3"},
 };
 
 static void verify_capset(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
 
-	tst_res(TINFO, "%s", tc->message);
 	header->version = tc->version;
 	header->pid = pid;
 
@@ -38,11 +37,8 @@ static void verify_capset(unsigned int n)
 		return;
 	}
 
-	TEST(tst_syscall(__NR_capset, header, data));
-	if (TST_RET == 0)
-		tst_res(TPASS, "capset() returned %ld", TST_RET);
-	else
-		tst_res(TFAIL | TTERRNO, "Test Failed, capset() returned %ld", TST_RET);
+	TEST_PASS(tst_syscall(__NR_capset, header, data),
+	          "capset() with %s", tc->message);
 }
 
 static void setup(void)
diff --git a/testcases/kernel/syscalls/capset/capset02.c b/testcases/kernel/syscalls/capset/capset02.c
index a6c4f29a0..d45b52297 100644
--- a/testcases/kernel/syscalls/capset/capset02.c
+++ b/testcases/kernel/syscalls/capset/capset02.c
@@ -43,12 +43,12 @@ static struct tcase {
 	int flag;
 	char *message;
 } tcases[] = {
-	{0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 1, "Test bad address header"},
-	{0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 2, "Test bad address data"},
-	{0, 0, CAP1, CAP1, CAP1, EINVAL, 0, "Test bad version"},
-	{0x20080522, 0, CAP2, CAP1, CAP1, EPERM, 0, "Test bad value data(when pE is not in pP)"},
-	{0x20080522, 0, CAP1, CAP2, CAP1, EPERM, 0, "Test bad value data(when pP is not in old pP)"},
-	{0x20080522, 0, CAP1, CAP1, CAP2, EPERM, 0, "Test bad value data(when pI is not in bounding set or old pI)"},
+	{0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 1, "bad address header"},
+	{0x20080522, 0, CAP1, CAP1, CAP1, EFAULT, 2, "bad address data"},
+	{0, 0, CAP1, CAP1, CAP1, EINVAL, 0, "bad version"},
+	{0x20080522, 0, CAP2, CAP1, CAP1, EPERM, 0, "bad value data(when pE is not in pP)"},
+	{0x20080522, 0, CAP1, CAP2, CAP1, EPERM, 0, "bad value data(when pP is not in old pP)"},
+	{0x20080522, 0, CAP1, CAP1, CAP2, EPERM, 0, "bad value data(when pI is not in bounding set or old pI)"},
 };
 
 static void verify_capset(unsigned int n)
@@ -62,19 +62,9 @@ static void verify_capset(unsigned int n)
 	data->permitted = tc->permitted;
 	data->inheritable = tc->inheritable;
 
-	tst_res(TINFO, "%s", tc->message);
-
-	TEST(tst_syscall(__NR_capset, tc->flag - 1 ? header : bad_addr,
-				tc->flag - 2 ? data : bad_addr));
-	if (TST_RET == 0) {
-		tst_res(TFAIL, "capset() succeed unexpectedly");
-		return;
-	}
-	if (TST_ERR == tc->exp_err)
-		tst_res(TPASS | TTERRNO, "capset() failed as expected");
-	else
-		tst_res(TFAIL | TTERRNO, "capset() expected %s got ",
-			tst_strerrno(tc->exp_err));
+	TEST_FAIL(tst_syscall(__NR_capset, tc->flag - 1 ? header : bad_addr,
+	                      tc->flag - 2 ? data : bad_addr),
+	          tc->exp_err, "capset() with %s", tc->message);
 	/*
 	 * When an unsupported version value is specified, it will
 	 * return the kernel preferred value of _LINUX_CAPABILITY_VERSION_?.
diff --git a/testcases/kernel/syscalls/capset/capset03.c b/testcases/kernel/syscalls/capset/capset03.c
index d5754753d..b8eb826d0 100644
--- a/testcases/kernel/syscalls/capset/capset03.c
+++ b/testcases/kernel/syscalls/capset/capset03.c
@@ -23,15 +23,7 @@ static void verify_capset(void)
 {
 	tst_res(TINFO, "Test bad value data(when pI is not old pP or old pI without CAP_SETPCAP)");
 	data[0].inheritable = CAP2;
-	TEST(tst_syscall(__NR_capset, header, data));
-	if (TST_RET == 0) {
-		tst_res(TFAIL, "capset succeed unexpectedly");
-		return;
-	}
-	if (TST_ERR == EPERM)
-		tst_res(TPASS | TTERRNO, "capset() failed as expected");
-	else
-		tst_res(TFAIL | TTERRNO, "capset expected EPERM, bug got");
+	TEST_FAIL(tst_syscall(__NR_capset, header, data), EPERM, "capset()");
 }
 
 static void setup(void)
diff --git a/testcases/kernel/syscalls/capset/capset04.c b/testcases/kernel/syscalls/capset/capset04.c
index 81ad7a35f..b5aeff19f 100644
--- a/testcases/kernel/syscalls/capset/capset04.c
+++ b/testcases/kernel/syscalls/capset/capset04.c
@@ -24,18 +24,11 @@ static void verify_capset(void)
 	if (!child_pid)
 		pause();
 
-	header->pid = child_pid;
+	tst_res(TINFO, "Test capset() for a different process");
 
-	TEST(tst_syscall(__NR_capset, header, data));
-	if (TST_RET == 0) {
-		tst_res(TFAIL, "capset succeed unexpectedly");
-		return;
-	}
+	header->pid = child_pid;
 
-	if (TST_ERR == EPERM)
-		tst_res(TPASS, "capset can't modify other process capabilities");
-	else
-		tst_res(TFAIL | TTERRNO, "capset expected EPERM, bug got");
+	TEST_FAIL(tst_syscall(__NR_capset, header, data), EPERM, "capset()");
 
 	SAFE_KILL(child_pid, SIGTERM);
 	SAFE_WAIT(NULL);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 10/10] syscalls/open: Make use of TEST_MACROS
  2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
                   ` (8 preceding siblings ...)
  2020-11-13 13:14 ` [LTP] [PATCH 09/10] syscalls/capset: " Cyril Hrubis
@ 2020-11-13 13:14 ` Cyril Hrubis
  9 siblings, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-13 13:14 UTC (permalink / raw)
  To: ltp

In the newlib testcases at least.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/open/open01.c | 11 ++++-------
 testcases/kernel/syscalls/open/open02.c | 25 ++++++-------------------
 testcases/kernel/syscalls/open/open11.c | 22 ++++++++++------------
 3 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/testcases/kernel/syscalls/open/open01.c b/testcases/kernel/syscalls/open/open01.c
index c689a4b9b..74a46c36e 100644
--- a/testcases/kernel/syscalls/open/open01.c
+++ b/testcases/kernel/syscalls/open/open01.c
@@ -36,8 +36,8 @@ static struct tcase {
 	unsigned short tst_bit;
 	char *desc;
 } tcases[] = {
-	{TEST_FILE, O_RDWR | O_CREAT, 01444, S_ISVTX, "Sticky bit"},
-	{TEST_DIR, O_DIRECTORY, 0, S_IFDIR, "Directory bit"}
+	{TEST_FILE, O_RDWR | O_CREAT, 01444, S_ISVTX, "sticky bit"},
+	{TEST_DIR, O_DIRECTORY, 0, S_IFDIR, "sirectory bit"}
 };
 
 static void verify_open(unsigned int n)
@@ -45,12 +45,9 @@ static void verify_open(unsigned int n)
 	struct tcase *tc = &tcases[n];
 	struct stat buf;
 
-	TEST(open(tc->filename, tc->flag, tc->mode));
+	TEST_FD(open(tc->filename, tc->flag, tc->mode),
+	        "open() with %s", tc->desc);
 	fd = TST_RET;
-	if (fd == -1) {
-		tst_res(TFAIL, "Cannot open a file");
-		return;
-	}
 
 	SAFE_FSTAT(fd, &buf);
 	if (!(buf.st_mode & tc->tst_bit))
diff --git a/testcases/kernel/syscalls/open/open02.c b/testcases/kernel/syscalls/open/open02.c
index 7195b1b6c..46d50894c 100644
--- a/testcases/kernel/syscalls/open/open02.c
+++ b/testcases/kernel/syscalls/open/open02.c
@@ -25,12 +25,13 @@
 #define TEST_FILE2	"test_file2"
 
 static struct tcase {
-	char *filename;
+	const char *filename;
 	int flag;
 	int exp_errno;
+	const char *desc;
 } tcases[] = {
-	{TEST_FILE, O_RDWR, ENOENT},
-	{TEST_FILE2, O_RDONLY | O_NOATIME, EPERM},
+	{TEST_FILE, O_RDWR, ENOENT, "new file without O_CREAT"},
+	{TEST_FILE2, O_RDONLY | O_NOATIME, EPERM, "unpriviledget O_RDONLY | O_NOATIME"},
 };
 
 void setup(void)
@@ -48,22 +49,8 @@ static void verify_open(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
 
-	TEST(open(tc->filename, tc->flag, 0444));
-
-	if (TST_RET != -1) {
-		tst_res(TFAIL, "open(%s) succeeded unexpectedly",
-			tc->filename);
-		return;
-	}
-
-	if (tc->exp_errno != TST_ERR) {
-		tst_res(TFAIL | TTERRNO,
-			"open() should fail with %s",
-			tst_strerrno(tc->exp_errno));
-		return;
-	}
-
-	tst_res(TPASS | TTERRNO, "open() failed as expected");
+	TEST_FAIL(open(tc->filename, tc->flag, 0444),
+	          tc->exp_errno, "open() %s", tc->desc);
 }
 
 void cleanup(void)
diff --git a/testcases/kernel/syscalls/open/open11.c b/testcases/kernel/syscalls/open/open11.c
index cfd04fdcd..ef5f787aa 100644
--- a/testcases/kernel/syscalls/open/open11.c
+++ b/testcases/kernel/syscalls/open/open11.c
@@ -277,21 +277,19 @@ static struct test_case {
 
 static void verify_open(unsigned int n)
 {
-	int fd;
-
-	TEST(open(tc[n].path, tc[n].flags, tc[n].mode));
-	fd = TST_RET;
-
-	if (fd > 0)
-		SAFE_CLOSE(fd);
-
-	if (tc[n].err == -1 || TST_ERR == tc[n].err) {
+	if (tc[n].err > 0) {
+		TEST_FAIL(open(tc[n].path, tc[n].flags, tc[n].mode),
+		          tc[n].err, "%s", tc[n].desc);
+	} else if (tc[n].err == 0) {
+		TEST_FD(open(tc[n].path, tc[n].flags, tc[n].mode),
+		        "%s", tc[n].desc);
+	} else {
+		TEST(open(tc[n].path, tc[n].flags, tc[n].mode));
 		tst_res(TPASS, "%s", tc[n].desc);
-		return;
 	}
 
-	tst_res(TFAIL | TTERRNO, "%s - expected %s",
-			tc[n].desc, tst_strerrno(tc[n].err));
+	if (TST_RET > 0)
+		SAFE_CLOSE(TST_RET);
 }
 
 static void setup(void)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-13 13:14 ` [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros Cyril Hrubis
@ 2020-11-13 20:28   ` Petr Vorel
  2020-11-16  8:41     ` Li Wang
  2020-11-19 13:09     ` Cyril Hrubis
  2020-11-25 16:54   ` Martin Doucha
  1 sibling, 2 replies; 22+ messages in thread
From: Petr Vorel @ 2020-11-13 20:28 UTC (permalink / raw)
  To: ltp

> In order to simplify common return value checks.

Great improvement, thanks!

The only concern I have is for tests which does not end 0
as it's not obvious from the output (without looking into the test source)
that everything it's working, but not a big deal.

FYI I plan to send a patchset which runs tests in lib/newlib_tests/.
First I thought simple check for 0 would be ok, but with non-zero results it
might be good to not only check expected return value but maybe for whole
output (the same approach we have unfinished in patchset from Christian Lanig).

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-13 20:28   ` Petr Vorel
@ 2020-11-16  8:41     ` Li Wang
  2020-11-19 13:08       ` Cyril Hrubis
  2020-11-19 13:09     ` Cyril Hrubis
  1 sibling, 1 reply; 22+ messages in thread
From: Li Wang @ 2020-11-16  8:41 UTC (permalink / raw)
  To: ltp

On Sat, Nov 14, 2020 at 4:28 AM Petr Vorel <pvorel@suse.cz> wrote:

> > In order to simplify common return value checks.
>
> Great improvement, thanks!
>
> The only concern I have is for tests which does not end 0
> as it's not obvious from the output (without looking into the test source)
> that everything it's working, but not a big deal.
>

+1
I agree to add an expected value check for TEST_PASS(), e.g

#define TEST_PASS(SCALL, EXPECTED, ...)


> FYI I plan to send a patchset which runs tests in lib/newlib_tests/.
> First I thought simple check for 0 would be ok, but with non-zero results
> it
> might be good to not only check expected return value but maybe for whole
> output (the same approach we have unfinished in patchset from Christian
> Lanig).
>
> Kind regards,
> Petr
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20201116/957aa64f/attachment.htm>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-16  8:41     ` Li Wang
@ 2020-11-19 13:08       ` Cyril Hrubis
  2020-11-25 13:18         ` Cyril Hrubis
  0 siblings, 1 reply; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-19 13:08 UTC (permalink / raw)
  To: ltp

Hi!
> I agree to add an expected value check for TEST_PASS(), e.g
> 
> #define TEST_PASS(SCALL, EXPECTED, ...)

I would rather keep this simple case as it is, since many function
return zero on success and added more specialized functions if needed as
it was done with TEST_FD()

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-13 20:28   ` Petr Vorel
  2020-11-16  8:41     ` Li Wang
@ 2020-11-19 13:09     ` Cyril Hrubis
  1 sibling, 0 replies; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-19 13:09 UTC (permalink / raw)
  To: ltp

Hi!
> FYI I plan to send a patchset which runs tests in lib/newlib_tests/.
> First I thought simple check for 0 would be ok, but with non-zero results it
> might be good to not only check expected return value but maybe for whole
> output (the same approach we have unfinished in patchset from Christian Lanig).

That has to be indeed done, since many of these tests have no way how to
check if the call to test library had done what it should have.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-19 13:08       ` Cyril Hrubis
@ 2020-11-25 13:18         ` Cyril Hrubis
  2020-11-25 13:33           ` Li Wang
  0 siblings, 1 reply; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-25 13:18 UTC (permalink / raw)
  To: ltp

Hi!
> > I agree to add an expected value check for TEST_PASS(), e.g
> > 
> > #define TEST_PASS(SCALL, EXPECTED, ...)
> 
> I would rather keep this simple case as it is, since many function
> return zero on success and added more specialized functions if needed as
> it was done with TEST_FD()

Is anyone against pushing this initial patchset as it is?

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-25 13:18         ` Cyril Hrubis
@ 2020-11-25 13:33           ` Li Wang
  2020-11-25 15:57             ` Cyril Hrubis
  0 siblings, 1 reply; 22+ messages in thread
From: Li Wang @ 2020-11-25 13:33 UTC (permalink / raw)
  To: ltp

On Wed, Nov 25, 2020 at 9:17 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > I agree to add an expected value check for TEST_PASS(), e.g
> > >
> > > #define TEST_PASS(SCALL, EXPECTED, ...)
> >
> > I would rather keep this simple case as it is, since many function
> > return zero on success and added more specialized functions if needed as
> > it was done with TEST_FD()
>

Ok.


>
> Is anyone against pushing this initial patchset as it is?
>

Another bit of concern I have is the TEST_FAIL might cause
confusion in code reading. It looks like the test will be failed here
but in finish the test report pass, maybe we'd better tell people the
failure is expected?
(that was just my feeling on TEST_FAIL at the first glance)

Or rename them to:

TEST_EXP_PASS
TEST_EXP_FAIL
TEST_EXP_FD

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20201125/ac0c9a6d/attachment.htm>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-25 13:33           ` Li Wang
@ 2020-11-25 15:57             ` Cyril Hrubis
  2020-11-26  2:17               ` Li Wang
  0 siblings, 1 reply; 22+ messages in thread
From: Cyril Hrubis @ 2020-11-25 15:57 UTC (permalink / raw)
  To: ltp

Hi!
> > Is anyone against pushing this initial patchset as it is?
> >
> 
> Another bit of concern I have is the TEST_FAIL might cause
> confusion in code reading. It looks like the test will be failed here
> but in finish the test report pass, maybe we'd better tell people the
> failure is expected?
> (that was just my feeling on TEST_FAIL at the first glance)
> 
> Or rename them to:
> 
> TEST_EXP_PASS
> TEST_EXP_FAIL
> TEST_EXP_FD

Fair enough, let's rename them like this.

Any other concerns?

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-13 13:14 ` [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros Cyril Hrubis
  2020-11-13 20:28   ` Petr Vorel
@ 2020-11-25 16:54   ` Martin Doucha
  2020-12-03 12:30     ` Cyril Hrubis
  1 sibling, 1 reply; 22+ messages in thread
From: Martin Doucha @ 2020-11-25 16:54 UTC (permalink / raw)
  To: ltp

On 13. 11. 20 14:14, Cyril Hrubis wrote:
> In order to simplify common return value checks.
> 
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>  include/tst_test.h               |  28 +------
>  include/tst_test_macros.h        | 131 +++++++++++++++++++++++++++++++
>  lib/newlib_tests/.gitignore      |   3 +
>  lib/newlib_tests/test_macros01.c |  40 ++++++++++
>  lib/newlib_tests/test_macros02.c |  42 ++++++++++
>  lib/newlib_tests/test_macros03.c |  40 ++++++++++
>  lib/tst_test.c                   |   1 +
>  7 files changed, 258 insertions(+), 27 deletions(-)
>  create mode 100644 include/tst_test_macros.h
>  create mode 100644 lib/newlib_tests/test_macros01.c
>  create mode 100644 lib/newlib_tests/test_macros02.c
>  create mode 100644 lib/newlib_tests/test_macros03.c
> 
> diff --git a/include/tst_test_macros.h b/include/tst_test_macros.h
> new file mode 100644
> index 000000000..69de2ce3d
> --- /dev/null
> +++ b/include/tst_test_macros.h
> @@ -0,0 +1,131 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2015-2020 Cyril Hrubis <chrubis@suse.cz>
> + */
> +
> +#ifndef TST_TEST_MACROS_H__
> +#define TST_TEST_MACROS_H__
> +
> +#define TEST(SCALL) \
> +	do { \
> +		errno = 0; \
> +		TST_RET = SCALL; \
> +		TST_ERR = errno; \
> +	} while (0)
> +
> +#define TEST_VOID(SCALL) \
> +	do { \
> +		errno = 0; \
> +		SCALL; \
> +		TST_ERR = errno; \
> +	} while (0)
> +
> +extern long TST_RET;
> +extern int TST_ERR;
> +extern int TST_PASS;
> +
> +extern void *TST_RET_PTR;
> +
> +#define TESTPTR(SCALL) \
> +	do { \
> +		errno = 0; \
> +		TST_RET_PTR = (void*)SCALL; \
> +		TST_ERR = errno; \
> +	} while (0)
> +
> +
> +#define TEST_2(_1, _2, ...) _2
> +
> +#define TEST_FMT_(FMT, _1, ...) FMT, ##__VA_ARGS__
> +
> +#define TEST_MSG(RES, FMT, SCALL, ...) \
> +	tst_res_(__FILE__, __LINE__, RES, \
> +		TEST_FMT_(TEST_2(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__))
> +
> +#define TEST_MSGP(RES, FMT, PAR, SCALL, ...) \
> +	tst_res_(__FILE__, __LINE__, RES, \
> +		TEST_FMT_(TEST_2(dummy, ##__VA_ARGS__, SCALL) FMT, __VA_ARGS__), PAR)
> +
> +#define TEST_FD(SCALL, ...)                                                    \

I'd recommend adding TEST_*_IMPL() variant with extra arguments that'll
allow special handling of ENOSYS, ENOTSUP and possibly also a
zero-terminated array of allowed errnos. TEST_FD() etc. would then call
the respective IMPL macro with default arguments:

#define TEST_FD_IMPL(SCALL, NOSYS_RES, NOTSUP_RES, ERRNO_LIST, ...) \
    ...

#define TEST_FD(SCALL, ...) \
    TEST_FD_IMPL((SCALL), TFAIL, TFAIL, NULL, ##__VA_ARGS__)

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-25 15:57             ` Cyril Hrubis
@ 2020-11-26  2:17               ` Li Wang
  0 siblings, 0 replies; 22+ messages in thread
From: Li Wang @ 2020-11-26  2:17 UTC (permalink / raw)
  To: ltp

On Wed, Nov 25, 2020 at 11:56 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > Is anyone against pushing this initial patchset as it is?
> > >
> >
> > Another bit of concern I have is the TEST_FAIL might cause
> > confusion in code reading. It looks like the test will be failed here
> > but in finish the test report pass, maybe we'd better tell people the
> > failure is expected?
> > (that was just my feeling on TEST_FAIL at the first glance)
> >
> > Or rename them to:
> >
> > TEST_EXP_PASS
> > TEST_EXP_FAIL
> > TEST_EXP_FD
>
> Fair enough, let's rename them like this.
>
> Any other concerns?
>

No more from me, thank you.
-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20201126/cdad67fd/attachment.htm>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-11-25 16:54   ` Martin Doucha
@ 2020-12-03 12:30     ` Cyril Hrubis
  2020-12-03 14:34       ` Martin Doucha
  0 siblings, 1 reply; 22+ messages in thread
From: Cyril Hrubis @ 2020-12-03 12:30 UTC (permalink / raw)
  To: ltp

Hi!
> I'd recommend adding TEST_*_IMPL() variant with extra arguments that'll
> allow special handling of ENOSYS, ENOTSUP and possibly also a
> zero-terminated array of allowed errnos. TEST_FD() etc. would then call
> the respective IMPL macro with default arguments:
> 
> #define TEST_FD_IMPL(SCALL, NOSYS_RES, NOTSUP_RES, ERRNO_LIST, ...) \
>     ...
> 
> #define TEST_FD(SCALL, ...) \
>     TEST_FD_IMPL((SCALL), TFAIL, TFAIL, NULL, ##__VA_ARGS__)

I do plan adding something like this later on once I run out of the
simple cases to convert, then I would like to review what is left there
and how to make best interface for the rest of the testcases.

So for now I would like to proceed with the patchset as it is in order
not to make it overly complicated.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros
  2020-12-03 12:30     ` Cyril Hrubis
@ 2020-12-03 14:34       ` Martin Doucha
  0 siblings, 0 replies; 22+ messages in thread
From: Martin Doucha @ 2020-12-03 14:34 UTC (permalink / raw)
  To: ltp

On 03. 12. 20 13:30, Cyril Hrubis wrote:
> Hi!
>> I'd recommend adding TEST_*_IMPL() variant with extra arguments that'll
>> allow special handling of ENOSYS, ENOTSUP and possibly also a
>> zero-terminated array of allowed errnos. TEST_FD() etc. would then call
>> the respective IMPL macro with default arguments:
>>
>> #define TEST_FD_IMPL(SCALL, NOSYS_RES, NOTSUP_RES, ERRNO_LIST, ...) \
>>     ...
>>
>> #define TEST_FD(SCALL, ...) \
>>     TEST_FD_IMPL((SCALL), TFAIL, TFAIL, NULL, ##__VA_ARGS__)
> 
> I do plan adding something like this later on once I run out of the
> simple cases to convert, then I would like to review what is left there
> and how to make best interface for the rest of the testcases.
> 
> So for now I would like to proceed with the patchset as it is in order
> not to make it overly complicated.

Great, looking forward to the follow-up patchset. I haven't reviewed
everything so I won't add any signoff but consider my comments resolved.
Feel free to push the patchset when you have enough reviews from others.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-12-03 14:34 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 13:14 [LTP] [PATCH 00/10] Introduce TEST_MACROS Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 01/10] lib: Introduce more TEST_* macros Cyril Hrubis
2020-11-13 20:28   ` Petr Vorel
2020-11-16  8:41     ` Li Wang
2020-11-19 13:08       ` Cyril Hrubis
2020-11-25 13:18         ` Cyril Hrubis
2020-11-25 13:33           ` Li Wang
2020-11-25 15:57             ` Cyril Hrubis
2020-11-26  2:17               ` Li Wang
2020-11-19 13:09     ` Cyril Hrubis
2020-11-25 16:54   ` Martin Doucha
2020-12-03 12:30     ` Cyril Hrubis
2020-12-03 14:34       ` Martin Doucha
2020-11-13 13:14 ` [LTP] [PATCH 02/10] syscalls/uname: Make use of TEST_MACROS Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 03/10] syscalls/accept: " Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 04/10] syscalls/access: " Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 05/10] syscalls/bind: " Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 06/10] syscalls/brk01: " Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 07/10] syscalls/cacheflush: " Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 08/10] syscalls/capget: " Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 09/10] syscalls/capset: " Cyril Hrubis
2020-11-13 13:14 ` [LTP] [PATCH 10/10] syscalls/open: " Cyril Hrubis

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.