1

linux_kselftest-fixes-6.12-rc2

This kselftest fixes update for Linux 6.12-rc2 consists of fixes
 to build warnings, install scripts, run-time error path, and
 git status cleanups to tests:
 
 -- devices/probe: fix for Python3 regex string syntax warnings
 -- clone3: removing unused macro from clone3_cap_checkpoint_restore()
 -- vDSO: fix to align getrandom states to cache line
 -- core and exec: add missing executables to .gitignore files
 -- rtc: change to skip test if /dev/rtc0 can't be accessed
 -- timers/posix: fix warn_unused_result result in __fatal_error()
 -- breakpoints: fix to detect suspend successful condition correctly
 -- hid: fix to install required dependencies to run the test
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmcAFpQACgkQCwJExA0N
 QxxpnhAAo7799mqe0XlDR33zno/9rfZgVUfsb76M59afhFLeu68x1k5SUlZJvJyH
 a140u6GrSsPpajiVGMz/dJG46NZd9qQCNxLXOV0FlBA5tYbzOXn0TfpeH8/gbYYL
 rnL+YpdsKfVrGVkvRmx8U7YaUwr6oFG8pALOP9IqhfRhKEb139NS+YK3eqbWiRRo
 4HEVZ1usqxCyd13E07Vp4EigcLW3fBCQmRUyN1Gue2fmD2TFoZ+TQ+n3Oz3md7HI
 IhpT551T70OrARJTK+cJF215S6pzrYO3huPb0b294WmBqvJTtKN42MuDmzmkMXxd
 1Jnm1ePGLcS0auhnc6yLzgkYdZnLq8wIDUV1w6lIrUJp3EFPKAl2GKYlK4gJ/Um1
 BXbArRMSD3et7CzL6DyauFPE9B+eAOhd2sSXHomc+YyfJP0pJnbcazlhiNjeapSd
 aE8li0ZodbvdZtvTVrqqkXlZNfyKPKCmz4CnaKTxseSBpbjz0utYtbayQUcY3y40
 Km+nElpNzmftqtUkmATJ/1FOZyvSR4R+C4QtrIJ9BS3xnBuijrZMgnRUCUgXSBEz
 bzTtnMbY6ZGxGkISO+mNA9Ee1JBO8dixWNCY5A6vcqxRZR1SMNiesERE14yMsWlB
 82VltYnT4XfHjTejvuKf2+tt+Auen3cPVq16emXxucFqdeAN8cs=
 =AqIe
 -----END PGP SIGNATURE-----

Merge tag 'linux_kselftest-fixes-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest fixes from Shuah Khan:
 "Fixes to build warnings, install scripts, run-time error path, and git
  status cleanups to tests:

   - devices/probe: fix for Python3 regex string syntax warnings

   - clone3: removing unused macro from clone3_cap_checkpoint_restore()

   - vDSO: fix to align getrandom states to cache line

   - core and exec: add missing executables to .gitignore files

   - rtc: change to skip test if /dev/rtc0 can't be accessed

   - timers/posix: fix warn_unused_result result in __fatal_error()

   - breakpoints: fix to detect suspend successful condition correctly

   - hid: fix to install required dependencies to run the test"

* tag 'linux_kselftest-fixes-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests: breakpoints: use remaining time to check if suspend succeed
  kselftest/devices/probe: Fix SyntaxWarning in regex strings for Python3
  selftest: hid: add missing run-hid-tools-tests.sh
  selftests: vDSO: align getrandom states to cache line
  selftests: exec: update gitignore for load_address
  selftests: core: add unshare_test to gitignore
  clone3: clone3_cap_checkpoint_restore: remove unused MAX_PID_NS_LEVEL macro
  selftests:timers: posix_timers: Fix warn_unused_result in __fatal_error()
  selftest: rtc: Check if could access /dev/rtc0 before testing
This commit is contained in:
Linus Torvalds 2024-10-04 17:30:59 -07:00
commit 27cc6fdf72
9 changed files with 34 additions and 14 deletions

View File

@ -152,7 +152,10 @@ void suspend(void)
if (err < 0)
ksft_exit_fail_msg("timerfd_settime() failed\n");
if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem"))
system("(echo mem > /sys/power/state) 2> /dev/null");
timerfd_gettime(timerfd, &spec);
if (spec.it_value.tv_sec != 0 || spec.it_value.tv_nsec != 0)
ksft_exit_fail_msg("Failed to enter Suspend state\n");
close(timerfd);

View File

