Re: [LTP] [PATCH] syscalls: fix some failure on arch X86_64

2009-12-22 Thread liubo
On 12/22/2009 10:51 AM, Garrett Cooper wrote:
 On Fri, Dec 18, 2009 at 8:03 AM, Subrata Modak
 subr...@linux.vnet.ibm.com wrote:
   
 Garret,

 Not sure if you applied this :-(

 Regards--
 Subrata

 On Wed, 2009-12-09 at 15:34 +0800, liubo wrote:
 
 Here is the patch, which contains lots of adjustments
 on style, so it might be a bit huge.

 Testcase 1. rt_sigaction01
 On arch x86_64, if we directly get to call syscall
 rt_sigaction, there will be segment fault.
 1) One reason is that we must supply the flag of
 SA_RESTORER and the correct pointer to the fuction
 restorer, according to the kernel code.
 2) The other reason is that default syscall rt_sigaction
 use kernel sigaction structure, which is different
 with normal sigaction structure.

 So,
 1) We manage to find the address of the function
 restorer by using glibc function sigaction,
 which might be something tricky. Then we add these
 arguments to make test run correctly.
 2) We also use kernel sigaction structure to fit
 realtime syscall __NR_rt_sigaction.

 Testcase 2. rt_sigprocmask01
 First, there exsits the same problem as rt_sigaction01.
 Second, this testcase uses a unchanged signal number 33,
 which may diff among different archs and lead to error
 unknown signal.

 So, we use a macro TEST_SIG which refers to SIGRTMIN
 to replace 33.

 Testcase 3. rt_sigsuspend01
 There exists the same problem as rt_sigaction01.

 This patch fixed these failure.
   

 No, I didn't commit this because it's long, and I'm not sure if
 it's doing the right thing as per my research over the past couple of
 weeks. These tests are tricky because it requires a particular formula
 of preset variables and structures in order to properly use
 rt_sigaction, and that's where we're running into issues with them on
 x86_64 -- because the syscall implementers decided to remain sort of
 backwards compatible with x86, and that's why it's such a mess to deal
 with.
 I will look at the diff and pick out which parts are of value, but
 a lot of this diff's contents are basically reverting the changes that
 I made this month.
 Thanks,
 -Garrett


   
Hi, Garrett,
In my patch, I adopted a kind of method which is different from
your previous changes about this.
I try to find the address of restore_rt which is needed by
syscall rt_sigaction, and I managed to get this address by
tracing glibc function sigaction.
After doing these, I also found rt_sigaction's sigaction struct is
different from normal sigaction struct, so when copy from normal
sigaction struct to rt_sigaction's kernel sigaction struct, some
kind of segmental fault will ocurr to us.
So, I did some changes to revert your previous changes and directly
adopted the function restore_rt and kernel sigaction struct to fix
these bugs.
Hope these are helpful to you.

Thanks,
-Liu Bo
--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev ___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] [PATCH] containers: mqns: use libc's mq_open, not syscall(__NR_mq_open

2009-12-22 Thread Serge E. Hallyn
The glibc version removes the leading '/' from the message queue name.
Not doing so makes the system call fail.  We could just remove the
'/' from SLASH_MQ1, if for some reason that were preferred, but using
glibc functions when possible seems cleaner to me.

Signed-off-by: Serge Hallyn se...@us.ibm.com
---
 testcases/kernel/containers/mqns/mqns_01.c |9 -
 testcases/kernel/containers/mqns/mqns_02.c |8 +++-
 testcases/kernel/containers/mqns/mqns_03.c |3 +--
 testcases/kernel/containers/mqns/mqns_04.c |2 +-
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/testcases/kernel/containers/mqns/mqns_01.c 
b/testcases/kernel/containers/mqns/mqns_01.c
index 7f41b2d..2f3bf8e 100644
--- a/testcases/kernel/containers/mqns/mqns_01.c
+++ b/testcases/kernel/containers/mqns/mqns_01.c
@@ -55,7 +55,7 @@ int check_mqueue(void *vtest)
 
