All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] socketcall01: Use tst_syscall() instead of custom syscall support detection
@ 2020-01-20 13:36 Petr Vorel
  2020-01-20 13:36 ` [LTP] [PATCH 2/2] tst_device: Move tst_dev_sync() into from header to source file Petr Vorel
  2020-01-20 19:10 ` [LTP] [PATCH 1/2] socketcall01: Use tst_syscall() instead of custom syscall support detection Petr Vorel
  0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2020-01-20 13:36 UTC (permalink / raw)
  To: ltp

Besides it's always better to use API functions instead of
reimplementing a wheel it's also needed to fix regression in detecting
socketcall() syscall support for archs which does not support it (e.g.
x86_64, ARM):

socketcall01.c:42: FAIL: socketcall() for TCP stream failed with -1: ENOSYS (38)
socketcall01.c:42: FAIL: socketcall() for unix domain dgram failed with -1: ENOSYS (38)
socketcall01.c:42: FAIL: socketcall() for Raw socket failed with -1: ENOSYS (38)
socketcall01.c:42: FAIL: socketcall() for UDP dgram failed with -1: ENOSYS (38)

Fixes: 9e83513eb "tst_device.h: Use lapi/syscalls.h instead of <sys/syscall.h>"
Fixes: #634

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../kernel/syscalls/socketcall/socketcall01.c   | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/testcases/kernel/syscalls/socketcall/socketcall01.c b/testcases/kernel/syscalls/socketcall/socketcall01.c
index a8f6649a6..48e818846 100644
--- a/testcases/kernel/syscalls/socketcall/socketcall01.c
+++ b/testcases/kernel/syscalls/socketcall/socketcall01.c
@@ -1,8 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *    AUTHOR : sowmya adiga<sowmya.adiga@wipro.com>
+ * Author: sowmya adiga <sowmya.adiga@wipro.com>
  * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2017-2020
  */
 /*
  * This is a basic test for the socketcall(2) system call.
@@ -11,16 +12,12 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <sys/syscall.h>
 #include <linux/net.h>
 #include <sys/un.h>
 #include <netinet/in.h>
 
 #include "tst_test.h"
-
-#ifdef __NR_socketcall
-
-#define socketcall(call, args) syscall(__NR_socketcall, call, args)
+#include "lapi/syscalls.h"
 
 struct test_case_t {
 	int call;
@@ -35,7 +32,7 @@ struct test_case_t {
 
 void verify_socketcall(unsigned int i)
 {
-	TEST(socketcall(TC[i].call, TC[i].args));
+	TEST(tst_syscall(__NR_socketcall, TC[i].call, TC[i].args));
 
 	if (TST_RET < 0) {
 		tst_res(TFAIL | TTERRNO, "socketcall() for %s failed with %li",
@@ -53,9 +50,3 @@ static struct tst_test test = {
 	.tcnt = ARRAY_SIZE(TC),
 	.needs_root = 1,
 };
-
-#else
-
-TST_TEST_TCONF("The socketcall() syscall is not supported");
-
-#endif
-- 
2.24.1


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

end of thread, other threads:[~2020-01-20 19:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-20 13:36 [LTP] [PATCH 1/2] socketcall01: Use tst_syscall() instead of custom syscall support detection Petr Vorel
2020-01-20 13:36 ` [LTP] [PATCH 2/2] tst_device: Move tst_dev_sync() into from header to source file Petr Vorel
2020-01-20 13:52   ` Petr Vorel
2020-01-20 13:55     ` Cyril Hrubis
2020-01-20 14:05       ` Petr Vorel
2020-01-20 19:10 ` [LTP] [PATCH 1/2] socketcall01: Use tst_syscall() instead of custom syscall support detection Petr Vorel

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.