From patchwork Fri Jun 2 11:06:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Granados X-Patchwork-Id: 13265114 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 7884DC7EE2C for ; Fri, 2 Jun 2023 11:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235897AbjFBLHg (ORCPT ); Fri, 2 Jun 2023 07:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235846AbjFBLH0 (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 756DEE42 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 20230602110651euoutp02aa6c490559bc46be20ca1133ed332ec5~k0t3x3g6k3126531265euoutp02G for ; Fri, 2 Jun 2023 11:06:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230602110651euoutp02aa6c490559bc46be20ca1133ed332ec5~k0t3x3g6k3126531265euoutp02G 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 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+L1xFTPEanmJtuvTGUFsTgFbiUOnz7BB1AhK nJz5BGwMM1BN89bZzBC2hMTBFy+gepUlJqz7zQph10qc2nKLCeQGCYEDHBLH5nQxQSRcJJr2 zmGEsIUlXh3fAvWzjMTpyT0sEA2TGSX2//vADuGsZpRY1vgVqttaouXKE6gOR4kPU1rZQL6R EOCTuPFWEOIiPolJ26YzQ4R5JTrahCYwqsxC8sMsJD/MQvLDAkbmVYziqaXFuempxYZ5qeV6 xYm5xaV56XrJ+bmbGIGJ4/S/4592MM599VHvECMTB+MhRgkOZiURXqGw8hQh3pTEyqrUovz4 otKc1OJDjNIcLErivNq2J5OFBNITS1KzU1MLUotgskwcnFINTLM+HwoWFrIwOnY8/Jaawkwv 3W+lfx8yLxbwsPy7vzP3TeP5s9ksLIWG7kcrj8Re31cu0fyIb+L5GQFrdtjeDhYWnqG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tiH2JPbk3NXCxYYPNta/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> Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@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