Quoting Rishikesh ([EMAIL PROTECTED]):
> Serge E. Hallyn wrote:
> >Quoting Serge E. Hallyn ([EMAIL PROTECTED]):
> >>Quoting Subrata Modak ([EMAIL PROTECTED]):
> >>>Hi Rishikesh/Sergei,
> >>>
> >>>Any fix available for the same ?? ;-)
> >>Please try the following patch...
> >
> >I'm sorry, that should handle archictures without unshare (?) but not
> >older kernels.
> >
> >The following patch adds a check for a 2.6.16 kernel, which it looks
> >like is where unshare was added.
> >
> >BTW, I may be off, but I think the comments for
> >lib/tst_kvercmp.c:tst_kvercmp() are wrong, aren't they?  Doesn't it
> >return a positive int if arg < current kernel version, and positive int
> >if arg > current kernel version?
> 
> Yep i verified it , it is correct
> 
> arg > kernel version = it is returning negative .
> arg < kernel version = it is returning positive.
> 
> Where arg = 2.6.17 , current kernel versions are = 2.6.15 & 
> 2.6.18.8-el5

Yup it's clear to me in light of morning.  You see why i couldn't get
the right patch attached last night  :)

Here is the patch I finally managed to sling over to Rishi, who has
confirmed it tests correctly on both old and new kernels.

Please apply,

thanks,
-serge

diff -Nrup ltp/testcases/kernel/containers/Makefile 
ltp-patched/testcases/kernel/containers/Makefile
--- ltp/testcases/kernel/containers/Makefile    2007-04-26 13:02:50.000000000 
+0200
+++ ltp-patched/testcases/kernel/containers/Makefile    2007-06-26 
05:10:01.000000000 +0200
@@ -1,14 +1,25 @@
 SUBDIRS = libclone utsname
 
-all noltp noltp_check:
+all:
+       @set -e; $(MAKE) check_for_unshare; \
+       if './check_for_unshare' > /dev/null 2>&1; then \
+               for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done \
+       else echo "system does not support unshare"; true; fi
+
+noltp noltp_check:
        @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
 
+check_for_unshare: check_for_unshare.c
+       $(CC) -o $@ $< ../../../lib/tst_kvercmp.c -I../../../include
+
 install:
-       @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i install ; done
-       chmod ugo+x container_test.sh
-       ln -f container_test.sh ../../bin/container_test.sh
+       @set -e; ln -f check_for_unshare ../../bin/check_for_unshare; \
+       ln -f container_test.sh ../../bin/container_test.sh; \
+       if './check_for_unshare' > /dev/null 2>&1; then \
+               for i in $(SUBDIRS); do $(MAKE) -C $$i install ; done; \
+               chmod ugo+x container_test.sh; \
+       else echo "system does not support unshare"; true; fi
 
 clean:
        @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean ; done
-
-
+       rm -f check_for_unshare
diff -Nrup ltp/testcases/kernel/containers/check_for_unshare.c 
ltp-patched/testcases/kernel/containers/check_for_unshare.c
--- ltp/testcases/kernel/containers/check_for_unshare.c 1970-01-01 
01:00:00.000000000 +0100
+++ ltp-patched/testcases/kernel/containers/check_for_unshare.c 2007-06-26 
04:08:52.000000000 +0200
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <test.h>
+
+int kernel_is_too_old(void) {
+       if (tst_kvercmp(2,6,16) < 0)
+               return 1;
+       return 0;
+}
+
+/*
+ * yeah, to make the makefile coding easier, do_check returns 
+ * 1 if unshare is not supported, 0 if it is
+ */
+#ifndef SYS_unshare
+#ifdef __NR_unshare
+int do_check(void) { return kernel_is_too_old(); }
+#elif __i386__
+int do_check(void) { return kernel_is_too_old(); }
+#elif __ia64__
+int do_check(void) { return kernel_is_too_old(); }
+#elif __x86_64__
+int do_check(void) { return kernel_is_too_old(); }
+#elif __s390x__ || __s390__
+int do_check(void) { return kernel_is_too_old(); }
+#elif __powerpc__
+int do_check(void) { return kernel_is_too_old(); }
+#else
+int do_check(void) { return 1; }
+#endif
+#endif
+
+int main() {
+       return do_check();
+}
diff -Nrup ltp/testcases/kernel/containers/container_test.sh 
ltp-patched/testcases/kernel/containers/container_test.sh
--- ltp/testcases/kernel/containers/container_test.sh   2007-04-26 
13:02:50.000000000 +0200
+++ ltp-patched/testcases/kernel/containers/container_test.sh   2007-06-25 
20:27:17.000000000 +0200
@@ -10,6 +10,12 @@
 # any later version.
 
 #check_utsns_enabled
+check_for_unshare
+if [ $? -eq 1 ]; then
+       echo "Unshare not supported.  Not running container tests"
+       exit 0
+fi
+
 #if [ $? -eq 0 ]; then
        echo "Running utsns tests."
        runutstest.sh

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to