Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+34 -14
+4 -1
tools/testing/selftests/breakpoints/step_after_suspend_test.c
··· 152 152 if (err < 0) 153 153 ksft_exit_fail_msg("timerfd_settime() failed\n"); 154 154 155 - if (write(power_state_fd, "mem", strlen("mem")) != strlen("mem")) 155 + system("(echo mem > /sys/power/state) 2> /dev/null"); 156 + 157 + timerfd_gettime(timerfd, &spec); 158 + if (spec.it_value.tv_sec != 0 || spec.it_value.tv_nsec != 0) 156 159 ksft_exit_fail_msg("Failed to enter Suspend state\n"); 157 160 158 161 close(timerfd);
-2
tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c
··· 27 27 #include "../kselftest_harness.h" 28 28 #include "clone3_selftests.h" 29 29 30 - #define MAX_PID_NS_LEVEL 32 31 - 32 30 static void child_exit(int ret) 33 31 { 34 32 fflush(stdout);
+1
tools/testing/selftests/core/.gitignore
··· 1 1 close_range_test 2 + unshare_test
+2 -2
tools/testing/selftests/devices/probe/test_discoverable_devices.py
··· 45 45 46 46 47 47 def find_usb_controller_dirs(): 48 - usb_controller_sysfs_dir = "usb[\d]+" 48 + usb_controller_sysfs_dir = r"usb[\d]+" 49 49 50 50 dir_regex = re.compile(usb_controller_sysfs_dir) 51 51 for d in os.scandir(sysfs_usb_devices): ··· 91 91 92 92 93 93 def get_usb_version(sysfs_dev_dir): 94 - re_usb_version = re.compile("PRODUCT=.*/(\d)/.*") 94 + re_usb_version = re.compile(r"PRODUCT=.*/(\d)/.*") 95 95 with open(os.path.join(sysfs_dev_dir, "uevent")) as f: 96 96 return int(re_usb_version.search(f.read()).group(1)) 97 97
+2 -1
tools/testing/selftests/exec/.gitignore
··· 9 9 execveat.denatured 10 10 non-regular 11 11 null-argv 12 - /load_address_* 12 + /load_address.* 13 + !load_address.c 13 14 /recursion-depth 14 15 xxxxxxxx* 15 16 pipe
+2
tools/testing/selftests/hid/Makefile
··· 17 17 TEST_PROGS += hid-usb_crash.sh 18 18 TEST_PROGS += hid-wacom.sh 19 19 20 + TEST_FILES := run-hid-tools-tests.sh 21 + 20 22 CXX ?= $(CROSS_COMPILE)g++ 21 23 22 24 HOSTPKG_CONFIG := pkg-config
+10 -1
tools/testing/selftests/rtc/rtctest.c
··· 412 412 413 413 int main(int argc, char **argv) 414 414 { 415 + int ret = -1; 416 + 415 417 switch (argc) { 416 418 case 2: 417 419 rtc_file = argv[1]; ··· 425 423 return 1; 426 424 } 427 425 428 - return test_harness_run(argc, argv); 426 + /* Run the test if rtc_file is accessible */ 427 + if (access(rtc_file, R_OK) == 0) 428 + ret = test_harness_run(argc, argv); 429 + else 430 + ksft_exit_skip("[SKIP]: Cannot access rtc file %s - Exiting\n", 431 + rtc_file); 432 + 433 + return ret; 429 434 }
+8 -4
tools/testing/selftests/timers/posix_timers.c
··· 26 26 static void __fatal_error(const char *test, const char *name, const char *what) 27 27 { 28 28 char buf[64]; 29 + char *ret_str = NULL; 29 30 30 - strerror_r(errno, buf, sizeof(buf)); 31 + ret_str = strerror_r(errno, buf, sizeof(buf)); 31 32 32 - if (name && strlen(name)) 33 - ksft_exit_fail_msg("%s %s %s %s\n", test, name, what, buf); 33 + if (name && strlen(name) && ret_str) 34 + ksft_exit_fail_msg("%s %s %s %s\n", test, name, what, ret_str); 35 + else if (ret_str) 36 + ksft_exit_fail_msg("%s %s %s\n", test, what, ret_str); 34 37 else 35 - ksft_exit_fail_msg("%s %s %s\n", test, what, buf); 38 + ksft_exit_fail_msg("%s %s\n", test, what); 39 + 36 40 } 37 41 38 42 #define fatal_error(name, what) __fatal_error(__func__, name, what)
+5 -3
tools/testing/selftests/vDSO/vdso_test_getrandom.c
··· 59 59 size_t page_size = getpagesize(); 60 60 size_t new_cap; 61 61 size_t alloc_size, num = sysconf(_SC_NPROCESSORS_ONLN); /* Just a decent heuristic. */ 62 + size_t state_size_aligned, cache_line_size = sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ?: 1; 62 63 void *new_block, *new_states; 63 64 64 - alloc_size = (num * vgrnd.params.size_of_opaque_state + page_size - 1) & (~(page_size - 1)); 65 - num = (page_size / vgrnd.params.size_of_opaque_state) * (alloc_size / page_size); 65 + state_size_aligned = (vgrnd.params.size_of_opaque_state + cache_line_size - 1) & (~(cache_line_size - 1)); 66 + alloc_size = (num * state_size_aligned + page_size - 1) & (~(page_size - 1)); 67 + num = (page_size / state_size_aligned) * (alloc_size / page_size); 66 68 new_block = mmap(0, alloc_size, vgrnd.params.mmap_prot, vgrnd.params.mmap_flags, -1, 0); 67 69 if (new_block == MAP_FAILED) 68 70 goto out; ··· 80 78 if (((uintptr_t)new_block & (page_size - 1)) + vgrnd.params.size_of_opaque_state > page_size) 81 79 new_block = (void *)(((uintptr_t)new_block + page_size - 1) & (~(page_size - 1))); 82 80 vgrnd.states[i] = new_block; 83 - new_block += vgrnd.params.size_of_opaque_state; 81 + new_block += state_size_aligned; 84 82 } 85 83 vgrnd.len = num; 86 84 goto success;