From patchwork Fri Oct 4 16:44:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13822778 Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1326A1E3795 for ; Fri, 4 Oct 2024 16:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728060302; cv=none; b=gW7k2B9e/POT/FNH5BXbHHo8CrlpyuYJ9/bCCPZUyDlQnYdyxlD3/8Mcoegerui/RIUGTmMNs3Ro09BX+PK+u3sWYTLIVak4fxEikeuRA6pINFfPpAahvfohR2q0RmRSK92fCbGCoeUO7cUn8ZH0C1Nk7Ix3C8/QPQoXI2dB6Ek= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728060302; c=relaxed/simple; bh=Hq80wbTCVLtZ21mLi7c3CaTFZ5LjUehB/a3vjSHHbCI=; h=Content-Type:Message-ID:Date:MIME-Version:From:Subject:To:Cc; b=cSlALR60R9ThR03yBffPKr0czxZChnUnzEnH+jHdgOSHya05MFpmAr6Xg/54IuoCz4MhmY0qP2khs5T4emncuGqWv3kpYxOc2WGzPA0BHa4UQPz3snE7WmyDQaRJeixeDbR4f9FqHyXSvNCBo3PuW/yg5fVC04il4YjpqFeeIzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GYil2C5B; arc=none smtp.client-ip=209.85.166.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GYil2C5B" Received: by mail-il1-f179.google.com with SMTP id e9e14a558f8ab-3a2761f1227so7710785ab.0 for ; Fri, 04 Oct 2024 09:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1728060299; x=1728665099; darn=vger.kernel.org; h=cc:to:subject:from:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=fdxfDM/YObFCf1TC5a8kva0Yj7FTK3ndHvZQFOO6mGM=; b=GYil2C5Bn540ppINVmcJB4oK9A8wFXHZpDtx94Eh3EyYCwpRrfs3jGwOwsupmJ2+hO hA2em+cevKu7Vdu+GIk2/BFvHa9Y332bQxDvGFZZm30FcDQmIVdvkg1BISTYNs68gUz6 wATu5IgFjT5LDDCCSVRpTLIkuVRsVdtMt8YZw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728060299; x=1728665099; h=cc:to:subject:from:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fdxfDM/YObFCf1TC5a8kva0Yj7FTK3ndHvZQFOO6mGM=; b=pd0F76ANv5yxsSBf4QG9IQeRW+Po6k/6uOTAfuifFutog34lIf66PMmLsIzYuhiXl4 Y3xUn9rJStGdN7PZc6JvaQmqcchHE7bBQOpmxVSwHfwzR/gR+8Kglyl1uXMUInGCC7x8 +hr0EiYsHYHULADQztWiSxoXcaZXpceQ7t67XPjU7rQPsGHhIjPdC9ewQyHNKoHQcvgw aUbMEMpxtd0Tcr1TDWusa279W0gXeaof9m9qFw7crM4rwjVr6hLecaQHqYugOn9SsQqf PO7XyabBPHlh75CS6gB4K4lZE2TKwvSYX7wNMbRoPztZCqCLSB/1SMKVfI/Dq8VI58qo eXEg== X-Forwarded-Encrypted: i=1; AJvYcCUBXAhKlfJZLxcVDA3/GZOX+V3PZAG20XB8Ps8bPkgwO0gWfrNsdk0iDVx+SnUYuuXNOXPDsEyCOUw5NIZgJJs=@vger.kernel.org X-Gm-Message-State: AOJu0YyVti+O/rObU3P/uGm6KzPR/SAHYJ5VBfPGeBsUXi5XUCeqALJ6 BqPRgR7FtFEJjo2amh5/B4Gszu47AptFdTTnNIgXui/n7kghyoR/Vhzd6Y3L/eKGl6SENyJ5ZYO u X-Google-Smtp-Source: AGHT+IHEi2v56POM6xL7GHZvZjM6YypaFAN5/G2CvNlipESRFhxdVYzbtcgaVWdCvTUt3untKDlrGQ== X-Received: by 2002:a05:6e02:2142:b0:3a3:5fad:77b4 with SMTP id e9e14a558f8ab-3a37597788emr36334775ab.3.1728060299009; Fri, 04 Oct 2024 09:44:59 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a37a7e790bsm451965ab.10.2024.10.04.09.44.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Oct 2024 09:44:58 -0700 (PDT) Message-ID: <2d95ac4d-e239-49ba-ad72-368284a3ae25@linuxfoundation.org> Date: Fri, 4 Oct 2024 10:44:57 -0600 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Shuah Khan Subject: [GIT PULL] Kselftest fixes update for Linux 6.12-rc2 To: Linus Torvalds Cc: Shuah Khan , shuah , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Hi Linus, Please pull this kselftest fixes update for Linux 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 diff is attached. thanks, -- Shuah ---------------------------------------------------------------- The following changes since commit 9852d85ec9d492ebef56dc5f229416c925758edc: Linux 6.12-rc1 (2024-09-29 15:06:19 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux_kselftest-fixes-6.12-rc2 for you to fetch changes up to c66be905cda24fb782b91053b196bd2e966f95b7: selftests: breakpoints: use remaining time to check if suspend succeed (2024-10-02 14:37:30 -0600) ---------------------------------------------------------------- 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 ---------------------------------------------------------------- Alessandro Zanni (1): kselftest/devices/probe: Fix SyntaxWarning in regex strings for Python3 Ba Jing (1): clone3: clone3_cap_checkpoint_restore: remove unused MAX_PID_NS_LEVEL macro Jason A. Donenfeld (1): selftests: vDSO: align getrandom states to cache line Javier Carrasco (2): selftests: core: add unshare_test to gitignore selftests: exec: update gitignore for load_address Joseph Jang (1): selftest: rtc: Check if could access /dev/rtc0 before testing Shuah Khan (1): selftests:timers: posix_timers: Fix warn_unused_result in __fatal_error() Yifei Liu (1): selftests: breakpoints: use remaining time to check if suspend succeed Yun Lu (1): selftest: hid: add missing run-hid-tools-tests.sh .../testing/selftests/breakpoints/step_after_suspend_test.c | 5 ++++- .../testing/selftests/clone3/clone3_cap_checkpoint_restore.c | 2 -- tools/testing/selftests/core/.gitignore | 1 + .../selftests/devices/probe/test_discoverable_devices.py | 4 ++-- tools/testing/selftests/exec/.gitignore | 3 ++- tools/testing/selftests/hid/Makefile | 2 ++ tools/testing/selftests/rtc/rtctest.c | 11 ++++++++++- tools/testing/selftests/timers/posix_timers.c | 12 ++++++++---- tools/testing/selftests/vDSO/vdso_test_getrandom.c | 8 +++++--- 9 files changed, 34 insertions(+), 14 deletions(-) ---------------------------------------------------------------- diff --git a/tools/testing/selftests/breakpoints/step_after_suspend_test.c b/tools/testing/selftests/breakpoints/step_after_suspend_test.c index dfec31fb9b30..8d275f03e977 100644 --- a/tools/testing/selftests/breakpoints/step_after_suspend_test.c +++ b/tools/testing/selftests/breakpoints/step_after_suspend_test.c @@ -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); diff --git a/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c b/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c index 31b56d625655..3c196fa86c99 100644 --- a/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c +++ b/tools/testing/selftests/clone3/clone3_cap_checkpoint_restore.c @@ -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); diff --git a/tools/testing/selftests/core/.gitignore b/tools/testing/selftests/core/.gitignore index 6e6712ce5817..7999361992aa 100644 --- a/tools/testing/selftests/core/.gitignore +++ b/tools/testing/selftests/core/.gitignore @@ -1 +1,2 @@ close_range_test +unshare_test diff --git a/tools/testing/selftests/devices/probe/test_discoverable_devices.py b/tools/testing/selftests/devices/probe/test_discoverable_devices.py index d94a74b8a054..d7a2bb91c807 100755 --- a/tools/testing/selftests/devices/probe/test_discoverable_devices.py +++ b/tools/testing/selftests/devices/probe/test_discoverable_devices.py @@ -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)) diff --git a/tools/testing/selftests/exec/.gitignore b/tools/testing/selftests/exec/.gitignore index 90c238ba6a4b..a0dc5d4bf733 100644 --- a/tools/testing/selftests/exec/.gitignore +++ b/tools/testing/selftests/exec/.gitignore @@ -9,7 +9,8 @@ execveat.ephemeral execveat.denatured non-regular null-argv -/load_address_* +/load_address.* +!load_address.c /recursion-depth xxxxxxxx* pipe diff --git a/tools/testing/selftests/hid/Makefile b/tools/testing/selftests/hid/Makefile index 72be55ac4bdf..38ae31bb07b5 100644 --- a/tools/testing/selftests/hid/Makefile +++ b/tools/testing/selftests/hid/Makefile @@ -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 diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c index 9647b14b47c5..38a8e67de77d 100644 --- a/tools/testing/selftests/rtc/rtctest.c +++ b/tools/testing/selftests/rtc/rtctest.c @@ -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; } diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index 16bd49492efa..ddb1cebc844e 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -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) diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c index 72a1d9b43a84..e5e83dbec589 100644 --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c @@ -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;