sendfile09: regression test for 64bit sendfile capped at 2G

There is a bug on 64bit sendfile() with large file, please see
https://lists.ozlabs.org/pipermail/linuxppc-dev/2014-June/118128.html
for details.

This sendfile09.c was copied from sendfile02.c and using plain
file as the out_file. The file size is 4G (4294967296 bytes).

The count cannot be larger than 2G, but the offset can. So the second
case tests with 3G offset and 1G count. Many thanks to Jan Stancek's
help.

Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
fs-bench: rename test*.sh scripts to fs-bench-test*.sh

Install name of these scripts is in conflict with testcases/lib/test.sh.
In problem Awais reported, he ended up with test.sh from fs-bench in
install directory, instead of shell script library he was expecting:
  install -m 00775 "/root/ltp/testcases/lib/test.sh" "/opt/ltp/testcases/bin/test.sh"
  ...
  install -m 00775 "/root/ltp/testcases/kernel/fs/fs-bench/test.sh" "/opt/ltp/testcases/bin/test.sh"

Reported-by: Awais Belal <Awais_Belal@mentor.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
syscalls: implemented a test for sched_setaffinity() error values

This test verifies sched_setaffinity(2) for all error conditions
to occur correctly.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
realtime: Add configure check for GNU exp10()

Closes #13

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
fs/ext4-new-features: fix wrong test point when running ext4-persist-prealloc

ext4-persist-prealloc test will call test cases under 'testcases/kernel/syscalls
/fallocate' to have persist prealloc test for ext4 filesystem. But currently
fallocate[0-3] cases will have tests in a different filesystem, which the directory
created by tst_tmpdir() is in. This is wrong, fix it.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
ffsb: configure.in: Update and add foreign

Update deprecated syntax

Add foreign (fixes autoreconf)

Reported-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
configure.ac: Add AC_CONFIG_MACRO_DIR

Otherwise macros in m4 directory are not found on autoreconf

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
configure: Fix aclocal include dir

This readds -I m4 to the aclocal parameters that was dropped by the
previous commit.

The problem is that AC_CONFIG_MACRO_DIR() macro in autoconf was broken
until recently, see:

http://lists.gnu.org/archive/html/autoconf/2013-08/msg00013.html

Reported-by: Vinson Lee <vlee@twopensource.com>
Reported-by: Joseph Beckenbach <jbeckenbach@lancope.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
remove meaningless TRETR flag

Flag TRETR was introduced to indicate test case was no longer valid and had
been "retired". But if you grep "TRETR" in LTP, you will not find any test
case using this flag. And if test case is no longer valid, we can just remove
it form LTP, so remove this flag.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
numa: fix old style def

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
max_map_count: unify filter_map logic a bit

This fixes running on ia64 systems.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Add autoconf test for CAN.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
can: cleanup

* Add can/Makefile

* can/filter-tests/Makefile cleanup:
  - Intall the files into the expect points.

* run_ltp-can_tests.sh cleanup:
  - Use TCID, TST_TOTAL and TST_COUNT.
  - Use test.sh that some functions required.
  - Use tst_require_root and tst_resm.
  - Add setup and cleanup function.

* tst-filter.c and tst-rcv-own-msgs.c:
  - Use "tst_res_flags.h" to correctly return the value.
  - Some cleanup.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Make can testes' name more saner

* Add can to scenario_groups/default.

* Add can_filter and can_rcv_own_msgs to network/.gitignore.

* Make the test's name more saner:
	tst-filter.c --> can_filter.c
	tst-rcv-own-msgs.c --> can_rcv_own_msgs.c
	run_ltp-can_tests.sh --> can_run_tests.sh

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
lib/tst_res.c: make tst_brkm() and tst_resm() output more informative message

If testcase calls tst_brkm(...) to terminate test, usually we need
to serch the message outputted by tst_brkm() to locate it in test
program, it is inefficient, especially we have multiple same messages,
so here we choose to make tst_brkm output extra information about
source files and line number. Also make similar change to tst_resm().

E.g.:
We execute getxattr01 before this patch:
[root@localhost getxattr]# ./getxattr01
getxattr01    1  TCONF  :  No xattr support in fs or mount without user_xattr option
getxattr01    2  TCONF  :  Remaining cases not appropriate for configuration

After this patch:
[root@localhost getxattr]# ./getxattr01
getxattr01    1  TCONF  :  getxattr01.c:158: No xattr support in fs or mount without user_xattr option
getxattr01    2  TCONF  :  Remaining cases not appropriate for configuration

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
mmap15: raise high address to 2^53

Address space on s390x can go atm. as high as 2^53,
so raise high address used in this test to this level.

Signed-off-by: Li Wang <wangli.ahau@gmail.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Caspar Zhang <caspar@casparzhang.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
file_test: make also "linux" a valid match

The output of file for vmlinu* varies based on architecture
and presumably also its own version. Make this testcase
more tolarant by matching also "linux". This fixes testcase
on s390 for at least file-5.11 up to file-5.19.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
sched_setaffinity01: use ltp_syscall

Using glibc wrapper on kernel with smaller CONFIG_NR_CPUS (for example
255) leads to segmentation fault in glibc, because it triggers check,
which is verifying that there are no bits set beyond size of kernel cpu
mask:

int
__sched_setaffinity_new (pid_t pid, size_t cpusetsize, const cpu_set_t *cpuset)
  ...
  /* We now know the size of the kernel cpumask_t.  Make sure the user
     does not request to set a bit beyond that.  */
  for (size_t cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
    if (((char *) cpuset)[cnt] != '\0') --> CRASH HERE

Call this syscall directly with ltp_syscall().

Reported-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Acked-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
containers: added pidns/pidns03.c

* Clones a new child process with CLONE_NEWPID flag - the new child
* process mounts procfs to a "proc" directory and checks if it belongs
* to a new pid namespace by:
* 1. reading value of "proc/self", which is symlink
*    to directory named after current pid number
* 2. comparing read value (PID) with "1"

Signed-off-by: Matus Marhefka <mmarhefk@redhat.com>
Signed-off-by: Jiri Jaburek <jjaburek@redhat.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
lib/tst_res.c: introduce tst_record_childstatus()

In case we need do real test work in child process parent process can
use tst_record_childstatus() to make child process's test results
propagated to parent process correctly.

The child can use tst_resm(), tst_brkm() followed by the tst_exit() or
plain old exit() (with TPASS, TFAIL and TBROK).

WARNING: Be wary that the child cleanup function passed to tst_brkm()
         must clean only resources the child has allocated. E.g. the
         child cleanup is different function from the parent cleanup.

This commit also changes tst_fork() to reset the stored result value
(T_exitval in the sources) which is not strictly needed but it's cleaner
and will ease debugging.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>