[LTP] [PATCH v2] controllers/cpuacct: add cpuacct tests to default and somecleanup

2014-05-29 Thread Zeng Linggang
* Change the entry like:
cpuacct01 run_cpuacct_test.sh 1
cpuacct02 run_cpuacct_test.sh 2

* Add cpuacct tests to scenario_groups/default

* Add umount_cpuacct_mounted function for umount cpuacct mounted

* Make use of tst_require_root, exists and tst_resm

* Some cleanup

Signed-off-by: Zeng Linggang 
---
 runtest/cpuacct|   4 +-
 scenario_groups/default|   1 +
 .../kernel/controllers/cpuacct/cpuacct_setup.sh|  37 +-
 .../kernel/controllers/cpuacct/run_cpuacct_test.sh | 376 +
 4 files changed, 191 insertions(+), 227 deletions(-)

diff --git a/runtest/cpuacct b/runtest/cpuacct
index 34354de..11279f9 100644
--- a/runtest/cpuacct
+++ b/runtest/cpuacct
@@ -1,2 +1,2 @@
-CPUACCT01 $LTPROOT/testcases/bin/run_cpuacct_test.sh 1
-CPUACCT02 $LTPROOT/testcases/bin/run_cpuacct_test.sh 2
+cpuacct01 run_cpuacct_test.sh 1
+cpuacct02 run_cpuacct_test.sh 2
diff --git a/scenario_groups/default b/scenario_groups/default
index bf7ab79..2f9acbe 100644
--- a/scenario_groups/default
+++ b/scenario_groups/default
@@ -28,3 +28,4 @@ kernel_misc
 modules
 fs_ext4
 pipes
+cpuacct
diff --git a/testcases/kernel/controllers/cpuacct/cpuacct_setup.sh 
b/testcases/kernel/controllers/cpuacct/cpuacct_setup.sh
index fb58d1d..6eab1b4 100755
--- a/testcases/kernel/controllers/cpuacct/cpuacct_setup.sh
+++ b/testcases/kernel/controllers/cpuacct/cpuacct_setup.sh
@@ -15,8 +15,8 @@
 #  the GNU General Public License for more details.
#
 #  
#
 #  You should have received a copy of the GNU General Public License   
#
-#  along with this program;  if not, write to the Free Software
#
-#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA #
+#  along with this program;  if not, write to the Free Software Foundation,
#
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
 #  
#
 

 

@@ -45,18 +45,29 @@
 #  
#
 

 
+# umount cpuacct if it has been mounted.
+umount_cpuacct_mounted()
+{
+   dir=`cat /proc/mounts | grep cpuacct | awk '{print $2}'`
+   if [ -n "$dir" ]; then
+   umount "$dir" 2> /dev/null
+   fi
+}
+
 # The cleanup function
-cleanup ()
+cleanup()
 {
echo "Cleanup called"
rm -rf txt*
rmdir /dev/cpuacct/group*/group* 2> /dev/null
rmdir /dev/cpuacct/group* 2> /dev/null
umount /dev/cpuacct/ 2> /dev/null
+   umount_cpuacct_mounted
rmdir /dev/cpuacct 2> /dev/null
rm -rf tmp2 2> /dev/null
 }
