aboutsummaryrefslogtreecommitdiff
path: root/testcases/kernel
AgeCommit message (Collapse)Author
2019-04-09syscalls/stat03, 06: Cleanup && Convert to new APIYang Xu
1) Take use of some safe macros 2) Remove duplicate tests stat06 3) Add ELOOP check 4) Remove useless struct member Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-04-09syscalls/stat01, 02, 05: Cleanup && Convert to new APIYang Xu
1) Take use of some safe macros 2) Remove duplicate tests stat02,stat05 Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2019-04-08syscalls/sigpending02.c: Add libc sigpending() detection && reset ↵Xiao Yang
sighandler_counter 1) bionic(Android libc) doesn't implement libc sigpending() currently, so we can skip it on Android by the detection. Also add break to avoid potential compiler warnings. 2) Fix sigpending02 -i n by resetting sighandler_counter variable. Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
2019-04-08syscalls/stime: Add libc stime() detectionXiao Yang
Don't alway skip libc stime() for Android because bionic(Android libc) may implement it in the future. Also add break to fix potential compiler warnings. Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
2019-04-05syscalls/acct01: convert to new librarySandeep Patil
Use pre-created files by the library instead of creating them by hand in the setup() routine. Signed-off-by: Sandeep Patil <sspatil@android.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-04-05syscalls/accept01: convert to new library.Sandeep Patil
...and drop the duplicate "invalid addrlen" test case. Signed-off-by: Sandeep Patil <sspatil@android.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-04-05Remove unnecessary breaksPetr Vorel
This just remove some unnecessary breaks (not all). Breaks after tst_brk() aren't removed, as it'd produce warning on some gcc versins. Reported-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Enji Cooper <yaneurabeya@gmail.com> Acked-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-04-04hugeshmat04: fix long integer overflow on 32bit systemLi Wang
To fix an obvious integer overflow when system(32bit) original nr_hugepages >= 512. --- Error log --- # grep -i hugepage /proc/meminfo HugePages_Total: 512 HugePages_Free: 512 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB # readelf -h hugeshmat04 |grep -i ELF ELF Header: Class: ELF32 # ./hugeshmat04 tst_test.c:1085: INFO: Timeout per run is 0h 05m 00s mem.c:814: INFO: set nr_hugepages to -1024 mem.c:823: BROK: nr_hugepages = 512, but expect -1024 mem.c:814: INFO: set nr_hugepages to 512 ----------------- Reported-by: Zhonghua Hao <zhao@redhat.com> Signed-off-by: Li Wang <liwang@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-04-04syscalls/fstat05: Fix failuresCyril Hrubis
Quoting Wei Li: " On my machine running linux-4.19.23, the fstat05 test case went failed: [root@localhost ltp_20180926_src]# ./testcases/kernel/syscalls/fstat/fstat05 fstat05 1 TFAIL : fstat05.c:168: fstat() returned 0 but we wanted -1 Finally i found that, the end of head was expanded after invoking setup(), more than 4 * getpagesize(), then ptr_str is not a point outside user's accessible address space any more. " This fixes the test by using the tst_get_bad_addr() instead of sbrk() + delta. Reported-by: Wei Li <liwei391@huawei.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2019-04-03syscall/pivot_root01.c: Fix compile errorJinhui huang
1)The 'MS_REC' and 'MS_PRIVATE' flag are not defined on some old distros, so add them into 'include/lapi/mount.h' to fix it. 2)Enclose macro with complex values in parentheses. Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-04-03syscalls/accept04_01.c: Correct ltp_syscall to tst_syscallJinhui huang
Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com> Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
2019-03-28lapi: Replace __WORDSIZE with TST_ABI{,32,64}Petr Vorel
Reported-by: Dengke Du <dengke.du@windriver.com> Suggested-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2019-03-28syscalls/stime: Use 3 variants via test_multiplex()Xiao Yang
We will test stime() libc wrapper, __NR_stime and __NR_settimeofday syscalls. Note: 1) bionic (Android libc) does not provide stime(), so avoid testing it on Android. 2) some arches(e.g. x86_64) don't define __NR_stime directly because glibc implements stime() by __NR_settimeofday. Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com> Reviewed-by: Steve Muckle <smuckle@google.com> Tested-by: Steve Muckle <smuckle@google.com>
2019-03-26syscalls/accept4: convert to new librarySandeep Patil
Remove all debug checks and simplify the test. Signed-off-by: Sandeep Patil <sspatil@android.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-26syscalls/abort01: convert to new librarySandeep Patil
In the process, drop checks for UCLINUX and WCOREDUMP. Make the test simple and remove all the logic to detect if a system is "in stress". Signed-off-by: Sandeep Patil <sspatil@android.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-26sigpending: Use 3 variants via test_multiplex()Petr Vorel
We're now testing sigpending() libc wrapper, __NR_sigpending and __NR_rt_sigpending syscalls. This brings again testing libc sigpending() implementation, which was removed in 63f8a3f77 ("sigpending: use direct syscall") and removes sharing code and directory rt_sigpending introduced in b03885fff ("rt_sigpending02: reuse code from sigpending02") + removed unused headers. Acked-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-26syscalls/select04: Test four syscall variantsCyril Hrubis
This commit makes use of the newly added test variants to switch between different syscall variants/wrappers at runtime. Signed-off-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Mark Salyzyn <salyzyn@android.com> Reviewed-by: Petr Vorel <pvorel@suse.cz>
2019-03-25syscalls/clock_adjtime: create clock_adjtime syscall testsRafael David Tinoco
Fixes: 270 clock_adjtime{01,02} are created using the new API, based on existing adjtimex(2) tests. clock_adjtime() syscall might have as execution path: 1) a regular POSIX clock (only REALTIME clock implements adjtime()) - will behave exactly like adjtimex() system call. - only one being tested here. 2) a dynamic POSIX clock (which ops are implemented by PTP clocks) - will trigger the PTP clock driver function "adjtime()" - different implementations from one PTP clock to another - might return EOPNOTSUPP (like ptp_kvm_caps, for example) - no observed execution entry point for clock_adjtime() Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-25lapi/posix_clocks.h: add MAX_CLOCKS definitionRafael David Tinoco
Used by clock_XXXtime() tests, defining MAX_CLOCKS in common header. Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
2019-03-25syscalls: Add userfaultfd testcaseChristian Amann
This tests the userfaultfd syscall to handle pagefault events. It does so by registering a userfaultfd object to the address of a memory page. In a second thread it handles the event and writes data in the monitored memory page to indicate success. Signed-off-by: Christian Amann <camann@suse.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-25syscalls/ioctl08: add file deduplication testcasesChristian Amann
This adds tests for the ioctl request FIDEDUPERANGE on a btrfs device. These tests set the contents of two files, and checks if the following entities are set correctly after the ioctl call: - errno (set by ioctl) - number of deduplicated bytes - status field of the file_dedupe_range_info struct Signed-off-by: Christian Amann <camann@suse.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-21cpuset: Detect missing fts.hPetr Vorel
This fixes build on uClibc with disabled fts.h support and MUSL, which does not have fts.h at all. Reported-by: Vineet Gupta <vgupta@synopsys.com> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2019-03-21msgrcv/msgrcv08: Rename struct msgbufPetr Vorel
According to man msgrcv(3) struct for user buffer should be defined by user. Therefore rename it as MUSL defines struct msgbuf in <sys/msg.h> under _BSD_SOURCE, so the name conflict. Reported-by: Dengke Du <dengke.du@windriver.com> Suggested-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2019-03-21sigpending: improve portability by using tst_get_bad_addr()Matthias Maennich
Suggested-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-21sigpending/rt_sigpending: add basic testMatthias Maennich
Test basic functionality of sigpending/rt_sigpending. Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-21rt_sigpending02: reuse code from sigpending02Matthias Maennich
Rather than forking the code of sigpending02 completely, reuse its code for rt_sigpending02 by conditionally compiling the syscalls accordingly. That way we ensure tests written for either rt_sigpending or sigpending are also considered for the respective other. Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-20Add ltp pivot_root testPaul Lawrence
Signed-off-by: Paul Lawrence <paullawrence@google.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-20syscalls/perf_event_open02: check if PERF_COUNT_HW_INSTRUCTIONS is supportedLi Wang
The testcase is broken on system with PERF_COUNT_HW_INSTRUCTIONS not supported. Previously, it does the event check in count_hardware_counters, but that has been filtered out on s390 platform via commit 6730475ba5. So now test break as follow: perf_event_open02 1 TBROK : perf_event_open02.c:275: perf_event_open failed: errno=ENOENT(2): No such file or directory perf_event_open02 2 TBROK : perf_event_open02.c:275: Remaining cases broken Signed-off-by: Li Wang <liwang@redhat.com> Reviewed-by: Michael Holzheu <holzheu@linux.ibm.com> Acked-by: Jan Stancek <jstancek@redhat.com>
2019-03-20mem/lib: remove NH_CPUS flag from get_allowed_nodes_arrLi Wang
A new BROK was occurred on a special numa system which node 1 just has memory but no cpu. This special configuration makes numa system detection is_numa(NULL, NH_MEMS, 2) get pass in setup() but test failed in the mem.c library funcion test_ksm_merge_across_nodes becuase the NH_CPUS is to requre testing node should have cpu. However, I have gone though all of our LTP ksm tests and confirmed that there is no necessary to do cpu check for it, actully only ksm06 invoke that funcion. In this patch I just remove the NH_CPUS flag to get ksm06 test pass. # numactl -H available: 2 nodes (0-1) node 0 cpus: 0 1 2 3 4 5 6 7 node 0 size: 31431 MB node 0 free: 26355 MB node 1 cpus: node 1 size: 255 MB node 1 free: 213 MB node distances: node 0 1 0: 10 40 1: 40 10 # ./ksm06 tst_test.c:1085: INFO: Timeout per run is 0h 10m 00s mem.c:539: INFO: need NUMA system support tst_test.c:920: BROK: Test haven't reported results! Signed-off-by: Li Wang <liwang@redhat.com> Acked-by: Jan Stancek <jstancek@redhat.com>
2019-03-20setpriority01: Skip only PRIO_USER when unable to add test userSaravana Kannan
We don't need to skip all the tests just because we are unable to add a test user. Not having a test user only affects PRIO_USER test case. So just skip that one and continue running the rest of the tests when useradd is not available or can't write to /etc/passwd (Eg: read-only filesystem) If useradd is present and it still fails for other reasons, then consider it an error in the test preparation phase. This also allows this test case to be built and run on Android. Signed-off-by: Saravana Kannan <saravanak@google.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-19syscalls/tgkill03: add new testGreg Hackmann
Test simple tgkill() error cases. Signed-off-by: Greg Hackmann <ghackmann@google.com> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Li Wang <liwang@redhat.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-19syscalls/tgkill02: add new testGreg Hackmann
tgkill() should fail with EAGAIN when RLIMIT_SIGPENDING is reached with a real-time signal. Test this by starting a child thread with SIGRTMIN blocked and a limit of 0 pending signals, then attempting to deliver SIGRTMIN from the parent thread. Signed-off-by: Greg Hackmann <ghackmann@google.com> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Li Wang <liwang@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-19syscalls/tgkill01: add new testGreg Hackmann
tgkill() delivers a signal to a specific thread. Test this by installing a SIGUSR1 handler which records the current pthread ID. Start a number of threads in parallel, then one-by-one call tgkill(..., tid, SIGUSR1) and check that the expected pthread ID was recorded. Signed-off-by: Greg Hackmann <ghackmann@google.com> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Li Wang <liwang@redhat.com> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-18crypto/af_alg05: new regression test for skcipher_walk error bugEric Biggers
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-18crypto/af_alg04: new regression test for vmac race conditionsEric Biggers
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-18crypto/af_alg03: new regression test for rfc7539 hash alg validationEric Biggers
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-18crypto/af_alg02: new regression test for salsa20 empty message bugEric Biggers
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-18crypto/af_alg01: new regression test for hmac nesting bugEric Biggers
Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-18mallopt: Test only on glibcPetr Vorel
Test works with is glibc specific definitions M_MXFAST , M_NLBLKS, which aren't supported on other libc (uClibc, MUSL, Bionic), probably no other libc will ever define. uClibc also defines them in headers, that's we explicitly check glibc. Acked-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2019-03-18mremap: Define _GNU_SOURCE to get MREMAP_MAYMOVE on MUSLPetr Vorel
Unlike glibc and uclibc (which define MREMAP_MAYMOVE under __USE_MISC) MUSL requires _GNU_SOURCE. + Remove __USE_GNU Acked-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2019-03-18ptrace: Use int instead of enum __ptrace_requestPetr Vorel
enum __ptrace_request is glibc/uclibc specific. Acked-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2019-03-18{rt_,}sigaction: Define _GNU_SOURCE to get SA_NOMASK on MUSLPetr Vorel
Unlike glibc and uclibc (which define SA_NOMASK under __USE_MISC) MUSL requires _GNU_SOURCE. _GNU_SOURCE is already used in crash02.c. Acked-by: Cyril Hrubis <chrubis@suse.cz> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2019-03-15mem/mtest01: rewrite mtest01 with new APILi Wang
Test issue: mtest01 start many children to alloc chunk of memory and do write page (with -w option), but occasionally some children were killed by oom-killer and exit with SIGCHLD signal sending. After the parent reciving this SIGCHLD signal it will report FAIL as a test result. It seems not a real kernel bug if something just like that, it's trying to use 80% of memory and swap. Once it uses most of memory, system starts swapping, but the test is likely consuming memory at greater rate than kswapd can provide, which eventually triggers OOM. ---- FAIL LOG ---- mtest01 0 TINFO : Total memory already used on system = 1027392 kbytes mtest01 0 TINFO : Total memory used needed to reach maximum = 12715520 kbytes mtest01 0 TINFO : Filling up 80% of ram which is 11688128 kbytes mtest01 1 TFAIL : mtest01.c:314: child process exited unexpectedly ------------------- Rewrite changes: To make mtest01 more easier to understand, I just rewrite it into LTP new API and make a little changes in children behavior. * decrease the pressure to 80% of free memory for testing * drop the signal SIGCHLD action becasue new API help to check_child_status * make child pause itself after finishing their memory allocating/writing * parent sends SIGCONT to make children continue and exit * use TST_PROCESS_STATE_WAIT to wait child changes to 'T' state * involve ALLOC_THRESHOLD to rework same code in defines * to make mtest01 support running with -i N > 1 Signed-off-by: Li Wang <liwang@redhat.com> Signed-off-by: Jan Stancek <jstancek@redhat.com>
2019-03-15aio: Fix comparison warningPetr Vorel
Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-15io/aio: cleanup test directoryMatthias Maennich
Now that aio_tio is just a single file test, consolidate the aio tests within io/aio. Suggested-by: Steve Muckle <smuckle@google.com> Reviewed-by: Steve Muckle <smuckle@google.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-15aio_tio: convert to new libMatthias Maennich
Convert to the new test lib and perform various cleanups. Also refactor the test definition for readability. Signed-off-by: Matthias Maennich <maennich@google.com> Reviewed-by: Steve Muckle <smuckle@google.com> [ pvorel: Fixed failing build when missing libaio, cleanup ] Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-15aio_tio: determine alignment based on target block deviceMatthias Maennich
The alignment for O_DIRECT operations has to match the blocksize of the underlying block device. Determine the alignment from the target file. aio_tio test cases 1 and 2 failed (nondeterministic) on aarch64 when run on a 4096 byte blocksize and with an alignment of 512 bytes. Determining the blocksize from the block device and using it for the alignment resolves the test issue. Signed-off-by: Matthias Maennich <maennich@google.com> Reviewed-by: Alessio Balsini <balsini@google.com> Reviewed-by: Steve Muckle <smuckle@google.com> Signed-off-by: Petr Vorel <pvorel@suse.cz>
2019-03-14shell: Use $TST_FS_TYPE and $TST_DEVICE in tst_mkfs()Petr Vorel
as default parameters. Signed-off-by: Petr Vorel <pvorel@suse.cz> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-14shell: Move mkfs.foo into tst_mkfs()Petr Vorel
+ remove unused local ret variable. Signed-off-by: Petr Vorel <pvorel@suse.cz> Acked-by: Cyril Hrubis <chrubis@suse.cz>
2019-03-14ima, commands/{df,mkfs}: Use tst_mount()Petr Vorel
to reduce duplicity. That required to rename variable s/FS_TYPE/TST_FS_TYPE/. Signed-off-by: Petr Vorel <pvorel@suse.cz> Acked-by: Cyril Hrubis <chrubis@suse.cz>