Skip to contentSkip to conversation

Adapt the cgroup/test_6_2 test to the various ways clone is called on different architectures

PATCH Cyril Hrubis 1 participant 1 message Jun 24, 2009

lore
Share & tools
lore
#0 lore raw

Hi,
that's the clone() check I was speaking about here. IMHO much cleaner solution is to create some directory in ltp root (someting like libftest) and put all such headers and code there, so they are not copied and spread all around ltp.

Quoted 79 lines

Code shamelessly taken from clone01 test

---
 .../kernel/controllers/cgroup/clone_platform.h     |   34 ++++++++++++++++++++
 testcases/kernel/controllers/cgroup/test_6_2.c     |   12 ++++++-
 2 files changed, 45 insertions(+), 1 deletions(-)
 create mode 100644 testcases/kernel/controllers/cgroup/clone_platform.h
testcases/kernel/controllers/cgroup/clone_platform.h new file +34 -0
new file mode 100644
index 0000000..1785dd1
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2003 Silicon Graphics, Inc.  All Rights Reserved.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston MA 02111-1307, USA.
+ *
+ */
+/* Common platform specific defines for the clone system call tests */
+
+//#define CHILD_STACK_SIZE 8192
+#define CHILD_STACK_SIZE 16384
+
+#if defined (__s390__) || (__s390x__)
+#define clone __clone
+extern int __clone(int(void*),void*,int,void*);
+#elif defined(__ia64__)
+#define clone2 __clone2
+/* Prototype provided by David Mosberger				*/
+/* int  __clone2(int (*fn) (void *arg), void *child_stack_base,		*/
+/* 		size_t child_stack_size, int flags, void *arg,		*/
+/*		pid_t *parent_tid, void *tls, pid_t *child_tid)		*/
+extern int  __clone2(int (*fn) (void *arg), void *child_stack_base, 
+		size_t child_stack_size, int flags, void *arg, 
+		pid_t *parent_tid, void *tls, pid_t *child_tid); 
+#endif
testcases/kernel/controllers/cgroup/test_6_2.c +11 -1
index e5bddb2..79f5c20 100644
@@ -24,6 +24,8 @@
 #include <unistd.h>
 #include <sched.h>
 
+#include "clone_platform.h"
+
 #define DEFAULT_USEC	30000
 
 int foo(void __attribute__((unused)) *arg)
@@ -42,7 +44,15 @@ int main(int argc, char **argv)
 
 	while (1) {
 		usleep(usec);
-		clone(foo, stack+4096, CLONE_NEWNS, NULL);
+#if defined(__hppa__)
+		clone(foo, stack, CLONE_NEWNS, NULL);
+#elif defined(__ia64__)
+		clone2(foo, stack,
+			    4096, CLONE_NEWNS, NULL, NULL, NULL, NULL);
+#else
+		clone
+		     (foo, stack + 4096, CLONE_NEWNS, NULL);
+#endif
 	}
 
 	return 0;
Signature · 8 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list