-task_kill ()
+
+task_kill()
 {
for i in `ps -e | grep cpuacct_task | awk '{print $1}'`
do
@@ -70,33 +81,31 @@ task_kill ()
 
 #clean any group created eralier (if any)
 
-setup ()
+setup()
 {
-   if [ -e /dev/cpuacct ]
-   then
+   if [ -e /dev/cpuacct ]; then
echo "WARN:/dev/cpuacct already exist..overwriting"
rmdir /dev/cpuacct/group*/group* 2> /dev/null
-   rmdir /dev/cpuacct/group* 2> /dev/null
+   rmdir /dev/cpuacct/group* 2> /dev/null
umount /dev/cpuacct/ 2> /dev/null
-   rmdir /dev/cpuacct 2> /dev/null
-
+   rmdir /dev/cpuacct 2> /dev/null
mkdir /dev/cpuacct
else
mkdir /dev/cpuacct
fi
+   umount_cpuacct_mounted
mount -t cgroup -ocpuacct none /dev/cpuacct 2> /dev/null
if [ $? -ne 0 ]
then
echo "TFAIL: Could not mount cgroup filesystem"
echo "Exiting test"
cleanup
-   exit -1
+   exit 1
fi
 
# Group created earlier may again be visible if not cleaned properly.
#so clean them
-   if [ -e /dev/cpuacct/group_1 ]
-   then
+   if [ -e /dev/cpuacct/group_1 ]; then
rmdir /dev/cpuacct/group*/group* 2> /dev/null
rmdir /dev/cpuacct/group* 2> /dev/null
echo "WARN: Earlier groups found and removed...";
@@ -108,6 +117,6 @@ setup ()
 usage()
 {
echo "Could not start cpu account controller test";
-   echo "usage: run_cpuacct_test.sh $TEST_NUM ";
+   echo "usage: run_cpuacct_test.sh ";
echo "Skipping the cpu account controller test...";
 }
diff --git a/testcases/kernel/controllers/cpuacct/run_cpuacct_test.sh 
b/testcases/kernel/controllers/cpuacct/run_cpuacct_test.sh
index 4c4d951..88425f8 100755
--- a/testcases/kernel/controllers/cpuacct/r

[LTP] [PATCH v2] kernel/syscalls: fix wrong fork_flag passed to tst_sig()

2014-05-29 Thread Xiaoguang Wang
Many test cases pass FORK flag to tst_sig() though they do not do
fork() at all, fix these.
---
 testcases/kernel/syscalls/access/access01.c | 2 +-
 testcases/kernel/syscalls/asyncio/asyncio02.c   | 2 +-
 testcases/kernel/syscalls/chmod/chmod06.c   | 2 +-
 testcases/kernel/syscalls/chmod/chmod07.c   | 2 +-
 testcases/kernel/syscalls/chown/chown03.c   | 2 +-
 testcases/kernel/syscalls/chown/chown04.c   | 2 +-
 testcases/kernel/syscalls/close/close01.c   | 2 +-
 testcases/kernel/syscalls/close/close02.c   | 2 +-
 testcases/kernel/syscalls/dup/dup01.c   | 2 +-
 testcases/kernel/syscalls/dup/dup02.c   | 2 +-
 testcases/kernel/syscalls/dup/dup03.c   | 2 +-
 testcases/kernel/syscalls/dup/dup04.c   | 2 +-
 testcases/kernel/syscalls/dup/dup05.c   | 2 +-
 testcases/kernel/syscalls/dup2/dup204.c | 2 +-
 testcases/kernel/syscalls/fchmod/fchmod02.c | 2 +-
 testcases/kernel/syscalls/fchmod/fchmod05.c | 2 +-
 testcases/kernel/syscalls/fchmod/fchmod06.c | 2 +-
 testcases/kernel/syscalls/fchown/fchown01.c | 2 +-
 testcases/kernel/syscalls/fchown/fchown03.c | 2 +-
 testcases/kernel/syscalls/fcntl/fcntl01.c   | 2 +-
 testcases/kernel/syscalls/fcntl/fcntl06.c   | 2 +-
 testcases/kernel/syscalls/flock/flock02.c   | 2 +-
 testcases/kernel/syscalls/fpathconf/fpathconf01.c   | 2 +-
 testcases/kernel/syscalls/getgroups/getgroups01.c   | 2 +-
 testcases/kernel/syscalls/lchown/lchown02.c | 2 +-
 testcases/kernel/syscalls/lstat/lstat01.c   | 2 +-
 testcases/kernel/syscalls/mkdir/mkdir05.c   | 2 +-
 testcases/kernel/syscalls/mlock/mlock03.c   | 2 +-
 testcases/kernel/syscalls/mlockall/mlockall02.c | 2 +-
 testcases/kernel/syscalls/mlockall/mlockall03.c | 2 +-
 testcases/kernel/syscalls/mmap/mmap001.c| 2 +-
 testcases/kernel/syscalls/mmap/mmap02.c | 2 +-
 testcases/kernel/syscalls/mmap/mmap11.c | 2 +-
 testcases/kernel/syscalls/mmap/mmap12.c | 2 +-
 testcases/kernel/syscalls/mmap/mmap14.c | 2 +-
 testcases/kernel/syscalls/modify_ldt/modify_ldt01.c | 2 +-
 testcases/kernel/syscalls/mount/mount02.c   | 2 +-
 testcases/kernel/syscalls/mount/mount04.c   | 2 +-
 testcases/kernel/syscalls/mprotect/mprotect01.c | 2 +-
 testcases/kernel/syscalls/mremap/mremap02.c | 2 +-
 testcases/kernel/syscalls/mremap/mremap03.c | 2 +-
 testcases/kernel/syscalls/mremap/mremap04.c | 2 +-
 testcases/kernel/syscalls/munlock/munlock02.c   | 2 +-
 testcases/kernel/syscalls/pipe/pipe07.c | 2 +-
 testcases/kernel/syscalls/pread/pread01.c   | 2 +-
 testcases/kernel/syscalls/pread/pread02.c   | 2 +-
 testcases/kernel/syscalls/pread/pread03.c   | 2 +-
 testcases/kernel/syscalls/remap_file_pages/remap_file_pages01.c | 2 +-
 testcases/kernel/syscalls/remap_file_pages/remap_file_pages02.c | 2 +-
 testcases/kernel/syscalls/rmdir/rmdir05.c   | 2 +-
 testcases/kernel/syscalls/select/select01.c | 2 +-
 testcases/kernel/syscalls/select/select02.c | 2 +-
 testcases/kernel/syscalls/select/select03.c | 2 +-
 testcases/kernel/syscalls/setregid/setregid02.c | 2 +-
 testcases/kernel/syscalls/setregid/setregid04.c | 2 +-
 testcases/kernel/syscalls/setreuid/setreuid02.c | 2 +-
 testcases/kernel/syscalls/setreuid/setreuid03.c | 2 +-
 testcases/kernel/syscalls/setreuid/setreuid06.c | 2 +-
 testcases/kernel/syscalls/setrlimit/setrlimit03.c   | 2 +-
 testcases/kernel/syscalls/setuid/setuid03.c | 2 +-
 testcases/kernel/syscalls/sigaltstack/sigaltstack01.c   | 2 +-
 testcases/kernel/syscalls/sigaltstack/sigaltstack02.c   | 2 +-
 testcases/kernel/syscalls/sigprocmask/sigprocmask01.c   | 2 +-
 testcases/kernel/syscalls/sigsuspend/sigsuspend01.c | 2 +-
 testcases/kernel/syscalls/sigwaitinfo/sigwaitinfo01.c   | 2 +-
 testcases/kernel/syscalls/swapoff/swapoff01.c   | 2 +-
 testcases/kernel/syscalls/swapoff/swapoff02.c   | 2 +-
 testcases/kernel/syscalls/swapon/swapon01.c | 2 +-
 testca

Re: [LTP] Need help in cross compiling LTP for android

2014-05-29 Thread meena

Thanks,
Cyril Hrubis  writes:

> 
> Hi!
> > +
> /u/ltp/android-ndk-r7b/toolchains/arm-linux-androideabi-
4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc
> -march=armv7-a -mtune=xscale -msoft-float -fpic -mthumb-interwork -
ffunction-sections
> -funwind-tables -fstack-protector -fno-short-enums -O2 -fomit-frame-
pointer -funswitch-loops
> -finline-limit=300 -g -O2 -fno-strict-aliasing -pipe -Wall
> -I/u/ltp/android-ndk-r7b/platforms/android-14/arch-arm/usr/include -
D__ARM_ARCH_7__
> -D__ARM_ARCH_7A__ -D__ARM_ARCH_7R__ -D__ARM_ARCH_7M__ -DANDROID -
D__linux__ -DDEV_BSIZE=512
> -DSIGCLD=SIGCHLD -D_FILE_OFFSET_BITS=64 -I/u/ltp/ltp-full-
20120104/testcases/kernel/include
> -D_GNU_SOURCE -I/u/ltp/ltp-full-
20120104/testcases/kernel/timers/clock_gettime/../include
> -I../../../../include -I../../../../include -nostdlib -Bdynamic -Wl,-
dynamic-linker,/syst
>  em/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc
> -L/u/ltp/android-ndk-r7b/platforms/android-14/arch-arm/usr/lib -
L../../../../lib
> clock_gettime02.c /u/ltp/android-ndk-r7b/platforms/android-1
> >  4/arch-arm/usr/lib/crtbegin_dynamic.o
> -Wl,-rpath-link=/u/ltp/android-ndk-r7b/platforms/android-14/arch-
arm/usr/lib
> /u/ltp/android-ndk-r7b/toolchains/arm-linux-androideabi-
4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
> -lc /u/ltp/android-ndk-r7b/platforms/android-14/arch-
arm/usr/lib/crtend_android.o
> -L/u/ltp/android-ndk-r7b/platforms/android-14/arch-arm/usr/lib -lltp -o 
clock_gettime02
> > ../../../../lib/libltp.a(parse_opts.o): In function `usc_test_looping':
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:716: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:725: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:734: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:735: undefined reference to 
`__aeabi_i2f'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:735: undefined reference to 
`__aeabi_fmul'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:735: undefined reference to 
`__aeabi_f2iz'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:746: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:772: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:716: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:727: undefined reference to 
`__aeabi_fmul'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:727: undefined reference to 
`__aeabi_f2iz'
> > ../../../../lib/libltp.a(parse_opts.o): In function `parse_opts':
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:289: undefined reference to 
`__aeabi_d2f'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:293: undefined reference to 
`__aeabi_d2f'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:294: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:438: undefined reference to 
`__aeabi_fcmpge'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:441: undefined reference to 
`__aeabi_f2d'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:421: undefined reference to 
`__aeabi_fcmpge'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:425: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:408: undefined reference to 
`__aeabi_fcmpge'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:413: undefined reference to 
`__aeabi_fcmpeq'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:424: undefined reference to 
`__aeabi_f2d'
> > /u/ltp/ltp-full-20120104/lib/parse_opts.c:411: undefined reference to 
`__aeabi_f2d'
> > collect2: ld returned 1 exit status
> 
> That suggets that the linker wasn't been able to pick up symbols from
> libgcc.a, possibly because linker flags and static libraries are passed
> to it in the wrong order.
> 
Hi,

I am able to cross compile for android but not able to execute it on android 
platform.
I if execute any of the binaries i am getting " no such file or directory"
I checked that the issue with dynamic linker :


readelf --program

Elf file type is EXEC (Executable file)
Entry point 0x87e8
There are 8 program headers, starting at offset 52

Program Headers:
  Type   Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX  0x000a7c 0x8a7c 0x8a7c 0x00048 0x00048 R   0x4
  PHDR   0x34 0x8034 0x8034 0x00100 0x00100 R E 0x4
  INTERP 0x000134 0x8134 0x8134 0x00013 0x00013 R   0x1
  [Requesting program interpreter: /lib/ld-linux.so.3]
  LOAD   0x00 0x8000 0x8000 0x00ac8 0x00ac8 R E 0x8000
  LOAD   0x000ac8 0x00010ac8 0x00010ac8 0x00148 0x00158 RW  0x8000
  DYNAMIC0x000ad4 0x00010ad4 0x00010ad4 0x000f0 0x000f0 RW  0x4
  NOTE   0x000148 0x8148 0x8148 0x00020 0x00020 R   0x4
  GNU_STACK  0x00 0x 0x 0x0 0x0 RW  0x10

Its taking default linker file as /lib/ld-linux,

Re: [LTP] [PATCH 2/2-updated] syscalls/fstatfs02: Using temporary file description to test the syscall

2014-05-29 Thread chrubis
Hi!
> > It does not make sense to use stdout as the file description to test the
> > system call fstatfs().We may get unexpected result(i.e.
> > errno=38:Function not implemented) if redirect stdout when running ltp.
> > Using ltp temporary file instead.
> >
> > Signed-off-by: Shuang Qiu 
> 
> The problem is that with the 2.6.39 series of kernels ENOSYS is returned 
> where EFAULT is expected.
> 
> The reproducer:
> #include 
> #include 
> #include 
> #include 
> 
> int main(void)
> {
>int fds[2];
> 
>if (pipe(fds) < 0) {
>  perror("pipe() failed");
>  return 1;
>}
> 
>if (fstatfs(fds[1], (void *)-1) < 0) {
>  perror("fstatfs() failed");
>  return 1;
>}
> 
>return 0;
> }
> 
> With 2.6.18, 2.6.32, 3.8.13 this reproducer returns EFAULT,
> but with 2.6.39 - ENOSYS.
> 
> If we change '(void *)-1' to a vaild pointer, fstatfs() + 2.6.39 will 
> succeed.
> 
> So it's a bug in 2.6.39, which is fixed in modern kernels.

I've looked at fstatfs() and pipe() code in recent kernel.

The fstatfs() looks at dentry and if there is no statfs callback it
returns ENOSYS, otherwise it uses the callback to fill the buffer.

The pipe() mounts an "pipe:" kernel internal pseudo fs and uses
simple_statfs() for the statfs() callback. So statfs() works fine on
recent kernels. In 2.6.39 the pipefs_ops structure simply misses the
fstatfs() callback, it has been introduced in:

commit d70ef97baf048412c395bb5d65791d8fe133a52b
Author: Pavel Emelyanov 
Date:   Mon Oct 31 17:10:04 2011 -0700

fs/pipe.c: add ->statfs callback for pipefs

I guess that we can add a test for fstatfs() on a pipe if kernel version
is newer than 3.2.

>  From one side, the above patch makes fstatfs02 pass by hiding an old 
> (and already fixed) kernel bug.
> 
> But from the other side, it also enlarges the test scope by allowing to 
> test different file systems.
> 
> So, personally, I would accept it.
> 
> Are there any thoughts about it?

I'm for fixing the testcase this way. If nothing else it makes it the
test actually test what it's expected to test.

Just cleanup the patch a bit before applying (use SAFE_OPEN(), etc).

-- 
Cyril Hrubis
chru...@suse.cz

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] ltp for android

2014-05-29 Thread Asha Gowda
Hi ,
I am able to cross compile for android but not able to execute it on
android platform.
I if execute any of the binaries i am getting " no such file or directory"
I checked that the issue with dynamic linker :


readelf --program

Elf file type is EXEC (Executable file)
Entry point 0x87e8
There are 8 program headers, starting at offset 52

Program Headers:
  Type   Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  EXIDX  0x000a7c 0x8a7c 0x8a7c 0x00048 0x00048 R   0x4
  PHDR   0x34 0x8034 0x8034 0x00100 0x00100 R E 0x4
  INTERP 0x000134 0x8134 0x8134 0x00013 0x00013 R   0x1
  [Requesting program interpreter: /lib/ld-linux.so.3]
  LOAD   0x00 0x8000 0x8000 0x00ac8 0x00ac8 R E 0x8000
  LOAD   0x000ac8 0x00010ac8 0x00010ac8 0x00148 0x00158 RW  0x8000
  DYNAMIC0x000ad4 0x00010ad4 0x00010ad4 0x000f0 0x000f0 RW  0x4
  NOTE   0x000148 0x8148 0x8148 0x00020 0x00020 R   0x4
  GNU_STACK  0x00 0x 0x 0x0 0x0 RW  0x10

Its taking default linker file as /lib/ld-linux, it should be
/system/bin/linker for android i guess.
Can someone suggest me hoe to change this.

Thanks,
--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] [PATCH v3] partrt_nohz_full: Introducing a new test case

