From patchwork Mon Sep 11 17:24:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13379947 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B4E5CA0EC0 for ; Mon, 11 Sep 2023 21:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345411AbjIKVUT (ORCPT ); Mon, 11 Sep 2023 17:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243612AbjIKRYM (ORCPT ); Mon, 11 Sep 2023 13:24:12 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC02F5 for ; Mon, 11 Sep 2023 10:24:04 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-77dcff76e35so54673339f.1 for ; Mon, 11 Sep 2023 10:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1694453044; x=1695057844; darn=vger.kernel.org; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=sphhBNof8zq1/caB4nqaNWdPiAfc/xDFKkO3FH9aqFw=; b=FAalRym1fnQhG167KJjjqHUA5oDh7BuYJrCUoAo2zpeSzDPNUb5tDtRsNezXqTq3Jb +RwGU1/bjIcHblaQQ25SNvEGYr/28Gf6wgnJtZYMNEZgX6O+Hdyg2dMlQl99xxj2Dz16 3K5lWSj7pF6h+ntJ6a3gT79WaMSGK/2CqnAqY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694453044; x=1695057844; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sphhBNof8zq1/caB4nqaNWdPiAfc/xDFKkO3FH9aqFw=; b=CrUeI9v6hrB/YVDifMosE2JdQ8vwScEGLJwDlde40quE9ew66E1FRjI4qN4+rzFK/K EgA4W+xG6HnuiDrFmC/Th5WL7C74K6zrkRykUTlRxpfpHcOSsurEcYmbtwNIopxgdvKd 2Jt+KFnq3EeOefA03mTC/UvY++S10ZUXcrF4ojaQIVJvPQr8NlO99jOjXKmO9M9iCNkn d67JihiiNPsEHJEFJzY4TIIgwFX9UJK8XwDBtGKRpTAG09zJ6RK8oA7WDjnyROiO/wi/ yzYuTWrmFY/SC4nPcrEZKlJCBvD7n1HQ2+KAmWCWJZ9Loj2pNgvwyJlqChZkpVsTjZLi ax6w== X-Gm-Message-State: AOJu0Ywtgky2cd+aQfuXQfW5EO/BwOlSTa14CdUCIcNh0jjqDd8ST/Eo +zdLyAmx/rHQilGQ3hSmOU+A/z1HBQ6tpRth71M= X-Google-Smtp-Source: AGHT+IFbPp+CfbE1tmZWB+A8e6PyXi82Tle2mAGJx5YIB6jIjrlb44dzOhAyXsLG8p3bV2QyoQByDQ== X-Received: by 2002:a05:6e02:60d:b0:345:e438:7381 with SMTP id t13-20020a056e02060d00b00345e4387381mr11302429ils.2.1694453043753; Mon, 11 Sep 2023 10:24:03 -0700 (PDT) Received: from [192.168.1.128] ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id x16-20020a920610000000b0034f3faebfddsm552048ilg.77.2023.09.11.10.24.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Sep 2023 10:24:03 -0700 (PDT) Message-ID: Date: Mon, 11 Sep 2023 11:24:02 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Content-Language: en-US To: Linus Torvalds Cc: shuah , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org From: Shuah Khan Subject: [GIT PULL] Kselftest fixes update for Linux 6.6-rc2 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Hi Linus, Please pull the following Kselftest fixes update for Linux 6.6-rc2. This kselftest fixes update for Linux 6.6-rc2 consists of fixes -- kselftest runner script to propagate SIGTERM to runner child to avoid kselftest hang. -- to install symlinks required for test execution to avoid test failures. -- kselftest dependency checker script argument parsing. diff is attached. thanks, -- Shuah ---------------------------------------------------------------- The following changes since commit 9b1db732866bee060b9bca9493e5ebf5e8874c48: selftests: cachestat: use proper syscall number macro (2023-08-16 11:12:44 -0600) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-next-6.6-rc2 for you to fetch changes up to 3f3f384139ed147c71e1d770accf610133d5309b: selftests: Keep symlinks, when possible (2023-09-08 10:06:56 -0600) ---------------------------------------------------------------- linux-kselftest-next-6.6-rc2 This kselftest fixes update for Linux 6.6-rc2 consists of fixes -- kselftest runner script to propagate SIGTERM to runner child to avoid kselftest hang. -- to install symlinks required for test execution to avoid test failures. -- kselftest dependency checker script argument parsing. ---------------------------------------------------------------- Björn Töpel (2): kselftest/runner.sh: Propagate SIGTERM to runner child selftests: Keep symlinks, when possible Ricardo B. Marliere (1): selftests: fix dependency checker script Zheng Yejian (1): selftests/ftrace: Correctly enable event in instance-event.tc .../ftrace/test.d/instances/instance-event.tc | 2 +- tools/testing/selftests/kselftest/runner.sh | 3 +- tools/testing/selftests/kselftest_deps.sh | 77 ++++++++++++++++++---- tools/testing/selftests/lib.mk | 4 +- 4 files changed, 70 insertions(+), 16 deletions(-) ---------------------------------------------------------------- diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc index 0eb47fbb3f44..42422e425107 100644 --- a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc +++ b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc @@ -39,7 +39,7 @@ instance_read() { instance_set() { while :; do - echo 1 > foo/events/sched/sched_switch + echo 1 > foo/events/sched/sched_switch/enable done 2> /dev/null } diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh index 1c952d1401d4..70e0a465e30d 100644 --- a/tools/testing/selftests/kselftest/runner.sh +++ b/tools/testing/selftests/kselftest/runner.sh @@ -36,7 +36,8 @@ tap_timeout() { # Make sure tests will time out if utility is available. if [ -x /usr/bin/timeout ] ; then - /usr/bin/timeout --foreground "$kselftest_timeout" $1 + /usr/bin/timeout --foreground "$kselftest_timeout" \ + /usr/bin/timeout "$kselftest_timeout" $1 else $1 fi diff --git a/tools/testing/selftests/kselftest_deps.sh b/tools/testing/selftests/kselftest_deps.sh index 4bc14d9e8ff1..de59cc8f03c3 100755 --- a/tools/testing/selftests/kselftest_deps.sh +++ b/tools/testing/selftests/kselftest_deps.sh @@ -46,11 +46,11 @@ fi print_targets=0 while getopts "p" arg; do - case $arg in - p) + case $arg in + p) print_targets=1 shift;; - esac + esac done if [ $# -eq 0 ] @@ -92,6 +92,10 @@ pass_cnt=0 # Get all TARGETS from selftests Makefile targets=$(grep -E "^TARGETS +|^TARGETS =" Makefile | cut -d "=" -f2) +# Initially, in LDLIBS related lines, the dep checker needs +# to ignore lines containing the following strings: +filter="\$(VAR_LDLIBS)\|pkg-config\|PKG_CONFIG\|IOURING_EXTRA_LIBS" + # Single test case if [ $# -eq 2 ] then @@ -100,6 +104,8 @@ then l1_test $test l2_test $test l3_test $test + l4_test $test + l5_test $test print_results $1 $2 exit $? @@ -113,7 +119,7 @@ fi # Append space at the end of the list to append more tests. l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \ - grep -v "VAR_LDLIBS" | awk -F: '{print $1}') + grep -v "$filter" | awk -F: '{print $1}' | uniq) # Level 2: LDLIBS set dynamically. # @@ -126,7 +132,7 @@ l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \ # Append space at the end of the list to append more tests. l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \ - grep -v "VAR_LDLIBS" | awk -F: '{print $1}') + grep -v "$filter" | awk -F: '{print $1}' | uniq) # Level 3 # memfd and others use pkg-config to find mount and fuse libs @@ -138,11 +144,32 @@ l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \ # VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null) l3_tests=$(grep -r --include=Makefile "^VAR_LDLIBS" | \ - grep -v "pkg-config" | awk -F: '{print $1}') + grep -v "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq) -#echo $l1_tests -#echo $l2_1_tests -#echo $l3_tests +# Level 4 +# some tests may fall back to default using `|| echo -l` +# if pkg-config doesn't find the libs, instead of using VAR_LDLIBS +# as per level 3 checks. +# e.g: +# netfilter/Makefile +# LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl) +l4_tests=$(grep -r --include=Makefile "^LDLIBS" | \ + grep "pkg-config\|PKG_CONFIG" | awk -F: '{print $1}' | uniq) + +# Level 5 +# some tests may use IOURING_EXTRA_LIBS to add extra libs to LDLIBS, +# which in turn may be defined in a sub-Makefile +# e.g.: +# mm/Makefile +# $(OUTPUT)/gup_longterm: LDLIBS += $(IOURING_EXTRA_LIBS) +l5_tests=$(grep -r --include=Makefile "LDLIBS +=.*\$(IOURING_EXTRA_LIBS)" | \ + awk -F: '{print $1}' | uniq) + +#echo l1_tests $l1_tests +#echo l2_tests $l2_tests +#echo l3_tests $l3_tests +#echo l4_tests $l4_tests +#echo l5_tests $l5_tests all_tests print_results $1 $2 @@ -164,24 +191,32 @@ all_tests() for test in $l3_tests; do l3_test $test done + + for test in $l4_tests; do + l4_test $test + done + + for test in $l5_tests; do + l5_test $test + done } # Use same parsing used for l1_tests and pick libraries this time. l1_test() { test_libs=$(grep --include=Makefile "^LDLIBS" $test | \ - grep -v "VAR_LDLIBS" | \ + grep -v "$filter" | \ sed -e 's/\:/ /' | \ sed -e 's/+/ /' | cut -d "=" -f 2) check_libs $test $test_libs } -# Use same parsing used for l2__tests and pick libraries this time. +# Use same parsing used for l2_tests and pick libraries this time. l2_test() { test_libs=$(grep --include=Makefile ": LDLIBS" $test | \ - grep -v "VAR_LDLIBS" | \ + grep -v "$filter" | \ sed -e 's/\:/ /' | sed -e 's/+/ /' | \ cut -d "=" -f 2) @@ -197,6 +232,24 @@ l3_test() check_libs $test $test_libs } +l4_test() +{ + test_libs=$(grep --include=Makefile "^VAR_LDLIBS\|^LDLIBS" $test | \ + grep "\(pkg-config\|PKG_CONFIG\).*|| echo " | \ + sed -e 's/.*|| echo //' | sed -e 's/)$//') + + check_libs $test $test_libs +} + +l5_test() +{ + tests=$(find $(dirname "$test") -type f -name "*.mk") + test_libs=$(grep "^IOURING_EXTRA_LIBS +\?=" $tests | \ + cut -d "=" -f 2) + + check_libs $test $test_libs +} + check_libs() { diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index d17854285f2b..118e0964bda9 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -106,7 +106,7 @@ endef run_tests: all ifdef building_out_of_srctree @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \ - rsync -aLq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \ + rsync -aq --copy-unsafe-links $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \ fi @if [ "X$(TEST_PROGS)" != "X" ]; then \ $(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) \ @@ -120,7 +120,7 @@ endif define INSTALL_SINGLE_RULE $(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH)) - $(if $(INSTALL_LIST),rsync -aL $(INSTALL_LIST) $(INSTALL_PATH)/) + $(if $(INSTALL_LIST),rsync -a --copy-unsafe-links $(INSTALL_LIST) $(INSTALL_PATH)/) endef define INSTALL_RULE