Tests: select_poll_epoll: Add support for _time64 Add support for the 64-bit time_t syscalls SYS_ppoll_time64 and SYS_pselect6_time64. These syscalls exist on 32-bit platforms since the 5.1 kernel. 32-bit platforms with a 64-bit time_t only have these and don't have the original syscalls (such as 32-bit RISC-V). In doing so, the original syscalls were renamed to add the `_time32` suffix which causes the validation steps to fail. This patch ensures that the 64-bit version of the pselect and ppoll syscalls are called whenever they are available, allowing the tests to succeed. It also ensures that we don't attempt to use the 32-bit versions that don't exist on newer 32-bit platforms like RISCV-32. The test is also cleaned-up: - The *invalid_pointer, *invalid_fd, *ulong_max, and *buffer_overflow tests are identical except for the syscall(...) invocation. They are combined to share as much code as possible regardless of which syscalls the platform's ABI supports. - Harmonized test names between the test script and test application - Test names are printed when using the list option and used to launch a test (rather than a numeric id) - Allow the test application to print the list of supported tested syscalls Fixes: https://github.com/lttng/lttng-tools/pull/162 Change-Id: I974f780022441fedfa45414d672092606e657cf6 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: fix: select_poll_epoll: test assumes epoll fd value The test currently assumes that epoll fds are always == 3, which is not always the case depending on the execution environment. This change causes `select_poll_epoll` to produce a JSON file containing the application's pid and epoll fd values that is then used by the validation script. Note that the test is converted to C++ to allow the use of internal utils (common/error.h/cpp) without changing their linkage. However, the code is still regular C to ease the backport of this fix. Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: Ie373c63f6e6b9267ae2d785c9f0a532a5de37905
Tests: port validate_select_poll_epoll.py to bt2 python bindings Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> Change-Id: I6ed3177e5bd31a56f4a1e84b53bf1d9025ac3161
tests: Move to kernel style SPDX license identifiers The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. See https://spdx.org/ids-how for details. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Change-Id: I89cd4b4b7440f71f52426a5508252932bb46e796 Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: rework select_poll_epoll test to improve verbosity on failure Prints the tested values that caused a test failure to ease the troubleshooting of unreliable tests. Also, clean-up unused variables in multiple testcases. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Test: Replace test relying on pselect6(2) man page ambiguity The `pselect_fd_too_big` test is checking for the case where the `nfds` is larger than the number of open files allowed for this process (RLIMIT_NOFILE). According to the ERRORS section of the pselect6(2) kernel man page[1], if `nfds` > RLIMIT_NOFILE is evaluate to true the pselect6 syscall should return EINVAL but the BUGS section mentions that the current implementation ignores any FD larger than the highest numbered FD of the current process. This is in fact what happens. The Linux implementation of the pselect6 syscall[2] does not compare the `nfds` and RLIMIT_NOFILE, but rather caps `nfds` to the highest numbered FD of the current process as the BUGS kernel man page mentionned. It was observed elsewhere that there is a discrepancy between the manual page and the implementation[3]. As a solution, replace the current testcase with one that checks the behaviour of the syscall when an invalid FD is passed. [1]:http://man7.org/linux/man-pages/man2/pselect6.2.html [2]:https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/select.c#n619 [3]:https://patchwork.kernel.org/patch/9345805/ Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Julien Desfossez <jdesfossez@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Test for select, poll and epoll syscall overrides This test for root_regression checks if the syscall overrides for select, pselect6, poll, ppoll, epoll_ctl, epoll_wait and epoll_pwait work as expected on arm and x86 (32 and 64-bit). There are 11 test cases that check for normal and abnormal behaviour. If the test system has the Babeltrace python bindings, the test validates the content of the events, otherwise only the presence of the generated events is checked. We also check if kernel OOPS, WARNING or BUG were generated during the test. Signed-off-by: Julien Desfossez <jdesfossez@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>