2014-05-29 Thread chrubis
Hi!
> Ping?

Sorry it takes that long, you are in the queue, I should get to the
patch either today, the worstcase should be on Monday.

-- 
Cyril Hrubis
chru...@suse.cz

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] [PATCH] setpriority/setpriority01.c: cleanup

2014-05-29 Thread chrubis
Hi!
> * Delete some useless commtents.
> * Move the test body from main() to setpriority_verify().
> * Expand tests([-20,19]).
> * Add tst_require_root for lowering priorities testes.
> * Some cleanup.
> 
> Signed-off-by: Zeng Linggang 

Pushed, thanks.

-- 
Cyril Hrubis
chru...@suse.cz

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] Sendfile01 : mc_gethost argument

2014-05-29 Thread chrubis
Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chru...@suse.cz

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] Reg: sendfile01_server

2014-05-29 Thread chrubis
Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chru...@suse.cz

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


Re: [LTP] [PATCH v3] direct_io/dma_thread_diotest7.c: cleanup and add it to run default

2014-05-29 Thread chrubis
Hi!
> This test will create 100 files(every is 12MB), so the total needed free 
> space is
> 1200MB at least. If the current test temporary directory do not satisfy this
> requirement, wo need to specify a big block device by running runltp with -z 
> option.
> If satisfied, we also need to check whether filesystem, which current test 
> temporary
> directory is in, supports the O_DIRECT flag. If not supported, we will also 
> need to
> have tests in a big block device specified by users.
> 
> Rename runtest/test_dma_thread_diotest7 to runtest/dma_thread_diotest and
> split tests in runtest/dma_thread_diotest into separate testcases, keep one 
> entry
> per test in runtest/dma_thread_diotest. And remove 
> test_dma_thread_diotest7.sh,
> which is useless now.

