Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1996246rwd; Fri, 2 Jun 2023 03:22:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WGAu2aaT/Y6G+9A8w1v7A7x4KF/ksc4yJAt60L3Ii1ziMzM2JthsoWDzNx3XL15m7gTDb X-Received: by 2002:a17:90a:664a:b0:258:cb10:5e8c with SMTP id f10-20020a17090a664a00b00258cb105e8cmr1885849pjm.20.1685701332993; Fri, 02 Jun 2023 03:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685701332; cv=none; d=google.com; s=arc-20160816; b=YRBdpFrhM5y1iBkFCAVYtWKcpiLePuHOhFxuFx+MwlM5R8MoTuBZU+rms/TaJ6VTO0 yLxC4BEcVC1S2XsYRY4LqW/0N5gKEV+Z3KxoS4wgUCsvWCQOZ2peuJ+/Xa3Loyq4miPK 1eFeuqUClG2sMHdufeh92wGy7juoN1Xy90O29NVl55J7S9f417H/xaD/4pizX9+HqV/L pqERf35KkWJpCeRFmhbZTffNvXEwj8M2G4j3l5OCFiAr5ciAzOrjTgONBqJjob5iu6R6 NW3S2VRV93STxYLddlITig0K0LG5ljgA+EJ4AxR274elG/LB29MDVrJNnV1IFljrjXH3 9CVA== 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=gwuzFK21w1IOUF2ZGdDkpZFWv7+ktlTmNmcMNJTZlNE=; b=GleQHgQ4dqpiPM2CvBSvJ3OeKe12NxQUq43NLWFAOPijH7RHmMqq2MOTOTxCpdBizp cIsjKHg1IWMPEip+Ha0EPXtyLTsBstDFdGiAIrVDARVcSH3Ab633mzNuH4b/wnjy+9fh CcEuoqq3RzFiLLpssP/Se2nFD/HcpUz84vTaw/hICd9Cu5X6ZViYoizJgxGLuvThw6qT 7TrrbzARITU6JdeYtZFX2HChrMw0tGf8oRaRs3brsrNWMnEx/dk6AKL0g3i9Qod8oRws hlK6F/dl3hrnlfQFdLQhP2TE6eP6cQshWfpBIsCgHaYkIIaf40qe5uyN4xC0rIxzLo82 x6tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Uhqp8u1R; 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 b19-20020a639313000000b00542b2e4c96bsi38608pge.475.2023.06.02.03.21.58; Fri, 02 Jun 2023 03:22:12 -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=Uhqp8u1R; 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 S235100AbjFBKI3 (ORCPT + 99 others); Fri, 2 Jun 2023 06:08:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234955AbjFBKIW (ORCPT ); Fri, 2 Jun 2023 06:08:22 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79B4A18D for ; Fri, 2 Jun 2023 03:08:16 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230602100815euoutp023f370ed4b93b7dcaf5adfa3b64f9469f~kz6tXwetc3193731937euoutp02h for ; Fri, 2 Jun 2023 10:08:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230602100815euoutp023f370ed4b93b7dcaf5adfa3b64f9469f~kz6tXwetc3193731937euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685700495; bh=gwuzFK21w1IOUF2ZGdDkpZFWv7+ktlTmNmcMNJTZlNE=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=Uhqp8u1RDGdYhE7p0dUp2DVn2Kl7t38eCw3GIUnA23//WAv00Qo6yz0z/NL7W77Iw NxGeaLro3zsgnBnJrnHtBymiAFNCzuC915usMWxigdc3Ob5AkDzzEnJsO8he/ARi3N gHKsmcoisp/4lelD+SMCGfiie39BZkoJcEFKMcIQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230602100812eucas1p2ee60d116422b859b8b2368dab22a3455~kz6rBxq_m0507505075eucas1p2c; Fri, 2 Jun 2023 10:08:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id D7.20.42423.C8FB9746; Fri, 2 Jun 2023 11:08:12 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230602100812eucas1p14c8b09a24157e24c40b2c1869e2d1c56~kz6qxImmN2168821688eucas1p1A; Fri, 2 Jun 2023 10:08:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230602100812eusmtrp14d669053a0b08bb228c50ede5f255c56~kz6qwdEFe1804218042eusmtrp1E; Fri, 2 Jun 2023 10:08:12 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-b0-6479bf8c0d34 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 2A.34.14344.C8FB9746; Fri, 2 Jun 2023 11:08:12 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230602100812eusmtip16688d6ac326554b917db77ef42572fa8~kz6qlNGQ53205432054eusmtip17; Fri, 2 Jun 2023 10:08:12 +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 11:08:11 +0100 From: Joel Granados To: CC: , , , Joel Granados Subject: [PATCH 2/8] test_sysctl: Fix test metadata getters Date: Fri, 2 Jun 2023 12:07:59 +0200 Message-ID: <20230602100805.777917-3-j.granados@samsung.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230602100805.777917-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+NgFvrGIsWRmVeSWpSXmKPExsWy7djP87o9+ytTDFpmGVjs2XuSxeLyrjls FtPvvGezuDHhKaMDi8emVZ1sHp83yQUwRXHZpKTmZJalFunbJXBlPL3+jblgq1DF3b4tTA2M 3fxdjJwcEgImEktenmUBsYUEVjBKvLmU2MXIBWR/YZR4eOUyM0TiM6PE+gv2MA3vP59kgiha ziix7+98ZggHqGjOnF42CGcLo8SebR/B2tkEdCTOv7kDZosIiEucOL2ZEcRmFpjAKDHrEAeI LSxgLTFnZS87iM0ioCJxeO9hMJtXwEbiUctHNojV8hJt16eD9XIK2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Eof3HgazeQVsJB61fITaLC/R dn06WC+ngK3EshlPmUBsIaCa848mMUPUC0qcnPmEBWK+vETz1tnMELaExMEXL5gh5ihLTFj3 G+qDWonPf58xTmAUmYWkfRaS9llI2hcwMq9iFEktLc5Nzy020itOzC0uzUvXS87P3cQIjKlt x35u2cG48tVHvUOMTByMhxglOJiVRHiFwspThHhTEiurUovy44tKc1KLDzGaAv05kVlKNDkf GNV5JfGGZgamhiZmlgamlmbGSuK8ngUdiUIC6YklqdmpqQWpRTB9TBycUg1MM5k5VhW77Z5n re09S3mPIOvifwFs86cc/vpk705PwzXz5WcvSvfexcTG+HKWM/OuksX3Di+9MSnfd88zV9WK 6pOp08rr5gZ4FXZUHon4/ON2e+WDB665x/ZdfvzFa7Pn+4d/jm67Nf3CrOtiX00O+8Ts/PnZ TvvO0pj9J1PtvrXMfyy42vk8h5rSJsUJ/yOEq2pu9N3bkLSUN+8mqxvvtsMW5p+6z3vLV9qe mHhYQnje/TLZwlvt7+++vXjdbOH8F1Z2Vg+P5EdPvnLxWPN+d4vEZQ89slKO6GTEBZnWTQ6J /i1c/eFtRdScuDmHVm40dghrTZQ2/Vy6flbeozNNETqzXRwOiBwSX3jxkFJJzQ8lluKMREMt 5qLiRAAr5LtRMgMAAA== X-CMS-MailID: 20230602100812eucas1p14c8b09a24157e24c40b2c1869e2d1c56 X-Msg-Generator: CA X-RootMTR: 20230602100812eucas1p14c8b09a24157e24c40b2c1869e2d1c56 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230602100812eucas1p14c8b09a24157e24c40b2c1869e2d1c56 References: <20230602100805.777917-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 The functions get_test_{count,enabled,target} use awk to get the N'th field in the ALL_TESTS variable. A variable with leading zeros (e.g. 0009) is misinterpreted as an entire line instead of the N'th field. Remove the leading zeros so this does not happen. We can now use the helper in tests 6, 7 and 8. Signed-off-by: Joel Granados --- tools/testing/selftests/sysctl/sysctl.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh index bfc54b422f25..cb8f83dfe16b 100755 --- a/tools/testing/selftests/sysctl/sysctl.sh +++ b/tools/testing/selftests/sysctl/sysctl.sh @@ -730,7 +730,7 @@ sysctl_test_0005() sysctl_test_0006() { - TARGET="${SYSCTL}/bitmap_0001" + TARGET="${SYSCTL}/$(get_test_target 0006)" reset_vals ORIG="" run_bitmaptest @@ -738,7 +738,7 @@ sysctl_test_0006() sysctl_test_0007() { - TARGET="${SYSCTL}/boot_int" + TARGET="${SYSCTL}/$(get_test_target 0007)" if [ ! -f $TARGET ]; then echo "Skipping test for $TARGET as it is not present ..." return $ksft_skip @@ -778,7 +778,7 @@ sysctl_test_0007() sysctl_test_0008() { - TARGET="${SYSCTL}/match_int" + TARGET="${SYSCTL}/$(get_test_target 0008)" if [ ! -f $TARGET ]; then echo "Skipping test for $TARGET as it is not present ..." return $ksft_skip @@ -857,25 +857,32 @@ function test_num() usage fi } +function remove_leading_zeros() +{ + echo $1 | sed 's/^0*//' +} function get_test_count() { test_num $1 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') + awk_field=$(remove_leading_zeros $1) + TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$awk_field'}') echo ${TEST_DATA} | awk -F":" '{print $2}' } function get_test_enabled() { test_num $1 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') + awk_field=$(remove_leading_zeros $1) + TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$awk_field'}') echo ${TEST_DATA} | awk -F":" '{print $3}' } function get_test_target() { test_num $1 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') + awk_field=$(remove_leading_zeros $1) + TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$awk_field'}') echo ${TEST_DATA} | awk -F":" '{print $4}' } -- 2.30.2