All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] Add case about arch_prctl syscall.
@ 2024-04-19  7:07 lufei
  2024-04-19 15:46 ` Cyril Hrubis
                   ` (4 more replies)
  0 siblings, 5 replies; 31+ messages in thread
From: lufei @ 2024-04-19  7:07 UTC (permalink / raw)
  To: ltp; +Cc: lufei

Add testcase about arch_prctl syscall.

Signed-off-by: Lu Fei <lufei@uniontech.com>
---
 configure.ac                                  |  1 +
 .../kernel/syscalls/arch_prctl/.gitignore     |  1 +
 testcases/kernel/syscalls/arch_prctl/Makefile |  8 +++
 .../kernel/syscalls/arch_prctl/arch_prctl01.c | 56 +++++++++++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 testcases/kernel/syscalls/arch_prctl/.gitignore
 create mode 100644 testcases/kernel/syscalls/arch_prctl/Makefile
 create mode 100644 testcases/kernel/syscalls/arch_prctl/arch_prctl01.c

diff --git a/configure.ac b/configure.ac
index 1d7e862d8..0dcaddc0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,7 @@ AC_CHECK_DECLS([SEM_STAT_ANY],,,[#include <sys/sem.h>])
 
 AC_CHECK_HEADERS_ONCE([ \
     asm/ldt.h \
+    asm/prctl.h \
     cpuid.h \
     emmintrin.h \
     ifaddrs.h \
diff --git a/testcases/kernel/syscalls/arch_prctl/.gitignore b/testcases/kernel/syscalls/arch_prctl/.gitignore
new file mode 100644
index 000000000..24871e249
--- /dev/null
+++ b/testcases/kernel/syscalls/arch_prctl/.gitignore
@@ -0,0 +1 @@
+/arch_prctl01
diff --git a/testcases/kernel/syscalls/arch_prctl/Makefile b/testcases/kernel/syscalls/arch_prctl/Makefile
new file mode 100644
index 000000000..272949d57
--- /dev/null
+++ b/testcases/kernel/syscalls/arch_prctl/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) UnionTech Software Technology Co.,Ltd. 2024
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/arch_prctl/arch_prctl01.c b/testcases/kernel/syscalls/arch_prctl/arch_prctl01.c
new file mode 100644
index 000000000..06b3d99b8
--- /dev/null
+++ b/testcases/kernel/syscalls/arch_prctl/arch_prctl01.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* 
+ * Copyright (c) UnionTech Software Technology Co.,Ltd., 2024
+ * Author: Lu Fei <lufei@uniontech.com>
+ */
+
+/* 
+ * [Description]
+ *
+ * Simple test on arch_prctl to set and get cpuid instruction of test thread.
+ */
+
+# include "tst_test.h"
+# include "lapi/syscalls.h"
+# include <stdlib.h>
+# ifdef HAVE_ASM_PRCTL_H
+# include <asm/prctl.h>
+
+static int arch_prctl_get(int code, unsigned long *addr) {
+	return tst_syscall(__NR_arch_prctl, code, *addr);
+}
+
+static int arch_prctl_set(int code, unsigned long addr) {
+	return tst_syscall(__NR_arch_prctl, code, addr);
+}
+
+static int tc[] = {0,1};
+
+static void run(unsigned int index){
+
+	unsigned long *addr = malloc(sizeof(long));
+
+	TEST(arch_prctl_set(ARCH_SET_CPUID, tc[index]));
+
+	if (TST_RET == 0)
+		tst_res(TPASS, "set %s cpuid",tc[index] ? "enable" : "disable");
+	else
+		tst_res(TFAIL, "failed to set cpuid");
+
+	TEST(arch_prctl_get(ARCH_GET_CPUID, addr));
+
+	if (TST_RET == tc[index])
+		tst_res(TPASS, "get cpuid succeed.");
+	else
+		tst_res(TFAIL, "get cpuid failed.");
+}
+
+static struct tst_test test = {
+    .test = run,
+    .tcnt = 2,
+    .min_kver = "4.11",
+};
+
+#else /* HAVE_ASM_PRCTL_H */
+TST_TEST_TCONF("missing <asm/prctl.h>");
+#endif
-- 
2.39.3


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 31+ messages in thread
[parent not found: <tencent_048887541FB562D43FE2D104@qq.com>]
* [LTP] (no subject)
@ 2021-11-15  8:15 Joerg Vehlow
  0 siblings, 0 replies; 31+ messages in thread
From: Joerg Vehlow @ 2021-11-15  8:15 UTC (permalink / raw)
  To: ltp, bogdan.lezhepekov

Subject: [PATCH 0/3] realtime/matrix_mult: Fix test execution

Hi,

this fixes the test execution of matrix_mult.
The workload function was optimized away, because the variables
used for calculations were unreachable outside of the function.

Joerg



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [LTP] (no subject)
@ 2019-10-07  6:45 Joerg Vehlow
  2019-10-07  6:53 ` Joerg Vehlow
  0 siblings, 1 reply; 31+ messages in thread
From: Joerg Vehlow @ 2019-10-07  6:45 UTC (permalink / raw)
  To: ltp

Added changes suggested by Cyril.
BTW: The kernel is still tainted, even if the license is set, because
of out-of-tree module:
> ltp_lsmod01: loading out-of-tree module taints kernel.



^ permalink raw reply	[flat|nested] 31+ messages in thread
* [LTP] (no subject)
@ 2019-08-21  2:25 Jim Woo
  2019-08-22 12:45 ` Cyril Hrubis
  0 siblings, 1 reply; 31+ messages in thread
From: Jim Woo @ 2019-08-21  2:25 UTC (permalink / raw)
  To: ltp

Hi, all:

I want to ask if I can use ltp for stressing CPU and Memory with Linux OS?
If the answer is yes, Can I get the detailed explanation about the hierachy
of ltp because I think the document of ltp did not explain that.

Thanks very much !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20190821/97888cd9/attachment.htm>

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [LTP] [PATCH 1/2] add tst_get_unused_port()
@ 2014-03-07 11:39 Jan Stancek
  2014-03-10 14:22 ` [LTP] (no subject) Jan Stancek
  0 siblings, 1 reply; 31+ messages in thread
From: Jan Stancek @ 2014-03-07 11:39 UTC (permalink / raw)
  To: ltp-list

Returns unused port number for specified domain/type.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 include/test.h |    7 +++++
 lib/tst_net.c  |   81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 0 deletions(-)
 create mode 100644 lib/tst_net.c

diff --git a/include/test.h b/include/test.h
index 81fca3e..49a0f47 100644
--- a/include/test.h
+++ b/include/test.h
@@ -288,6 +288,13 @@ int tst_fill_file(const char *path, char pattern, size_t bs, size_t bcount);
 uid_t tst_get_unused_uid(void);
 gid_t tst_get_unused_gid(void);
 
+/* lib/tst_net.c
+ *
+ * Return unused port
+ */
+unsigned short tst_get_unused_port(unsigned short family, int type,
+	void (cleanup_fn)(void));
+
 #ifdef TST_USE_COMPAT16_SYSCALL
 #define TCID_BIT_SUFFIX "_16"
 #elif  TST_USE_NEWER64_SYSCALL
diff --git a/lib/tst_net.c b/lib/tst_net.c
new file mode 100644
index 0000000..4b30410
--- /dev/null
+++ b/lib/tst_net.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2014 Linux Test Project, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it
+ * is free of the rightful claim of any third person regarding
+ * infringement or the like.  Any license provided herein, whether
+ * implied or otherwise, applies only to this software file.  Patent
+ * licenses, if any, provided herein do not apply to combinations of
+ * this program with other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation, Inc.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include "test.h"
+
+unsigned short tst_get_unused_port(unsigned short family, int type,
+	void (cleanup_fn)(void))
+{
+	int sock;
+	struct sockaddr_in addr4;
+	struct sockaddr_in6 addr6;
+	socklen_t slen;
+	struct sockaddr *addr;
+
+	switch (family) {
+	case AF_INET:
+		addr4.sin_family = AF_INET;
+		addr4.sin_port = 0;
+		addr4.sin_addr.s_addr = INADDR_ANY;
+		slen = sizeof(addr4);
+		addr = (struct sockaddr *)&addr4;
+		break;
+
+	case AF_INET6:
+		addr6.sin6_family = AF_INET6;
+		addr6.sin6_port = 0;
+		addr6.sin6_addr = in6addr_any;
+		slen = sizeof(addr6);
+		addr = (struct sockaddr *)&addr6;
+		break;
+
+	default:
+		tst_brkm(TBROK, cleanup_fn,
+			"tst_get_unused_port unknown family");
+	}
+
+	sock = socket(addr->sa_family, type, 0);
+	if (sock < 0)
+		tst_brkm(TBROK | TERRNO, cleanup_fn, "socket failed");
+
+	if (bind(sock, addr, slen) < 0)
+		tst_brkm(TBROK | TERRNO, cleanup_fn, "bind failed");
+
+	if (getsockname(sock, addr, &slen) == -1)
+		tst_brkm(TBROK | TERRNO, cleanup_fn, "getsockname failed");
+
+	if (close(sock) == -1)
+		tst_brkm(TBROK | TERRNO, cleanup_fn, "close failed");
+
+	switch (family) {
+	case AF_INET:
+		return addr4.sin_port;
+	case AF_INET6:
+		return addr6.sin6_port;
+	default:
+		return -1;
+	}
+}
-- 
1.7.1


------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 31+ messages in thread
* [LTP] (no subject)
@ 2013-08-05 14:44 Stanislav Kholmanskikh
  0 siblings, 0 replies; 31+ messages in thread
From: Stanislav Kholmanskikh @ 2013-08-05 14:44 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko


Hi!

This is a little fix to run quota_remount_test01.sh with SELinux enabled. 
Some distros (CentOS 6.x and, likely, RHEL 6) prevent from creation of quota 
files in 'file_t' directories, some - don't care. 
I tried this fix on CentOS 5.x/6.x and Oracle Linux, Debian 7. Seems, It's ok, and
should not break anything else.

And the test couldn't be invoked under 3.x kernels because of its kernel check. 
Changed it to use tst_kvercmp.

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [LTP] (no subject)
@ 2009-07-01 20:08 Henry Yei
  0 siblings, 0 replies; 31+ messages in thread
From: Henry Yei @ 2009-07-01 20:08 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

It looks like the io_*.sh files are now not needed since the test source has been modified to check for an autoconf definition.
This patch modifies the syscalls runtest file to call those test directly. (io_cancel, io_destroy01, io_getevents01, 
io_setup01, io_submit01)

As the scripts are not needed any more, can we remove the following?

ltp/testcases/kernel/syscalls/io_cancel01.sh
ltp/testcases/kernel/syscalls/io_destroy01.sh
ltp/testcases/kernel/syscalls/io_getevents0101.sh
ltp/testcases/kernel/syscalls/io_setup01.sh
ltp/testcases/kernel/syscalls/io_submit01.sh

These scripts were not being copied into testcases/bin anyway and so AFAIK, did not run correctly by pan anyway.

Henry Yei
MontaVista Software, Inc.
hyei@mvista.com


 

[-- Attachment #2: syscalls-io.patch --]
[-- Type: application/octet-stream, Size: 496 bytes --]

--- community/ltp/runtest/syscalls	2009-07-01 12:52:08.137504800 -0700
+++ ltp/runtest/syscalls	2009-07-01 12:52:08.340627200 -0700
@@ -441,11 +441,11 @@
 iopl01 iopl01
 iopl02 iopl02
 
-io_cancel01 run-io_cancel.sh
-io_destroy01 run-io_destroy.sh
-io_getevents01 run-io_getevents.sh
-io_setup01 run-io_setup.sh
-io_submit01 run-io_submit.sh
+io_cancel01 io_cancel01
+io_destroy01 io_destroy01
+io_getevents01 io_getevents01
+io_setup01 io_setup01
+io_submit01 io_submit01
 
 keyctl01 keyctl01
 

[-- Attachment #3: Type: text/plain, Size: 79 bytes --]

------------------------------------------------------------------------------

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 31+ messages in thread
* [LTP] (no subject)
@ 2009-06-24 22:58 Henry Yei
  0 siblings, 0 replies; 31+ messages in thread
From: Henry Yei @ 2009-06-24 22:58 UTC (permalink / raw)
  To: ltp-list

[-- Attachment #1: Type: text/plain, Size: 332 bytes --]

Submitting a patch for the splice01 test. Previously the test was checking if the current working directory was NFS based as which the test. The patch changes this test to check whether the test directory is on NFS, as that is actually where the test gets run. 

Henry Yei (QA)
MontaVista Software, Inc.
hyei@mvista.com


 

[-- Attachment #2: splice01.patch --]
[-- Type: application/octet-stream, Size: 549 bytes --]

--- ltp-full-20090531/testcases/kernel/syscalls/splice/splice01.c	2009-03-23 06:36:06.000000000 -0700
+++ ltp/testcases/kernel/syscalls/splice/splice01.c	2009-06-23 13:37:31.017333600 -0700
@@ -96,12 +96,14 @@
 	setup();
 
 	/*
-	 * check if the current filesystem is nfs
+	 * check if the current filesystem of the test directory is nfs
 	 */
+	tst_tmpdir();
 	if (tst_is_cwd_nfs()) {
 		tst_brkm(TCONF, cleanup,
 			 "Cannot do splice on a file located on an NFS filesystem");
 	}
+	tst_rmdir();
 
 	/*
 	 * check looping state if -c option given

[-- Attachment #3: Type: text/plain, Size: 79 bytes --]

------------------------------------------------------------------------------

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2024-05-09 10:29 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19  7:07 [LTP] [PATCH v2] Add case about arch_prctl syscall lufei
2024-04-19 15:46 ` Cyril Hrubis
2024-04-21  6:25 ` lufei
2024-04-21  7:15 ` [LTP] (no subject) lufei
2024-04-21  7:15   ` [LTP] [PATCH v2] Add case about arch_prctl syscall lufei
2024-04-26  8:36   ` [LTP] (no subject) Cyril Hrubis
2024-04-26  9:42     ` 路斐
2024-04-26 10:28       ` Cyril Hrubis
2024-04-26 12:27         ` 路斐
2024-04-26 12:47           ` Jan Stancek
2024-04-23  1:05 ` [LTP] [PATCH v2] Add case about arch_prctl syscall lufei
2024-04-28  7:44 ` [LTP] (no subject) lufei
2024-04-28  7:44   ` [LTP] [PATCH] Add case about arch_prctl syscall lufei
2024-04-29 15:02     ` Cyril Hrubis
     [not found]     ` <20240506070336.2711930-1-lufei@uniontech.com>
2024-05-06  7:03       ` lufei
2024-05-06  9:53         ` Cyril Hrubis
     [not found]         ` <20240507043235.1692-1-lufei@uniontech.com>
2024-05-07  4:32           ` lufei
2024-05-07 12:50             ` Cyril Hrubis
2024-05-08  2:29               ` 路斐
     [not found]             ` <20240508015852.3362-1-lufei@uniontech.com>
2024-05-08  1:58               ` lufei
2024-05-09 10:27                 ` Cyril Hrubis
     [not found] <tencent_048887541FB562D43FE2D104@qq.com>
2024-04-28  7:16 ` [LTP] (no subject) =?gb18030?B?wrfssw==?=
  -- strict thread matches above, loose matches on Subject: below --
2021-11-15  8:15 Joerg Vehlow
2019-10-07  6:45 Joerg Vehlow
2019-10-07  6:53 ` Joerg Vehlow
2019-08-21  2:25 Jim Woo
2019-08-22 12:45 ` Cyril Hrubis
2014-03-07 11:39 [LTP] [PATCH 1/2] add tst_get_unused_port() Jan Stancek
2014-03-10 14:22 ` [LTP] (no subject) Jan Stancek
2013-08-05 14:44 Stanislav Kholmanskikh
2009-07-01 20:08 Henry Yei
2009-06-24 22:58 Henry Yei

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.