I've simplified the file creation a bit, changed the worker thread to
exit on first corruption (like the previous code did) and pushed,
thanks. See the full diff bellow.

The tests fail for me for non-zero aligment on ext4, both original and
update version fails the same. So there is either bug in ext4 or in the
test.


diff --git a/testcases/kernel/io/direct_io/dma_thread_diotest7.c 
b/testcases/kernel/io/direct_io/dma_thread_diotest7.c
index 77e67a2..73a10ec 100644
--- a/testcases/kernel/io/direct_io/dma_thread_diotest7.c
+++ b/testcases/kernel/io/direct_io/dma_thread_diotest7.c
@@ -111,6 +111,7 @@
 #define READSIZE   (1024*1024)
 
 #define MNT_POINT  "mntpoint"
+#define FILE_BASEPATH   MNT_POINT "/_dma_thread_test_%.04d.tmp"
 #define DIR_MODE   (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \
 S_IXGRP|S_IROTH|S_IXOTH)
 #define FILECOUNT  100
@@ -128,7 +129,6 @@ static void cleanup(void);
 static void help(void);
 
 static unsigned char *buffer;
-static char basefilename[128];
 
 static char *align_str;
 static int align;
@@ -197,6 +197,7 @@ static void *worker_thread(void *arg)
 