if (read(p1[0], buf, strlen(go) + 1)  0)
tst_resm(TBROK | TERRNO, read(p1[0], ...) failed);
-   mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDONLY);
+   mqd = mq_open(SLASH_MQ1, O_RDONLY);
if (mqd == -1) {
if (write(p2[1], notfnd, strlen(notfnd) + 1)  0)
tst_resm(TBROK | TERRNO, write(p2[1], ...) failed);
@@ -86,8 +86,7 @@ main(int argc, char *argv[])
if (pipe(p1) == -1) { perror(pipe); exit(EXIT_FAILURE); }
if (pipe(p2) == -1) { perror(pipe); exit(EXIT_FAILURE); }
 
-   mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777,
-   NULL);
+   mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777, NULL);
if (mqd == -1) {
perror(mq_open);
tst_resm(TFAIL, mq_open failed\n);
@@ -100,7 +99,7 @@ main(int argc, char *argv[])
if (r  0) {
tst_resm(TFAIL, failed clone/unshare\n);
mq_close(mqd);
-   syscall(__NR_mq_unlink, SLASH_MQ1);
+   mq_unlink(SLASH_MQ1);
tst_exit();
}
 
@@ -122,7 +121,7 @@ main(int argc, char *argv[])
 
/* destroy the mqueue */
mq_close(mqd);
-   syscall(__NR_mq_unlink, SLASH_MQ1);
+   mq_unlink(SLASH_MQ1);
 
tst_exit();
 }
