Age | Commit message (Collapse) | Author |
|
The path to the Makefile was not correct for the out-of-tree build
because it was pointing to the build directory rather than to the source
directory.
Apparently this also caused random failures for out-of-tree build. For
some reason when building syscalls/set_mempolicy/ testcases the rebuild
of the libltpnuma.a library is triggered for out-of-tree build for about
10% of the cases on massively parallel build. Which as far as I can tell
shouldn't happen since we build everything in the libs/ directory as a
prerequisite of the testcases/ directory. So there is likely some
strange race condition happening and while this does not fix the actual
race it makes it quite harmless since the target was already build and
the make in the libs/libltpnuma/ directory will be no-op.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
Tested-by: Petr Vorel <pvorel@suse.cz>
|
|
Now that sched_getaffinity() has been converted to new library we can
just switch the error message to use tst_brk(). This fixes LTP
compilation on older distributions.
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
|
|
by adding missing <string.h> and <strings.h> headers.
Signed-off-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
Reviewed-by: Enji Cooper <yaneurabeya@gmail.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
[ pvorel: TODO: #521: deprecated functions from <strings.h> should be
replaced by these from <string.h>. ]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
This fixes build errors caused by -Werror-implicit-function-declaration
defined for android. There are many places, where missing <string.h> is
needed for memory and string related functions (see [1]). Including
headers here seems to be better than handling implicit function
declaration error every now and then.
There are few other headers missing, most notably <strings.h>. As this
header is deprecated, these should be replaced by these <string.h>.
Other headers (e.g. <stdlib.h>) should be manually added.
+ update copyright, use SPDX-License-Identifier.
[1] http://lists.linux.it/pipermail/ltp/2019-April/011655.html
Suggested-by: Zhengwang Ruan <ruanzw@xiaopeng.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
Based on previous discussion on commit be944db1f and [1].
+ use SPDX-License-Identifier.
[1] https://groups.google.com/forum/#!topic/android-ndk/cf9_f1SLXls
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
|
Signed-off-by: Federico Bonfiglio <fedebonfi95@gmail.com>
Acked-by: Cyril Hrubis <metan@ucw.cz>
|
|
'ADJ_OFFSET_SS_READ' 'ADJ_NANO' 'STA_NANO' and 'ADJ_MICRO' are not defined on
some old distros, so add them into a new 'include/lapi/timex.h' to fix it.
Also move ADJ_ALL macro into this new header file.
These macros are introduced by the following commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=52bfb36
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eea83d8
sys_clock_adjtime are introduced by the following commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=339dc
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Signed-off-by: Federico Bonfiglio <fedebonfi95@gmail.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
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>
|
|
Reported-by: Dengke Du <dengke.du@windriver.com>
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
|
This is meant to be a replacement of __WORDSIZE definition.
Motivation was instead of finding, where all libc define
__WORDSIZE, which is usually used for detecting target type
(at least MUSL defines it in different place than other libc)
we define our own constant.
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
|
The test variants are intended for running the test more than once for a
different settings. The indended purpose is to run tests for both libc
wrapper and raw syscall as well as for different syscall variants.
The commit itself adds a test_variant integer that, if set, denotes
number of test variants. The test is then forked and executed
test_variant times each time with different value in global tst_variant
variable.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Steve Muckle <smuckle@google.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
|
|
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>
|
|
Used by clock_XXXtime() tests, defining MAX_CLOCKS in common header.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
|
|
When adding a common header to my tests I missed this include guard when
accidentally including tst_safe_clocks.h from .c and .h files. Since
other tst_safe_*.h files have guards I thought it would be good to add
to this one as well.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Reviewed-by: Enji Cooper <yaneurabeya@gmail.com
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Adds SAFE_CLOCK_ADJTIME() macro to tst_safe_clocks.h.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
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>
|
|
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>
|
|
Add helper functions for creating and using AF_ALG sockets. AF_ALG is
the userspace interface to algorithms in the Linux kernel's crypto API.
See https://www.kernel.org/doc/html/latest/crypto/userspace-if.html for
more information about this interface.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
__sighandler_t is libc implementation specific. Thus use (*)(int),
as specified by POSIX.
This fixes MUSL build.
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
|
This adds the same trick we use for SAFE_FCNTL() to SAFE_IOCTL(), the
added coma + zero forces the return value to be numeric in all cases so
that compiler will work fine in cases that we want to store the
resulting value from SAFE_IOCTL().
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
CC: Federico Bonfiglio <fedebonfi95@gmail.com>
|
|
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
|
This hooks up libs/ subdirectories into the build system so that tests
needs only specify which library from libs/ directory we should link
againts. Which sets up the path to the library in LDFLAGS and also
causes the library to be rebuild even when make is executed from the
directory with testcases.
Now the test only needs to set up LTPLIBS variable with a list of
optional libraries to link against and LDLIBS, since as far as I know we
have to maintain the order of the libraries manually.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
|
|
The library implements a nodemap, which is a map of nodes (array)
containing node ids for a subset of system nodes. Currently nodes can be
filtered based on memory requirements, which is needed for testing
memory related NUMA syscalls such as set_mempolicy() and membind() where
we usually need at least two memory nodes with free memory.
It also implements counters, so that we can precisely count, for a given
memory range, how much memory was allocated on each node in the map and
a few simple functions for mapping, faulting and unmapping memory.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
CC: Vlastimil Babka <vbabka@suse.cz>
CC: Michal Hocko <mhocko@kernel.org>
CC: Jan Stancek <jstancek@redhat.com>
Acked-by: Jan Stancek <jstancek@redhat.com>
|
|
Check the basic functionality of the pwritev2().
Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com>
Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
|
|
Signed-off-by: Jinhui huang <huangjh.jy@cn.fujitsu.com>
Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
|
|
+ minor formatting fixes (include guards, copyright).
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
|
|
Although this not needed, users of tst_safe_clocks.h usually need also
posix clock flags and it's safer to load them automatically so fixes
like 938a1023d are not needed any more.
+ minor copyright formatting cleanup.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
|
|
Some libc implementations might differ in the definitions they
include. Exempli gratia: MUSL does not define __SIGRTMAX nor
__SIGRTMIN.
These two tests fail to build because of the missing
definitions:
testcases/kernel/syscalls/ptrace/ptrace05.c
testcases/kernel/syscalls/sighold/sighold02.c
Out of precaution, these two also include this header:
lib/tst_sig.c
testcases/kernel/syscalls/rt_sigsuspend/rt_sigsuspend01.c
Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -D_FORTIFY_SOURCE=2 -I../../../../include -I../../../../include -I../../../../include/old/ -L../../../../lib syncfs01.c -lltp -o syncfs01
In file included from syncfs01.c:19:
../../../../include/lapi/syncfs.h: In function ‘syncfs’:
../../../../include/lapi/syncfs.h:17: warning: implicit declaration of function ‘syscall’
../../../../include/lapi/syncfs.h:17: warning: implicit declaration of function ‘tst_brk’
../../../../include/lapi/syncfs.h:17: error: ‘TCONF’ undeclared (first use in this function)
../../../../include/lapi/syncfs.h:17: error: (Each undeclared identifier is reported only once
../../../../include/lapi/syncfs.h:17: error: for each function it appears in.)
In file included from ../../../../include/tst_test.h:25,
from syncfs01.c:20:
/usr/include/unistd.h: At top level:
/usr/include/unistd.h:1068: error: conflicting types for ‘syscall’
../../../../include/lapi/syncfs.h:17: note: previous implicit declaration of ‘syscall’ was here
make: *** [syncfs01] Error 1
Fixes: b88b3785d ("syscalls: add syncfs() sync device test-case")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
Add config check for C library wrapper for sync_file_range() syscall.
Also, check for sync_file_range() presence via dummy call rather than
kernel version check. And move fallback api to:
include/lapi/sync_file_range.h
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
syncfs01 tests to sync filesystem having large dirty file pages to block
device. Also, it tests all supported filesystems on a test block device.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Define TEST_VOID() macro for syscalls whose return type is void like
sync() etc.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Split tst_fill_file() api to create new tst_fill_fd() api which could be
used to fill file using fd and allows syscalls tests to operate on fd.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
This api reads test block device stat file and returns the bytes written
since the last invocation of this api.
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Otherwise we don't use the system ustat.h header at all.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Use direct syscall to expand test compatibility to Android.
Signed-off-by: Steve Muckle <smuckle@google.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
This commit exposes tst_clock_name() function by removing its static
definition and creating a public function prototype. This function is
needed by clock/alarm tests and their error messages.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
|
|
This commit adds a tst_timespec_sub_us() function that subtracts
microseconds from a given timespec struct.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Some tests that change the system-wide clock need to have a way to
restore the correct time after their execution.
This commit introduces a new field to tst_test struct called
"restore_wallclock": it makes the test to save current realtime clock
during setup phase, and, later, during cleanup, restore it to the
appropriate time using a monotonic raw clock difference.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
|
|
This commit adds a tst_timespec_add() function that adds two given
timespec structs. It is needed in order to avoid unneeded ns <-> us
conversions because, so far, there is only tst_timespec_add_us()
available.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Adds SAFE_CLOCK_SETTIME() macro to tst_safe_clocks.h.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
|
|
Adds tst_clock_settime() function to the lib.
Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
|
|
>From Miklos's words:
The F_SETLEASE "failure" is caused by the simplistic way the
kernel currently determines if there's a possible local conflict
to a write lock:
check_conflicting_open(const struct dentry *dentry, const long arg, int flags)
{
/*...*/
if ((arg == F_WRLCK) && ((d_count(dentry) > 1) ||
(atomic_read(&inode->i_count) > 1)))
ret = -EAGAIN;
/*...*/
It reads the dentry count, and if there's any other reference
to the dentry or inode as the one held by this file, then it
is assumed to come from a conflicting open. Which is not true,
dentry references can come from variety of sources (e.g. O_PATH
opens are obviously non-conflicting). This causes failure on
tmpfs as well, which holds an extra reference on each dentry.
The extra ref on the dentry in overlayfs comes from the realfile
stored in the overlay file's private_data field.
The proper solution to this is probably to have an i_readcount,
matching the functionality of i_writecount, which would solve
the other problems with the current approach.
Note: this is not a failure in the sense that applications must
be written with the assumption that F_SETLEASE can fail with
-EAGAIN, so this error condition just makes the lease non-useful,
but shouldn't break anything.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
==== Error log =====
fcntl24 1 TFAIL : fcntl24.c:148: fcntl(tfile_7254, F_SETLEASE, F_WRLCK) Failed, errno=11 : Resource temporarily unavailable
fcntl25 1 TFAIL : fcntl25.c:149: fcntl(tfile_7255, F_SETLEASE, F_WRLCK) Failed, errno=11 : Resource temporarily unavailable
fcntl26 1 TFAIL : fcntl26.c:149: fcntl(tfile_7256, F_SETLEASE, F_WRLCK) Failed, errno=11 : Resource temporarily unavailable
fcntl33.c:118: FAIL: fcntl() failed to set lease: EAGAIN/EWOULDBLOCK
fcntl33.c:118: FAIL: fcntl() failed to set lease: EAGAIN/EWOULDBLOCK
fcntl33.c:118: FAIL: fcntl() failed to set lease: EAGAIN/EWOULDBLOCK
fcntl33.c:118: FAIL: fcntl() failed to set lease: EAGAIN/EWOULDBLOCK
Reported-by: Xiong Zhou <xzhou@redhat.com>
Signed-off-by: Li Wang <liwang@redhat.com>
Cc: Miklos Szeredi <mszeredi@redhat.com>
Cc: Ye Chao <cye@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
This is meant as last resort action for disabling tests if certain
kernel funcitonality was not present, in general case runtime checks are
prefered.
For functionality that can be build as a module tst_check_driver() is
most likely better fit since it will also insert requested kernel module
into kernel if needed.
For newly added syscalls kernel version comparsion and/or checking errno
is prefered.
However in rare cases certain core kernel functionality cannot be
detected in any other way than checking the kernel config, which is
where this API gets into the play.
The path to the kernel config could be specified by KCONFIG_PATH
environment variable, which also takes precedence before the
autodetection that attempts to read the config from known locations.
The required kernel options are passed as an array of strings via the
.needs_kconfigs pointer in the tst_test structure. The purpose of this
is twofold, one is that the test can disable itself at runtime if given
functionality is missing from kernel .config and second is about being
able to propagate this information to the testrunner (this could be done
once we figure out how export the information from the structure to the
test runner) then we can avoid running tests on unsuitable
configurations from the start.
There are two different ways how to specify the required kernel options
either by stating the config name i.e. "CONFIG_FOO" which is considered
present in kernel if set to a certain value and "CONFIG_FOO=bar" which
requires the config option to be strictly set to a desired value.
The code has been also split into parsing phase that simply picks up the
config option values from the config and to evaluation which does the
actual checks and aborts the test if needed. This makes it easier to
expand the domain language for specifying the required options, if we
ever need to match against subset of values this should be reasonably
easy to implement.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Sandeep Patil <sspatil@google.com>
CC: Pengfei Xu <pengfei.xu@intel.com>
CC: automated-testing@yoctoproject.org
|
|
On s390x we only have the getrlimit() syscall with number 191 and no
ugetrlimit() syscall.
Because of the wrong definition the testcase "getrlimit03" fails on s390x.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Acked-by: Jan Stancek <jstancek@redhat.com>
|
|
On s390 (32 bit) only the "__s390__" macro is set by gcc and on
s390x (64 bit) both macros "__s390__" and "__s390x__" are set.
Therefore a check "#ifdef __s390__" is not sufficient for checking
32 bit Mainframe Linux systems since this is also true on s390x machines.
Fix this and generate the correct s390 check:
"#if defined(__s390__) && !defined(__s390x__)"
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Acked-by: Jan Stancek <jstancek@redhat.com>
|
|
NOTE: Added only into new API.
Signed-off-by: Ramon Pantin <pantin@google.com>
[pvorel: removed ESOCKTNOSUPPORT, EPFNOSUPPORT as (according to man
socketpair(2) and kernel sources) it should not happen on socketpair()]
Signed-off-by: Petr Vorel <pvorel@suse.cz>
|
|
It can collide with existing macros of same name:
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall -W -Wold-style-definition -Illtp -o quotactl03
In file included from ../../../../include/tst_test.h:29:0,
from quotactl03.c:53:
../../../../include/tst_common.h:68:0: warning: "BUILD_BUG_ON" redefined
#define BUILD_BUG_ON(condition) \
In file included from /usr/include/xfs/xqm.h:21:0,
from quotactl03.c:50:
/usr/include/xfs/xfs.h:68:0: note: this is the location of the previous definiti
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|