Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2309303rwd; Fri, 16 Jun 2023 02:05:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6xU3JIVM2DlKWWGBXCF/gLglEi5fsYfeRLzpgvR6MLxPwLfV42RDZPzz1aklB5CCEug+3O X-Received: by 2002:a05:6358:45e:b0:12f:18f0:611e with SMTP id 30-20020a056358045e00b0012f18f0611emr1002087rwe.13.1686906348103; Fri, 16 Jun 2023 02:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686906348; cv=none; d=google.com; s=arc-20160816; b=Nw9MO8CnUq79bmPv3rQkthhI00BBofOCqyjjfYyJyVJ8/EN0tfi4BwKAAXjyqPi66g juNA5CnZppGOgBARfM6roi3qIS0cYK6SmgprcPxBkFJC/GcO5Kyfg7GCySVAY/r0K91h crHkTvgtIqqmp0u7XywxYOLyIP0vDTtFS5S1C86nuwmw/qV9tZ0JN2V5uRI6TugjuZQw hEF236kepqQk6caMJph1tUaDA3Ej7/vEM74N12b5NDOObJstNjJ+bTT0553TLrnC8TQJ vRHchCS+uTLyzIeyFR93ACseqdgwPT5pt2whpB4+vzymtXLlEv8Rd2qGXAGTGPyvHfcR PKjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=bxclUZv9jPrQ5jKcyYEbND/Krq83dxgsRJ8rzENWdE8=; b=bm/gM8V1n/RFeblR6ZeKPHMbB6g1rAP/nzFInZca0YXN2YOL4Ojw1GBp0aW1JUg6kj g/N+YNJ1XAf4qxta5ctnbUCgYHCGA9+dyyh7pFbFnjTKm3RYZvkjcnkG4YH2TRdSNQw+ eW/i2Zh+U76p+t6C13iXVX9e+XLeUmzMpc+hQxaHcwzDci/S4WZyk0oKgLv0RwrLAOuI 8SnMUAjQ0qklL/ngaKQmIxkE7PbpoT8W1w1RFiCb9XXblGrV9DvygjhKXyNeuzNHoQ3O 3UgkG2I6A032jHwLAL0vD4pqRRVHUqlQxRNxaryyAoprLVTCyswZJqyS/4C2ZkOfyzLv 5X7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=axotJ3q9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p29-20020a637f5d000000b0053481a225desi1752836pgn.340.2023.06.16.02.05.36; Fri, 16 Jun 2023 02:05:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=axotJ3q9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344075AbjFPJA6 (ORCPT + 99 others); Fri, 16 Jun 2023 05:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343872AbjFPI7t (ORCPT ); Fri, 16 Jun 2023 04:59:49 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC4BD30CD for ; Fri, 16 Jun 2023 01:59:38 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230616085937euoutp029c01873b59fac2edaab877c499fc144f~pGAyMu_QL3174431744euoutp02b for ; Fri, 16 Jun 2023 08:59:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230616085937euoutp029c01873b59fac2edaab877c499fc144f~pGAyMu_QL3174431744euoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686905977; bh=bxclUZv9jPrQ5jKcyYEbND/Krq83dxgsRJ8rzENWdE8=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=axotJ3q9jypT/P70UZod6ZYCnJKI3b7eew1unLG9EFfIT2BpiziHXtpd1MKziIcTh 0ZOEvtXkjJqaQ0SLaNxV4JfO/gAjFkkLGc2UZOtVVpCozDTBfduMV+K69FuFP9NwEh HPlqMHci/IPTlw3sCMkhqL1Vqv4tVQk0hJd/JKeM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230616085937eucas1p2049999b954d45f4ea4c8bb141d303b2b~pGAyHQPra1525715257eucas1p2Y; Fri, 16 Jun 2023 08:59:37 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 1D.C4.11320.9742C846; Fri, 16 Jun 2023 09:59:37 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230616085937eucas1p2128b2ddb3c01c887a606f376de850767~pGAxw7LIy1755217552eucas1p2B; Fri, 16 Jun 2023 08:59:37 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230616085937eusmtrp18f4a6e5e8bc6988652294b0a7480e8bc~pGAxwYBGj0876708767eusmtrp1R; Fri, 16 Jun 2023 08:59:37 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-51-648c2479a117 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B9.2B.10549.9742C846; Fri, 16 Jun 2023 09:59:37 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230616085936eusmtip26d75365940dfa4d7f6bbbc981595f2bb~pGAxmWPUB1986419864eusmtip2-; Fri, 16 Jun 2023 08:59:36 +0000 (GMT) Received: from localhost (106.210.248.231) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 16 Jun 2023 09:59:36 +0100 From: Joel Granados To: CC: , , , Joel Granados Subject: [PATCH v2 5/8] test_sysctl: Add an option to prevent test skip Date: Fri, 16 Jun 2023 10:59:19 +0200 Message-ID: <20230616085922.3066990-6-j.granados@samsung.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230616085922.3066990-1-j.granados@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [106.210.248.231] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsWy7djP87qVKj0pBu+apCz27D3JYnF51xw2 i+l33rNZ3JjwlNGBxWPTqk42j8+b5AKYorhsUlJzMstSi/TtErgyVtztZin4J1ux7tJTtgbG +xJdjJwcEgImEltbWtm6GLk4hARWMEp8WPmYHcL5wijxb9kLZgjnM6NE45edjDAt8+ZdY4FI LGeUWLlrPhtc1f7++VD9WxklDk1sYwFpYRPQkTj/5g4ziC0iIC5x4vRmsFHMAhMYJWYd4gCx hQXcJY7N3gJWzyKgKvHn5EYmEJtXwFbiwOHtzBCr5SXark8H6+UUsJN4P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awbbwCthIHDm9nhtgm L9F2fTpYL6eAncTjSQ1g84WAahpv97ND1AtKnJz5hAVivrxE89bZzBC2hMTBFy+AbA6gOcoS n54nQIyslfj89xnjBEaRWUi6ZyHpnoWkewEj8ypGkdTS4tz03GJDveLE3OLSvHS95PzcTYzA iNp27OfmHYzzXn3UO8TIxMF4iFGCg1lJhHfZia4UId6UxMqq1KL8+KLSnNTiQ4ymQG9OZJYS Tc4HxnReSbyhmYGpoYmZpYGppZmxkjivZ0FHopBAemJJanZqakFqEUwfEwenVAOT+qrqeTH1 uTLdzQ4rmwyyrOO2Pi4NO/bxfuX9yzK/e6au4+bYE8NfOWWnyIdbi4tkVFNVPKNdo67e5y36 s6hS+k0p55+77ofDrn2d8pexZe7NHPZlDL0Jl3Zz/jo75XNh5a3tcmITK7/kqnQs91L+M3OK yrPabPkz56e4yp5cfoFT5Hrnqpb5sZyxU8oellofCgrc9svYk/ecMX96dGfgm3mpQa3iEfv6 X2kv84w9KTnJIYFP4UKOSYTa1C/r9xgvZ2WPU34/8cG1OZJFF/k3pq8NuOr5q+nJ9JPLDu+Y vtIgJPzgihsCMrrXNrOxu8ls3vbo7snGa1P4V+96seD1mjXzV8scCD9yfmV3/iK3TCWW4oxE Qy3mouJEAPuksBIxAwAA X-CMS-MailID: 20230616085937eucas1p2128b2ddb3c01c887a606f376de850767 X-Msg-Generator: CA X-RootMTR: 20230616085937eucas1p2128b2ddb3c01c887a606f376de850767 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230616085937eucas1p2128b2ddb3c01c887a606f376de850767 References: <20230616085922.3066990-1-j.granados@samsung.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tests were being skipped because the target was not present. Add a flag that controls whether to skip a test based on the presence of the target. Actually skip tests in the test_case function with a "return" instead of a "continue". Signed-off-by: Joel Granados --- tools/testing/selftests/sysctl/sysctl.sh | 66 ++++++++++++++++-------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh index a6d79d7a36e4..9c0e9711138b 100755 --- a/tools/testing/selftests/sysctl/sysctl.sh +++ b/tools/testing/selftests/sysctl/sysctl.sh @@ -14,24 +14,26 @@ TEST_FILE=$(mktemp) # This represents # -# TEST_ID:TEST_COUNT:ENABLED:TARGET +# TEST_ID:TEST_COUNT:ENABLED:TARGET:SKIP_NO_TARGET # # TEST_ID: is the test id number # TEST_COUNT: number of times we should run the test # ENABLED: 1 if enabled, 0 otherwise # TARGET: test target file required on the test_sysctl module +# SKIP_NO_TARGET: 1 skip if TARGET not there +# 0 run eventhough TARGET not there # # Once these are enabled please leave them as-is. Write your own test, # we have tons of space. -ALL_TESTS="0001:1:1:int_0001" -ALL_TESTS="$ALL_TESTS 0002:1:1:string_0001" -ALL_TESTS="$ALL_TESTS 0003:1:1:int_0002" -ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001" -ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003" -ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001" -ALL_TESTS="$ALL_TESTS 0007:1:1:boot_int" -ALL_TESTS="$ALL_TESTS 0008:1:1:match_int" -ALL_TESTS="$ALL_TESTS 0009:1:1:unregister_error" +ALL_TESTS="0001:1:1:int_0001:1" +ALL_TESTS="$ALL_TESTS 0002:1:1:string_0001:1" +ALL_TESTS="$ALL_TESTS 0003:1:1:int_0002:1" +ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001:1" +ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003:1" +ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001:1" +ALL_TESTS="$ALL_TESTS 0007:1:1:boot_int:1" +ALL_TESTS="$ALL_TESTS 0008:1:1:match_int:1" +ALL_TESTS="$ALL_TESTS 0009:1:1:unregister_error:0" function allow_user_defaults() { @@ -614,7 +616,6 @@ target_exists() TEST_ID="$2" if [ ! -f ${TARGET} ] ; then - echo "Target for test $TEST_ID: $TARGET not exist, skipping test ..." return 0 fi return 1 @@ -902,16 +903,36 @@ function get_test_target() echo ${TEST_DATA} | awk -F":" '{print $4}' } +function get_test_skip_no_target() +{ + test_num $1 + awk_field=$(remove_leading_zeros $1) + TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$awk_field'}') + echo ${TEST_DATA} | awk -F":" '{print $5}' +} + +function skip_test() +{ + TEST_ID=$1 + TEST_TARGET=$2 + if target_exists $TEST_TARGET $TEST_ID; then + TEST_SKIP=$(get_test_skip_no_target $TEST_ID) + if [[ $TEST_SKIP -eq "1" ]]; then + echo "Target for test $TEST_ID: $TEST_TARGET not exist, skipping test ..." + return 0 + fi + fi + return 1 +} + function run_all_tests() { for i in $ALL_TESTS ; do - TEST_ID=${i%:*:*:*} + TEST_ID=${i%:*:*:*:*} ENABLED=$(get_test_enabled $TEST_ID) TEST_COUNT=$(get_test_count $TEST_ID) TEST_TARGET=$(get_test_target $TEST_ID) - if target_exists $TEST_TARGET $TEST_ID; then - continue - fi + if [[ $ENABLED -eq "1" ]]; then test_case $TEST_ID $TEST_COUNT $TEST_TARGET fi @@ -946,18 +967,19 @@ function watch_case() function test_case() { + TEST_ID=$1 NUM_TESTS=$2 + TARGET=$3 - i=0 - - if target_exists $3 $1; then - continue + if skip_test $TEST_ID $TARGET; then + return fi + i=0 while [ $i -lt $NUM_TESTS ]; do - test_num $1 - watch_log $i ${TEST_NAME}_test_$1 noclear - RUN_TEST=${TEST_NAME}_test_$1 + test_num $TEST_ID + watch_log $i ${TEST_NAME}_test_${TEST_ID} noclear + RUN_TEST=${TEST_NAME}_test_${TEST_ID} $RUN_TEST let i=$i+1 done -- 2.30.2