diff --git a/testcases/kernel/containers/mqns/mqns_02.c 
b/testcases/kernel/containers/mqns/mqns_02.c
index aa78f65..5343d5b 100644
--- a/testcases/kernel/containers/mqns/mqns_02.c
+++ b/testcases/kernel/containers/mqns/mqns_02.c
@@ -60,8 +60,7 @@ int check_mqueue(void *vtest)
tst_resm(TBROK | TERRNO, read(p1[0], ..) failed);
else {
 
-   mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL,
-   0777, NULL);
+   mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777, NULL);
if (mqd == -1) {
if (write(p2[1], mqfail, strlen(mqfail) + 1)  0) {
tst_resm(TBROK | TERRNO,
@@ -85,8 +84,7 @@ int check_mqueue(void *vtest)
if (mq_close(mqd)  0) {
tst_resm(TBROK | TERRNO,
mq_close(mqd) failed);
-   } else if (syscall(__NR_mq_unlink,
-   SLASH_MQ1)  0) {
+   } else if (mq_unlink(SLASH_MQ1)  0) {
tst_resm(TBROK | TERRNO,
mq_unlink( SLASH_MQ1
) failed);
@@ -153,7 +151,7 @@ int main(int argc, char *argv[])
tst_exit();
} else {
 
-   mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDONLY);
+   mqd = mq_open(SLASH_MQ1, O_RDONLY);
if (mqd == -1) {
tst_resm(TPASS, Parent process can't see the 
mqueue\n);
} else {
diff --git a/testcases/kernel/containers/mqns/mqns_03.c 
b/testcases/kernel/containers/mqns/mqns_03.c
index 3c9e83e..6a841b8 100644
--- a/testcases/kernel/containers/mqns/mqns_03.c
+++ b/testcases/kernel/containers/mqns/mqns_03.c
@@ -63,8 +63,7 @@ int check_mqueue(void *vtest)
 
read(p1[0], buf, 3); /* go */
 
-   mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755,
-   NULL);
+   mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755, NULL);
if (mqd == -1) {
write(p2[1], mqfail, 7);
tst_exit();
diff --git a/testcases/kernel/containers/mqns/mqns_04.c 
b/testcases/kernel/containers/mqns/mqns_04.c
index 8a4a9c2..6ce9e34 100644
--- a/testcases/kernel/containers/mqns/mqns_04.c
+++ b/testcases/kernel/containers/mqns/mqns_04.c
@@ -59,7 +59,7 @@ int check_mqueue(void *vtest)
 
read(p1[0], buf, 3); /* go */
 
-   mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755,
+   

Re: [LTP] nanosleep{02~04} testcase failed

2009-12-22 Thread Garrett Cooper
On Mon, Dec 21, 2009 at 9:17 PM, Mitani mit...@ryobi.co.jp wrote:

 I revised patch into WIFEXITED(status)  WEXITSTATUS(status) == 0, and 
 tried to test.
 After that, nanosleep could work correctly.
 I agree with your proposal.

 Thank you for your help!

 -Tomonori Mitani

 -Original Message-
 From: Garrett Cooper [mailto:yaneg...@gmail.com]
 Sent: Tuesday, December 22, 2009 11:45 AM
 To: Mitani
 Cc: ltp-list@lists.sourceforge.net
 Subject: Re: [LTP] nanosleep{02~04} testcase failed

 2009/12/20 Mitani mit...@ryobi.co.jp:
 Hi,

 I found that nanosleep{02~04} testcase failed like follow example.
 --
 nanosleep02    1  TFAIL  :  child process exited abnormally
 --

 In ${LTPROOT}/testcases/kernel/syscalls/nanosleep/nanosleep{02~04}.c,
 WEXITSTATUS(status) is used to judge whether child process did exit
 normally.
 But WEXITSTATUS macro is used only when WIFEXITED macro returned true.
 So, it cannot get the correct results and it terminated with the above
 error.

 To solve this problem, I thought that we had better use WIFEXITED macro
 instead of the WEXITSTATUS macro.
 Here are patches to fix these problem:
 
 --- nanosleep02.c       2009-11-02 22:57:17.0 +0900
 +++ nanosleep02.c.new   2009-12-21 14:15:19.0 +0900
 @@ -162,10 +162,10 @@

                /* Wait for child to execute */
                wait(status);
 -               if (WEXITSTATUS(status) == 0) {
 +               if (WIFEXITED(status)) {
                        tst_resm(TPASS, Functionality of nanosleep() 
                                 is correct);
 -               } else if (WEXITSTATUS(status) == 1) {
 +               } else if (!WIFEXITED(status)) {
                        tst_resm(TFAIL, child process exited abnormally);
                }
        }                       /* End for TEST_LOOPING */

 

 
 --- nanosleep03.c       2009-11-02 22:57:17.0 +0900
 +++ nanosleep03.c.new   2009-12-21 15:03:52.0 +0900
 @@ -143,10 +143,10 @@

                /* Wait for child to execute */
                wait(status);
 -               if (WEXITSTATUS(status) == 0) {
 +               if (WIFEXITED(status)) {
                        tst_resm(TPASS, nanosleep() fails, interrupted
                                  by signal, error:%d, EINTR);
 -               } else if (WEXITSTATUS(status) == 1) {
 +               } else if (!WIFEXITED(status)) {
                        tst_resm(TFAIL, child process exited abnormally);
                }
        }                       /* End for TEST_LOOPING */

 

 
 --- nanosleep04.c       2009-11-02 22:57:17.0 +0900
 +++ nanosleep04.c.new   2009-12-21 15:04:24.0 +0900
 @@ -147,10 +147,10 @@

                /* Wait for child to execute */
                wait(status);
 -               if (WEXITSTATUS(status) == 0) {
 +               if (WIFEXITED(status)) {
                        tst_resm(TPASS, nanosleep() fails, invalid pause 
                                 time, error:%d, EINVAL);
 -               } else if (WEXITSTATUS(status) == 1) {
 +               } else if (!WIFEXITED(status)) {
                        tst_resm(TFAIL, child process exited abnormally);
                }
        }                       /* End for TEST_LOOPING */
 

 I agree that the test's validation step is written incorrectly, as per
 the wait(2) manpage:


       WIFEXITED(status)
              returns true if the child terminated normally, that is, by call-
              ing exit(3) or _exit(2), or by returning from main().

       WEXITSTATUS(status)
              returns the exit status of the  child.   This  consists  of  the
              least  significant  8 bits of the status argument that the child
              specified in a call to exit(3) or _exit(2) or  as  the  argument
              for  a  return  statement  in main().  This macro should only be
              employed if WIFEXITED returned true.

    in particular the precondition for calling WEXITSTATUS, but should
 it be WIFEXITED(status)  WEXITSTATUS(status) == 0 = PASS, else
 FAIL?

Committed -- thanks!
-Garrett
--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] nm testcase failed

2009-12-22 Thread Garrett Cooper
On Mon, Dec 21, 2009 at 8:00 PM, Mitani mit...@ryobi.co.jp wrote:
 Hi,

 I found that nm testcase failed as follows:
 
 gcc: /opt/ltp/testcases/bin/nmfile1.c: No such file or directory
 gcc: no input files
 gcc: /opt/ltp/testcases/bin/nmfile2.c: No such file or directory
 gcc: no input files
 gcc: /opt/ltp/testcases/bin/nmfile3.c: No such file or directory
 gcc: no input files
 

 This problem occurs because nmfile1.c, nmfile2.c and nmfile3.c
 are not installed to execute directory (/opt/ltp/testcases/bin).

 To solve this problem, I suggest to apply this patch to Makefile
 (${LTPROOT}/testcases/commands/ade/nm/Makefile).

 
 --- Makefile    2009-10-10 02:55:44.0 +0900
 +++ Makefile.new        2009-12-22 10:22:31.0 +0900
 @@ -24,7 +24,7 @@

  include $(top_srcdir)/include/mk/env_pre.mk

 -INSTALL_TARGETS                := nm01 nmfile.c
 +INSTALL_TARGETS                := nm01 nmfile.c nmfile1.c nmfile2.c
 nmfile3.c

  MAKE_TARGETS           := $(patsubst $(abs_srcdir)/%.c,%.obj,$(wildcard
 $(abs_srcdir)/*.c))

Good catch! Committed.
-Garrett

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] Fwd: get_mempolicy01 build failure in CVS

2009-12-22 Thread Garrett Cooper
FYI...

-- Forwarded message --
From: Garrett Cooper yaneg...@gmail.com
Date: Tue, Dec 22, 2009 at 4:18 PM
Subject: Re: get_mempolicy01 build failure in CVS
To: subr...@linux.vnet.ibm.com


On Mon, Dec 21, 2009 at 6:47 PM, Garrett Cooper yaneg...@gmail.com wrote:
 On Mon, Dec 21, 2009 at 3:56 AM, Subrata Modak
 subr...@linux.vnet.ibm.com wrote:
 However, apart from this, the other issues of build error when trying to
 compile LTP from 2 different locations in the same machine seems fixed
 w.r.t the libcontrollers and linsctp.

 Can you just look into the below 2 build errors ?

 Regards--
 Subrata

 On Mon, 2009-12-21 at 15:11 +0530, Subrata Modak wrote:
 This as well:

 gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall
 -I/home/subratamodak/OFFICE_WORKS/LTP_PROJECT_CODE/LTP_NIGHTLY_SNAPSHOTS/21_DECEMBER_2009/ltp-intermediate-20091221/testcases/kernel/include
  
 -I/home/subratamodak/OFFICE_WORKS/LTP_PROJECT_CODE/LTP_NIGHTLY_SNAPSHOTS/21_DECEMBER_2009/ltp-intermediate-20091221/testcases/kernel/syscalls/mbind/../utils/
  -I../../../../include -I../../../../include   -L../../../../lib  mbind01.c 
   -lltp -lnuma -o mbind01
 mbind01.c: In function ‘do_test’:
 mbind01.c:271: warning: passing argument 1 of ‘nodemask_zero’ from
 incompatible pointer type
 /usr/include/numa.h:61: note: expected ‘struct bitmask *’ but argument
 is of type ‘struct nodemask_t *’
 mbind01.c:272: warning: implicit declaration of function ‘nodemask_set’
 mbind01.c:273: warning: passing argument 1 of ‘nodemask_zero’ from
 incompatible pointer type
 /usr/include/numa.h:61: note: expected ‘struct bitmask *’ but argument
 is of type ‘struct nodemask_t *’
 mbind01.c:315: warning: passing argument 1 of ‘nodemask_zero’ from
 incompatible pointer type
 /usr/include/numa.h:61: note: expected ‘struct bitmask *’ but argument
 is of type ‘struct nodemask_t *’
 mbind01.c:319: warning: passing argument 1 of ‘nodemask_equal’ from
 incompatible pointer type
 /usr/include/numa.h:66: note: expected ‘struct bitmask *’ but argument
 is of type ‘struct nodemask_t *’
 mbind01.c:319: warning: passing argument 2 of ‘nodemask_equal’ from
 incompatible pointer type
 /usr/include/numa.h:66: note: expected ‘struct bitmask *’ but argument
 is of type ‘struct nodemask_t *’
 /tmp/ccIMfEh8.o: In function `do_test':
 /home/subratamodak/OFFICE_WORKS/LTP_PROJECT_CODE/LTP_NIGHTLY_SNAPSHOTS/21_DECEMBER_2009/ltp-intermediate-20091221/testcases/kernel/syscalls/mbind/mbind01.c:272:
  undefined reference to `nodemask_set'
 collect2: ld returned 1 exit status
 make[4]: *** [mbind01] Error 1

 Regards--
 Subrata

 On Mon, 2009-12-21 at 14:57 +0530, Subrata Modak wrote:
  Garret,
 
  This still exists:
 
  gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall
  -I/home/subratamodak/OFFICE_WORKS/LTP_PROJECT_CODE/LTP_NIGHTLY_SNAPSHOTS/21_DECEMBER_2009/ltp-intermediate-20091221/testcases/kernel/include
   
  -I/home/subratamodak/OFFICE_WORKS/LTP_PROJECT_CODE/LTP_NIGHTLY_SNAPSHOTS/21_DECEMBER_2009/ltp-intermediate-20091221/testcases/kernel/syscalls/get_mempolicy/../utils
   -I../../../../include -I../../../../include   -L../../../../lib  
  get_mempolicy01.c   -lltp -lnuma -o get_mempolicy01
  get_mempolicy01.c: In function ‘do_test’:
  get_mempolicy01.c:282: warning: passing argument 1 of ‘nodemask_zero’
  from incompatible pointer type
  /usr/include/numa.h:61: note: expected ‘struct bitmask *’ but argument
  is of type ‘struct nodemask_t *’
  get_mempolicy01.c:283: warning: implicit declaration of function
  ‘nodemask_set’
  get_mempolicy01.c:284: warning: passing argument 1 of ‘nodemask_zero’
  from incompatible pointer type
  /usr/include/numa.h:61: note: expected ‘struct bitmask *’ but argument
  is of type ‘struct nodemask_t *’
  get_mempolicy01.c:337: warning: passing argument 1 of ‘nodemask_zero’
  from incompatible pointer type
  /usr/include/numa.h:61: note: expected ‘struct bitmask *’ but argument
  is of type ‘struct nodemask_t *’
  get_mempolicy01.c:338: warning: passing argument 1 of ‘nodemask_equal’
  from incompatible pointer type
  /usr/include/numa.h:66: note: expected ‘struct bitmask *’ but argument
  is of type ‘struct nodemask_t *’
  get_mempolicy01.c:338: warning: passing argument 2 of ‘nodemask_equal’
  from incompatible pointer type
  /usr/include/numa.h:66: note: expected ‘struct bitmask *’ but argument
  is of type ‘struct nodemask_t *’
  /tmp/ccGgUpUU.o: In function `do_test':
  /home/subratamodak/OFFICE_WORKS/LTP_PROJECT_CODE/LTP_NIGHTLY_SNAPSHOTS/21_DECEMBER_2009/ltp-intermediate-20091221/testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c:283:
   undefined reference to `nodemask_set'
  collect2: ld returned 1 exit status
  make[4]: *** [get_mempolicy01] Error 1
 
  # uname -a
  Linux 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686 i386
  GNU/Linux
  # cat /etc/issue
  Red Hat Enterprise Linux Client release 5.2 (Tikanga)
  Kernel \r on an \m

    I'll do that tonight because I grabbed the source for the package.
 

Re: [LTP] cgroup_fj and cgroup have problems?

2009-12-22 Thread Garrett Cooper
On Mon, Dec 14, 2009 at 12:08 AM, Mitani mit...@ryobi.co.jp wrote:
 I took your indication and changed the patch as follows.

 Case 1:
 I revised [ -f /proc/cgroups ] case to use tst_resm TCONF
 instead of echo.
 But this revision is unbalanced with the other exit messages,
 so I revised other cases too.
 I don't know how to use exit code, so I use 0 or 1.
 I might mistake those code.

 
 --- run_cgroup_test_fj.sh       2009-10-26 23:49:23.0 +0900
 +++ run_cgroup_test_fj.sh.new   2009-12-14 14:21:53.0 +0900
 @@ -34,19 +34,19 @@
  export CASENO2=0

  if [ $(id -ru) -ne 0 ]; then
 -       echo ***error***:you must use root to test
 -       exit -1
 +       tst_brkm TBROK ignored ***error***:you must use root to test
 +       exit 1
  fi

  if ! [ -f /proc/cgroups ]; then
 -       echo ***error***:you must enable cgroup config in kernel;
 -       exit -3;
 +       tst_resm TCONF ***error***:you must enable cgroup config in
 kernel;
 +       exit 0;
  fi

  if [ ! -x $TESTROOT/cgroup_fj_proc ]; then
 -       echo ***warning***:file \cgroup_fj_proc\ is not exist or not
 executable;
 -       echo please do make and check execution permission
 -       exit -4;
 +       tst_brkm TBROK ignored ***warning***:file \cgroup_fj_proc\ is not
 exist or not executable;
 +       tst_brkm TBROK ignored please do make and check execution
 permission
 +       exit 1;
  fi

  CPUSET=`grep -w cpuset /proc/cgroups | cut -f1`;
 @@ -83,10 +83,10 @@
         SYBSYSCOMPILED=$SYBSYSCOMPILED devices,
  fi
  if [ $SYBSYSCOMPILED =  ];then     # Warning and exit if all cgroup
 subsystem are not compiled
 -       echo CONTROLLERS TESTCASES: WARNING;
 -       echo Kernel does not support for any cgroup subsystem;
 -       echo Skipping all controllers testcases;
 -       exit -2;
 +       tst_resm TCONF CONTROLLERS TESTCASES: WARNING;
 +       tst_resm TCONF Kernel does not support for any cgroup subsystem;
 +       tst_resm TCONF Skipping all controllers testcases;
 +       exit 0;
  fi

  echo Now, we start the test for cgroup...;
 


 Case 2:
 I revised [ $USER != root ] case, and revised
 [ ! -f /proc/cgroups ] case to use tst_resm instead of echocase
  for balance.

 
 --- cgroup_regression_test.sh   2009-11-30 17:41:37.0 +0900
 +++ cgroup_regression_test.sh.new       2009-12-14 11:42:58.0 +0900
 @@ -29,15 +29,15 @@
  export TST_COUNT=1

  if [ ! -f /proc/cgroups ]; then
 -        echo CONTROLLERS TESTCASES: WARNING
 -        echo Kernel does not support for control groups;
 -        echo Skipping all controllers testcases;
 +       tst_resm TCONF CONTROLLERS TESTCASES: WARNING
 +       tst_resm TCONF Kernel does not support for control groups
 +       tst_resm TCONF Skipping all controllers testcases
        exit 0
  fi

  if [ $USER != root ]; then
        tst_brkm TBROK ignored Test must be run as root
 -       exit 0
 +       exit 1
  fi

  tst_kvercmp 2 6 29
 


 Regards--


 -Tomonori Mitani


 -Original Message-
 From: Garrett Cooper [mailto:yaneg...@gmail.com]
 Sent: Friday, December 11, 2009 6:45 PM
 To: Mitani
 Cc: ltp-list@lists.sourceforge.net
 Subject: Re: [LTP] cgroup_fj and cgroup have problems?

 On Dec 11, 2009, at 1:21 AM, Mitani wrote:

 Hi,

 Sorry for my many many mails today.


 I ran tests with ltp-2009-12-10 cvs.

 In my system (kernel 2.6.18-164.el5), kernel does not support
 control groups.
 So, when I ran test of cgroup_fj, I got following message and the
 test faild by FAIL 253.

 
 ***error***:you must enable cgroup config in kernel
 

 In the investigation for above error message, I found that there may be
 two problems,.

  (a) cgroup_fj test failed in the system not support control groups.
  (b) cgroup test may passed by user-ID which isn't root.


 (a) cgroup_fj test
  Above message is correct message, but exiting by FAIL is not
  correct, I think.
  Referring to the example of other tests, I think that the tests
  for non-supported functions must be finished in PASS 0 basically.
  (For example, move_pages{01...11} tests exit in PASS 0 and with
  NUMA support not provided messages.)

  I suggest following patch to resolve this problem.

 
 --- run_cgroup_test_fj.sh     2009-10-26 23:49:23.0 +0900
 +++ run_cgroup_test_fj.sh.new 2009-12-11 16:10:39.0 +0900
 @@ -40,7 +40,7 @@

 if ! [ -f /proc/cgroups ]; then
       echo ***error***:you must enable cgroup config in kernel;
 -     exit -3;
 +     exit 0;
 fi

 if [ ! -x $TESTROOT/cgroup_fj_proc ]; then

 


 (b) cgroup test
  I watched cgroup test source for hints for (a), and found another
  problem.
  If this test run by user-ID non-root, it will exit in PASS, I think.
  But I think that it must exit in FAIL.
  Because this test cannot be tested only by root user.

 =
 --- cgroup_regression_test.sh 2009-11-30 17:41:37.0 +0900
 +++ cgroup_regression_test.sh.new     

Re: [LTP] [PATCH] containers: mqns: use libc's mq_open, not syscall(__NR_mq_open

2009-12-22 Thread Garrett Cooper
On Tue, Dec 22, 2009 at 9:11 AM, Serge E. Hallyn se...@us.ibm.com wrote:
 The glibc version removes the leading '/' from the message queue name.
 Not doing so makes the system call fail.  We could just remove the
 '/' from SLASH_MQ1, if for some reason that were preferred, but using
 glibc functions when possible seems cleaner to me.

 Signed-off-by: Serge Hallyn se...@us.ibm.com
 ---
  testcases/kernel/containers/mqns/mqns_01.c |    9 -
  testcases/kernel/containers/mqns/mqns_02.c |    8 +++-
  testcases/kernel/containers/mqns/mqns_03.c |    3 +--
  testcases/kernel/containers/mqns/mqns_04.c |    2 +-
  4 files changed, 9 insertions(+), 13 deletions(-)

 diff --git a/testcases/kernel/containers/mqns/mqns_01.c 
 b/testcases/kernel/containers/mqns/mqns_01.c
 index 7f41b2d..2f3bf8e 100644
 --- a/testcases/kernel/containers/mqns/mqns_01.c
 +++ b/testcases/kernel/containers/mqns/mqns_01.c
 @@ -55,7 +55,7 @@ int check_mqueue(void *vtest)

        if (read(p1[0], buf, strlen(go) + 1)  0)
                tst_resm(TBROK | TERRNO, read(p1[0], ...) failed);
 -       mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDONLY);
 +       mqd = mq_open(SLASH_MQ1, O_RDONLY);
        if (mqd == -1) {
                if (write(p2[1], notfnd, strlen(notfnd) + 1)  0)
                        tst_resm(TBROK | TERRNO, write(p2[1], ...) failed);
 @@ -86,8 +86,7 @@ main(int argc, char *argv[])
        if (pipe(p1) == -1) { perror(pipe); exit(EXIT_FAILURE); }
        if (pipe(p2) == -1) { perror(pipe); exit(EXIT_FAILURE); }

 -       mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777,
 -                       NULL);
 +       mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777, NULL);
        if (mqd == -1) {
                perror(mq_open);
                tst_resm(TFAIL, mq_open failed\n);
 @@ -100,7 +99,7 @@ main(int argc, char *argv[])
        if (r  0) {
                tst_resm(TFAIL, failed clone/unshare\n);
                mq_close(mqd);
 -               syscall(__NR_mq_unlink, SLASH_MQ1);
 +               mq_unlink(SLASH_MQ1);
                tst_exit();
        }

 @@ -122,7 +121,7 @@ main(int argc, char *argv[])

        /* destroy the mqueue */
        mq_close(mqd);
 -       syscall(__NR_mq_unlink, SLASH_MQ1);
 +       mq_unlink(SLASH_MQ1);

        tst_exit();
  }
 diff --git a/testcases/kernel/containers/mqns/mqns_02.c 
 b/testcases/kernel/containers/mqns/mqns_02.c
 index aa78f65..5343d5b 100644
 --- a/testcases/kernel/containers/mqns/mqns_02.c
 +++ b/testcases/kernel/containers/mqns/mqns_02.c
 @@ -60,8 +60,7 @@ int check_mqueue(void *vtest)
                tst_resm(TBROK | TERRNO, read(p1[0], ..) failed);
        else {

 -               mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL,
 -                               0777, NULL);
 +               mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777, NULL);
                if (mqd == -1) {
                        if (write(p2[1], mqfail, strlen(mqfail) + 1)  0) {
                                tst_resm(TBROK | TERRNO,
 @@ -85,8 +84,7 @@ int check_mqueue(void *vtest)
                                        if (mq_close(mqd)  0) {
                                                tst_resm(TBROK | TERRNO,
                                                        mq_close(mqd) 
 failed);
 -                                       } else if (syscall(__NR_mq_unlink,
 -                                                       SLASH_MQ1)  0) {
 +                                       } else if (mq_unlink(SLASH_MQ1)  0) {
                                                tst_resm(TBROK | TERRNO,
                                                        mq_unlink( SLASH_MQ1
                                                        ) failed);
 @@ -153,7 +151,7 @@ int main(int argc, char *argv[])
                tst_exit();
        } else {

 -               mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDONLY);
 +               mqd = mq_open(SLASH_MQ1, O_RDONLY);
                if (mqd == -1) {
                        tst_resm(TPASS, Parent process can't see the 
 mqueue\n);
                } else {
 diff --git a/testcases/kernel/containers/mqns/mqns_03.c 
 b/testcases/kernel/containers/mqns/mqns_03.c
 index 3c9e83e..6a841b8 100644
 --- a/testcases/kernel/containers/mqns/mqns_03.c
 +++ b/testcases/kernel/containers/mqns/mqns_03.c
 @@ -63,8 +63,7 @@ int check_mqueue(void *vtest)

        read(p1[0], buf, 3); /* go */

 -       mqd = syscall(__NR_mq_open, SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755,
 -                       NULL);
 +       mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755, NULL);
        if (mqd == -1) {
                write(p2[1], mqfail, 7);
                tst_exit();
 diff --git a/testcases/kernel/containers/mqns/mqns_04.c 
 b/testcases/kernel/containers/mqns/mqns_04.c
 index 8a4a9c2..6ce9e34 100644
 --- a/testcases/kernel/containers/mqns/mqns_04.c
 +++ b/testcases/kernel/containers/mqns/mqns_04.c
 @@ -59,7 +59,7 @@ int check_mqueue(void *vtest)