@ -27,8 +27,6 @@
#include "../kselftest_harness.h"
#include "clone3_selftests.h"
#define MAX_PID_NS_LEVEL 32
static void child_exit(int ret)
{
fflush(stdout);

View File

@ -1 +1,2 @@
close_range_test
unshare_test

View File

@ -45,7 +45,7 @@ def find_pci_controller_dirs():
def find_usb_controller_dirs():
usb_controller_sysfs_dir = "usb[\d]+"
usb_controller_sysfs_dir = r"usb[\d]+"
dir_regex = re.compile(usb_controller_sysfs_dir)
for d in os.scandir(sysfs_usb_devices):
@ -91,7 +91,7 @@ def get_acpi_uid(sysfs_dev_dir):
def get_usb_version(sysfs_dev_dir):
re_usb_version = re.compile("PRODUCT=.*/(\d)/.*")
re_usb_version = re.compile(r"PRODUCT=.*/(\d)/.*")
with open(os.path.join(sysfs_dev_dir, "uevent")) as f:
return int(re_usb_version.search(f.read()).group(1))

View File

@ -9,7 +9,8 @@ execveat.ephemeral
execveat.denatured
non-regular
null-argv
/load_address_*
/load_address.*
!load_address.c
/recursion-depth
xxxxxxxx*
pipe

View File

@ -17,6 +17,8 @@ TEST_PROGS += hid-tablet.sh
TEST_PROGS += hid-usb_crash.sh
TEST_PROGS += hid-wacom.sh
TEST_FILES := run-hid-tools-tests.sh
CXX ?= $(CROSS_COMPILE)g++
HOSTPKG_CONFIG := pkg-config

View File

@ -412,6 +412,8 @@ TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {
int main(int argc, char **argv)
{
int ret = -1;
switch (argc) {
case 2:
rtc_file = argv[1];
@ -423,5 +425,12 @@ int main(int argc, char **argv)
return 1;
}
return test_harness_run(argc, argv);
/* Run the test if rtc_file is accessible */
if (access(rtc_file, R_OK) == 0)
ret = test_harness_run(argc, argv);
else
ksft_exit_skip("[SKIP]: Cannot access rtc file %s - Exiting\n",
rtc_file);
return ret;
}

View File

@ -26,13 +26,17 @@
static void __fatal_error(const char *test, const char *name, const char *what)
{
char buf[64];
char *ret_str = NULL;
strerror_r(errno, buf, sizeof(buf));
ret_str = strerror_r(errno, buf, sizeof(buf));
if (name && strlen(name))
ksft_exit_fail_msg("%s %s %s %s\n", test, name, what, buf);
if (name && strlen(name) && ret_str)
ksft_exit_fail_msg("%s %s %s %s\n", test, name, what, ret_str);
else if (ret_str)
ksft_exit_fail_msg("%s %s %s\n", test, what, ret_str);
else
ksft_exit_fail_msg("%s %s %s\n", test, what, buf);
ksft_exit_fail_msg("%s %s\n", test, what);
}
#define fatal_error(name, what) __fatal_error(__func__, name, what)

View File

@ -59,10 +59,12 @@ static void *vgetrandom_get_state(void)
size_t page_size = getpagesize();
size_t new_cap;
size_t alloc_size, num = sysconf(_SC_NPROCESSORS_ONLN); /* Just a decent heuristic. */
size_t state_size_aligned, cache_line_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ?: 1;
void *new_block, *new_states;
alloc_size = (num * vgrnd.params.size_of_opaque_state + page_size - 1) & (~(page_size - 1));
num = (page_size / vgrnd.params.size_of_opaque_state) * (alloc_size / page_size);
state_size_aligned = (vgrnd.params.size_of_opaque_state + cache_line_size - 1) & (~(cache_line_size - 1));
alloc_size = (num * state_size_aligned + page_size - 1) & (~(page_size - 1));
num = (page_size / state_size_aligned) * (alloc_size / page_size);
new_block = mmap(0, alloc_size, vgrnd.params.mmap_prot, vgrnd.params.mmap_flags, -1, 0);
if (new_block == MAP_FAILED)
goto out;
@ -78,7 +80,7 @@ static void *vgetrandom_get_state(void)
if (((uintptr_t)new_block & (page_size - 1)) + vgrnd.params.size_of_opaque_state > page_size)
new_block = (void *)(((uintptr_t)new_block + page_size - 1) & (~(page_size - 1)));
vgrnd.states[i] = new_block;
new_block += vgrnd.params.size_of_opaque_state;
new_block += state_size_aligned;
}
vgrnd.len = num;
goto success;