printf("\n");
tst_result = 1;
+   return NULL;
}
}
 
@@ -207,6 +208,8 @@ static void *fork_thread(void *arg)
 {
pid_t pid;
 
+   (void) arg;
+
while (!done) {
pid = tst_fork();
if (pid == 0) {
@@ -226,7 +229,7 @@ static void *fork_thread(void *arg)
 int main(int argc, char *argv[])
 {
int i, lc;
-   char *msg;
+   const char *msg;
 
workers = sysconf(_SC_NPROCESSORS_ONLN);
msg = parse_opts(argc, argv, options, help);
@@ -256,7 +259,7 @@ static void dma_thread_diotest_verify(void)
tst_result = 0;
 
for (n = 1; n <= FILECOUNT; n++) {
-   sprintf(filename, basefilename, n);
+   snprintf(filename, sizeof(filename), FILE_BASEPATH, n);
for (j = 0; j < workers; j++) {
worker[j].fd = SAFE_OPEN(cleanup, filename,
 O_RDONLY | O_DIRECT);
@@ -385,6 +388,8 @@ static void setup(void)
SAFE_CLOSE(NULL, fd);
}
 
+   SAFE_MKDIR(cleanup, MNT_POINT, DIR_MODE);
+
/*
 * verify whether the current directory has enough free space,
 * if it is not satisfied, we will use the LTP_BIG_DEV, which
@@ -399,15 +404,11 @@ static void setup(void)
tst_mkfs(NULL, device, "ext3", NULL);
}
 
-   SAFE_MKDIR(cleanup, MNT_POINT, DIR_MODE);
if (mount(device, MNT_POINT, "ext3", 0, NULL) < 0) {
tst_brkm(TBROK | TERRNO, NULL,
 "mount device:%s failed", device);
}
mount_flag = 1;
-   strcpy(basefilename, "mntpoint/_dma_thread_test_%.04d.tmp");
-   } else {
-   strcpy(basefilename, "_dma_thread_test_%.04d.tmp");
}
 
worker = SAFE_MALLOC(cleanup, workers * sizeof(worker_t));
@@ -416,7 +417,7 @@ static void setup(void)
worker[j].worker_number = j;
 
for (n = 1; n <= FILECOUNT; n++) {
-   sprintf(filename, basefilename, n);
+   snprintf(filename, sizeof(filename), FILE_BASEPATH, n);
 
if (tst_fill_file(filename, n, FILESIZE, 1)) {
tst_brkm(TBROK, cleanup, "failed to create file: %s",

-- 
Cyril Hrubis
chru...@suse.cz

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] [PATCH 1/2] statvfs/statvfs01.c: cleanup

2014-05-29 Thread Zeng Linggang
* Delete some useless commtents.

* Some cleanup.

Signed-off-by: Zeng Linggang 
---
 testcases/kernel/syscalls/statvfs/statvfs01.c | 49 +++
 1 file changed, 12 insertions(+), 37 deletions(-)

diff --git a/testcases/kernel/syscalls/statvfs/statvfs01.c 
b/testcases/kernel/syscalls/statvfs/statvfs01.c
index 306ca00..0ea882a 100644
--- a/testcases/kernel/syscalls/statvfs/statvfs01.c
+++ b/testcases/kernel/syscalls/statvfs/statvfs01.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) Wipro Technologies Ltd, 2005.  All Rights Reserved.
+ *AUTHOR: Prashant P Yendigeri 
  *
  * 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
@@ -14,25 +15,12 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
  */
-/**
- *
- *TEST IDENTIFIER   : statvfs01
- *
- *EXECUTED BY   : root / superuser
- *
- *TEST TITLE: Basic tests for statvfs(2)
- *
- *TEST CASE TOTAL   : 1
- *
- *AUTHOR: Prashant P Yendigeri
- *
- *
+/*
  *DESCRIPTION
  *  This is a Phase I test for the statvfs(2) system call.
  *  It is intended to provide a limited exposure of the system call.
  * This call behaves similar to statfs.
- *
- **/
+ */
 
 #include 
 #include 
@@ -43,15 +31,15 @@
 #include "test.h"
 #include "usctest.h"
 
-#define TEST_PATH "/"  /* Should be a mounted FS */
+#define TEST_PATH "/"
 
-void setup();
-void cleanup();
+static void setup(void);
+static void cleanup(void);
 
 char *TCID = "statvfs01";
 int TST_TOTAL = 1;
 
-int exp_enos[] = { 0 };/* must be a 0 terminated list */
+int exp_enos[] = { 0 };
 
 int main(int ac, char **av)
 {
@@ -64,7 +52,6 @@ int main(int ac, char **av)
 
setup();
 
-   /* set the expected errnos... */
TEST_EXP_ENOS(exp_enos);
 
for (lc = 0; TEST_LOOPING(lc); lc++) {
@@ -73,11 +60,12 @@ int main(int ac, char **av)
 
TEST(statvfs(TEST_PATH, &buf));
 
-   if (TEST_RETURN == -1)
+   if (TEST_RETURN == -1) {
tst_resm(TFAIL | TERRNO, "statvfs(%s, ...) failed",
 TEST_PATH);
-   else
+   } else {
tst_resm(TPASS, "statvfs(%s, ...) passed", TEST_PATH);
+   }
 
}
 
@@ -96,30 +84,17 @@ int main(int ac, char **av)
tst_resm(TINFO, "file system max filename length = %lu", buf.f_namemax);
 
cleanup();
-
tst_exit();
 }
 
-/***
- * setup() - performs all ONE TIME setup for this test.
- ***/
-void setup(void)
+static void setup(void)
 {
-
tst_sig(NOFORK, DEF_HANDLER, cleanup);
 
TEST_PAUSE;
 }
 
-/***
- * cleanup() - performs all ONE TIME cleanup for this test at
- *  completion or premature exit.
- ***/
-void cleanup(void)
+static void cleanup(void)
 {
-   /*
-* print timing stats if that option was specified.
-* print errno log if that option was specified.
-*/
TEST_CLEANUP;
 }
-- 
1.8.4.2




--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[LTP] [PATCH 2/2] statvfs/statvfs02.c: add new errno testes

2014-05-29 Thread Zeng Linggang
* Add new errno testes for statvfs(2)
  - EFAULT
  - ELOOP
  - ENAMETOOLONG
  - ENOENT
  - ENOTDIR

Signed-off-by: Zeng Linggang 
---
 runtest/ltplite   |   1 +
 runtest/stress.part3  |   1 +
 runtest/syscalls  |   1 +
 testcases/kernel/syscalls/.gitignore  |   1 +
 testcases/kernel/syscalls/statvfs/statvfs02.c | 124 ++
 5 files changed, 128 insertions(+)
 create mode 100644 testcases/kernel/syscalls/statvfs/statvfs02.c

diff --git a/runtest/ltplite b/runtest/ltplite
index 11b6ffc..d71f137 100644
--- a/runtest/ltplite
+++ b/runtest/ltplite
@@ -867,6 +867,7 @@ statfs02 statfs02
 statfs03 statfs03
 
 statvfs01 statvfs01
+statvfs02 statvfs02
 
 # This syscall is obsoleted by settimeofday.
 #stime01 stime01
diff --git a/runtest/stress.part3 b/runtest/stress.part3
index ed877b0..bc71013 100644
--- a/runtest/stress.part3
+++ b/runtest/stress.part3
@@ -773,6 +773,7 @@ statfs02 statfs02
 statfs03 statfs03
 
 statvfs01 statvfs01
+statvfs02 statvfs02
 
 # This syscall is obsoleted by settimeofday.
 #stime01 stime01
diff --git a/runtest/syscalls b/runtest/syscalls
index 9207356..cb8ff4f 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1176,6 +1176,7 @@ statfs03 statfs03
 statfs03_64 statfs03_64
 
 statvfs01 statvfs01
+statvfs02 statvfs02
 
 stime01 stime01
 stime02 stime02
diff --git a/testcases/kernel/syscalls/.gitignore 
b/testcases/kernel/syscalls/.gitignore
index 61c836c..d3939cd 100644
--- a/testcases/kernel/syscalls/.gitignore
+++ b/testcases/kernel/syscalls/.gitignore
@@ -918,6 +918,7 @@
 /statfs/statfs03
 /statfs/statfs03_64
 /statvfs/statvfs01
+/statvfs/statvfs02
 /stime/stime01
 /stime/stime02
 /string/string01
diff --git a/testcases/kernel/syscalls/statvfs/statvfs02.c 
b/testcases/kernel/syscalls/statvfs/statvfs02.c
new file mode 100644
index 000..adf08f3
--- /dev/null
+++ b/testcases/kernel/syscalls/statvfs/statvfs02.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014 Fujitsu Ltd.
+ * Author: Zeng Linggang 
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+/*
+ * Test Description:
+ *  Verify that,
+ *   1. path is NULL, EFAULT would return.
+ *   2. Too many symbolic links were encountered in translating path,
+ * ELOOP would return.
+ *   3. path is too long, ENAMETOOLONG would return.
+ *   4. The file referred to by path does not exist, ENOENT would return.
+ *   5. A component of the path prefix of path is not a directory,
+ * ENOENT would return.
+ */
+
+#include 
+#include 
+
+#include "test.h"
+#include "usctest.h"
+#include "safe_macros.h"
+
+#define TEST_SYMLINK   "statvfs_symlink"
+#define TEST_FILE  "statvfs_file"
+
+char *TCID = "statvfs02";
+
+static struct statvfs buf;
+static char nametoolong[PATH_MAX+2];
+static void setup(void);
+static void cleanup(void);
+
+static struct test_case_t {
+   char *path;
+   struct statvfs *buf;
+   int exp_errno;
+} test_cases[] = {
+   {NULL, &buf, EFAULT},
+   {TEST_SYMLINK, &buf, ELOOP},
+   {nametoolong, &buf, ENAMETOOLONG},
+   {"filenoexist", &buf, ENOENT},
+   {"statvfs_file/test", &buf, ENOTDIR},
+};
+
+int TST_TOTAL = ARRAY_SIZE(test_cases);
+static int exp_enos[] = { EFAULT, ELOOP, ENAMETOOLONG, ENOENT, ENOTDIR, 0 };
+static void statvfs_verify(const struct test_case_t *);
+
+int main(int argc, char **argv)
+{
+   int i, lc;
+   const char *msg;
+
+   msg = parse_opts(argc, argv, NULL, NULL);
+   if (msg != NULL)
+   tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+   setup();
+
+   for (lc = 0; TEST_LOOPING(lc); lc++) {
+   tst_count = 0;
+   for (i = 0; i < TST_TOTAL; i++)
+   statvfs_verify(&test_cases[i]);
+   }
+
+   cleanup();
+   tst_exit();
+}
+
+static void setup(void)
+{
+   tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+   TEST_EXP_ENOS(exp_enos);
+
+   TEST_PAUSE;
+
+   tst_tmpdir();
+
+   SAFE_SYMLINK(cleanup, TEST_SYMLINK, "statfs_symlink_2");
+   SAFE_SYMLINK(cleanup, "statfs_symlink_2", TEST_SYMLINK);
+
+   memset(nametoolong, 'a', PATH_MAX+1);
+
+   SAFE_TOUCH(cleanup, TEST_FILE, 0644, NULL);
+}
+
+static void statvfs_verify(const struct test_case_t *test)
+{
+   TEST(statvfs(test->path, test->buf));
+
+   if (TEST_RETURN != -1) {
+   tst_resm(TFAIL, "statvfs() succ