Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2042886rwd; Fri, 2 Jun 2023 04:09:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6XuoCNi7bDkAnLRPhcc4nX7XAEJdDFRRvhjXxqBYzDZ6YtRJarRSEq6LJR/2vA1lQgTbyh X-Received: by 2002:a05:6358:c4a5:b0:127:f2b5:dd81 with SMTP id fg37-20020a056358c4a500b00127f2b5dd81mr725670rwb.1.1685704199376; Fri, 02 Jun 2023 04:09:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685704199; cv=none; d=google.com; s=arc-20160816; b=OKkhHDAAFLN0PsV6acMikXdMCOxyyiKjOZY8xK3vCmkeQg0i1N/ddtJsVx8gLgDT2F H0sejI5mn/qNm38o8saMDgYW0IpV2+lAPVIi8FY7JY71ER9qK8vPLtf7H62pai51Pe23 DK6v3rRY3vZI8WCAZcNFJ2Vr/JlcO/LHU4/p5rMwxlRCfwa5403c7hWdidQBaCTqMmjD okOPl8bWmiekwvWCqrc2wzSRlpKH2OV7G9/aT9dJIvvT3D48unl0sBYkGHJQSjOFmUbK QUYeGeD6Ok895VL7xzDb2RTZdyOC7CzKvHHhFOcfHq0ONGaA436l7HW97QXYu9SuFXQl 6skA== 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=PHeIs4NBvqSgknu75mJWi1WRQmQP5evFfohQHLomRent81HUwux1K/EmHI9+sjdJdp aBvJHwO5FUdOp5HgLYRq8fNCaGC1EzT6l1kCUlC3w1WZizE/ScOvX7iVOOmRptksgNEU f9a86dH3A3BKF/4O2LEY9feecq2JZ8p98KLtG0bOjG7+zatznBXlCBt8LAYF86qQvZUH cZmVxZuW+AiX1H19h9Q6pIYQLWNmOE+nvsdemmqJlivkdCmMPlvi2EzViSOailVcIUmS Xx5XufCMDWEVSTX/EWO3atRSN7iATCLaImjANjHbbgkGRjgYjvwpvSzAx4ztDipp1/7A taLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=nwgMTkPt; 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 19-20020a631753000000b005414815747fsi792739pgx.680.2023.06.02.04.09.45; Fri, 02 Jun 2023 04:09:59 -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=nwgMTkPt; 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 S234833AbjFBLHj (ORCPT + 99 others); Fri, 2 Jun 2023 07:07:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235849AbjFBLH0 (ORCPT ); Fri, 2 Jun 2023 07:07:26 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73709E40 for ; Fri, 2 Jun 2023 04:07:01 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230602110651euoutp02d7d7db1fbfff4a8890a6f7f03a510f46~k0t3xsNTK2929029290euoutp02t for ; Fri, 2 Jun 2023 11:06:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230602110651euoutp02d7d7db1fbfff4a8890a6f7f03a510f46~k0t3xsNTK2929029290euoutp02t DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685704011; bh=bxclUZv9jPrQ5jKcyYEbND/Krq83dxgsRJ8rzENWdE8=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=nwgMTkPtOstQSgGbGvbFM77EiUqy78EItNzVChb35/ko9FezeXJDwfuzh3zsT9UG5 GMaQ6JYATiSCwlPEcdUn3xfNCf28D2lWPFNpALNWAPJH6/q0LFXlDD+hxQkpsTECHe CM+eAYQSWOfOX/3X4UJIWkE1LlYfuf186vPUzeAI= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230602110651eucas1p14e20bc6236c10d4fc8d6e271e60ffb79~k0t3rdCIa0212702127eucas1p1a; Fri, 2 Jun 2023 11:06:51 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 78.6A.42423.B4DC9746; Fri, 2 Jun 2023 12:06:51 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230602110650eucas1p1e04fdac1151ed028d1d081cf30433174~k0t3Ycr2b2548925489eucas1p1m; Fri, 2 Jun 2023 11:06:50 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230602110650eusmtrp124d79e1d2067604f7bd0bfd887a8c663~k0t3X77E72194821948eusmtrp1o; Fri, 2 Jun 2023 11:06:50 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-44-6479cd4bf821 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EB.A9.10549.A4DC9746; Fri, 2 Jun 2023 12:06:50 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230602110650eusmtip2aef1f882657ce0c13324aa492ba559cd~k0t3NbY5X0430104301eusmtip23; Fri, 2 Jun 2023 11:06:50 +0000 (GMT) Received: from localhost (106.210.248.205) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 2 Jun 2023 12:06:50 +0100 From: Joel Granados To: CC: , , , Joel Granados Subject: [PATCH 5/8] test_sysctl: Add an option to prevent test skip Date: Fri, 2 Jun 2023 13:06:35 +0200 Message-ID: <20230602110638.789426-6-j.granados@samsung.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230602110638.789426-1-j.granados@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [106.210.248.205] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBIsWRmVeSWpSXmKPExsWy7djPc7reZytTDI7+ZLHYs/cki8XlXXPY LKbfec9mcWPCU0YHFo9NqzrZPD5vkgtgiuKySUnNySxLLdK3S+DKWHG3m6Xgn2zFuktP2RoY 70t0MXJySAiYSHRd3cfcxcjFISSwglHiUusGdgjnC6PE1i/fWCCcz4wSU5dOYYdpaTjykQ0i sZxRovfWNna4qlmNO1khnC2MEo8+rAJrYRPQkTj/5g4ziC0iIC5x4vRmRpAiZoEJjBJ9636x gCSEBVwkelp/MXUxcnCwCKhIHPljAhLmFbCR+L1xFTPEanmJtuvTGUFsTgF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UxcnCwCKhIHPljAhLmFbCR+L1xFTPE NnmJtuvTwWZyCthKHDp9Buo6G4n1Zy6wQ9QLSpyc+QRsJDNQffPW2cwQtoTEwRcvoOYoS0xY 9xvqg1qJz3+fMU5gFJmFpH0WkvZZSNoXMDKvYhRJLS3OTc8tNtQrTswtLs1L10vOz93ECIyo bcd+bt7BOO/VR71DjEwcjIcYJTiYlUR4hcLKU4R4UxIrq1KL8uOLSnNSiw8xmgK9OZFZSjQ5 HxjTeSXxhmYGpoYmZpYGppZmxkrivJ4FHYlCAumJJanZqakFqUUwfUwcnFINTBZSoqvcHsT/ XLtnkWSSicn+iwuSO5n4XnuFSl7fFlsR99T+jcv+pdfXl64XyvxtJqgcZzP9YPHCin+Zy29a OnCoiW+tvcInJHR1T9SBf8EBVd+nf/pqnRq94X5PgtiH2JPbk3NXCxYYPNta/nqx37Npcckc 5z5tebIvzvjvj7yuqIYcD6lthy/pW61rdNIOfRwzmdn4yf3V0TJTHC5suT2tcrFrgkLiW7kt 0spp1bKPNZqmfVBz2LdNSjJY/n3o7H8ftM8tj5fsvGGrl227nsG8jmWmbehxdyapbzvuc6/6 o+cyfVfYFuY5/UaT38yW50p1scq4HVjN7atyuIPRi/Va4u0jhQu0567YFqVSpMRSnJFoqMVc VJwIAMNhuCYxAwAA X-CMS-MailID: 20230602110650eucas1p1e04fdac1151ed028d1d081cf30433174 X-Msg-Generator: CA X-RootMTR: 20230602110650eucas1p1e04fdac1151ed028d1d081cf30433174 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230602110650eucas1p1e04fdac1151ed028d1d081cf30433174 References: <20230602110638.789426-1-j.granados@samsung.com> X-Spam-Status: No, score=-7.3 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