Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1150554ybh; Sat, 14 Mar 2020 19:26:51 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvmDJxZcRV1WKZ/XavRVkQ5ECoNvAsZqkC/xTbx6lcLXT1/13CKjvqNn0QfuYoqk4j1m70D X-Received: by 2002:a54:480f:: with SMTP id j15mr1690179oij.178.1584239210937; Sat, 14 Mar 2020 19:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584239210; cv=none; d=google.com; s=arc-20160816; b=lbUggpqSPCeNhv4cuq5uwoa86iXy7oXN5jSpGbWObpz9XJeKMR/Ia1R7McPO59cJWd nSZcWI+1WA/IlKM03q2nvCjUSBDIhvjRt6/grmK9PV8R/MiT4aYdj0NELh3xHBL2gs01 HtJ/RvCC990c53mR2r2qUe83l0QNsIt6GvCEJUbSwlI3jdwYA3jBy+vwQKuYARXmtOKG wM3PTaV2udDkEgKbXPYWAdz1IkvXCQIG8vpHawzvGVijntSlFKotWoOhNdyN+9c289lu mijn3MmQ7sgoutw6m4JHI98n3MUgvQPEhjQnxqNnj98fBRuk2diDjULlQuDZeazo9jGS 20yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HCs2F3IRHmY0aWoSO0w0M7IPa8Z8P4u33i9Q/waF89A=; b=MoZSR5WMX/kkxf2clRLkRzvq4fjjmSdPtECb4hMJowi96Fo/UAhHdnglA6ej1XuJae 3dyd+6L5q0DnphULbUrAKpkiylkvhEs5ZnFpFyjxxtwxp7EEbJaaWUpCA0rLjtSGySOO UpHhLeEkEBVjj+FFWpCwznl9/er/hw9/y2Jchs58vRgpiBSLlcvW3cAQ5TRCtee5+0pt eketRiBPx8Wmm8K73uBzLTrAkzPUhhcSH0AqXw37vL6c7t0b4S31HVyddtWDeBblp1MO mmpT4mvW+sSy7c0bZZBCoCKifyEm1Maj95J6ZFufNPbKz/W8WmYJTwir9dZ9VJpicXKt kATA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p0MEecr+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5si3200503otp.130.2020.03.14.19.26.39; Sat, 14 Mar 2020 19:26:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p0MEecr+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728106AbgCOCZK (ORCPT + 99 others); Sat, 14 Mar 2020 22:25:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:39094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727915AbgCOCYN (ORCPT ); Sat, 14 Mar 2020 22:24:13 -0400 Received: from sol.hsd1.ca.comcast.net (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 145F7208D6; Sat, 14 Mar 2020 21:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584221809; bh=xmE3yElXSaLPkHmEr4QxRVGER8+rZ3BdqvEa3ZNkdF8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0MEecr+36WP4z93qOCDFo9M69v6/l1BsgQinH+aiEM4rai3GplQEwS8cb+UrHWBk LsqY7T7PRhGCBhj3hbkypJk1PTzpzF4Qmy5BvyYEmoTgqmtQyg6GZA8AffyAVDPuGa JWdTj9Kjh3KSqiPNO/9FY/K6EfErk3WztFDe5IIY= From: Eric Biggers To: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, Alexei Starovoitov , Andrew Morton , Greg Kroah-Hartman , Jeff Vander Stoep , Jessica Yu , Kees Cook , Luis Chamberlain , NeilBrown Subject: [PATCH v3 4/5] selftests: kmod: fix handling test numbers above 9 Date: Sat, 14 Mar 2020 14:34:25 -0700 Message-Id: <20200314213426.134866-5-ebiggers@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200314213426.134866-1-ebiggers@kernel.org> References: <20200314213426.134866-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers get_test_count() and get_test_enabled() were broken for test numbers above 9 due to awk interpreting a field specification like '$0010' as octal rather than decimal. Fix it by stripping the leading zeroes. Acked-by: Luis Chamberlain Cc: Alexei Starovoitov Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Jeff Vander Stoep Cc: Jessica Yu Cc: Kees Cook Cc: NeilBrown Signed-off-by: Eric Biggers --- tools/testing/selftests/kmod/kmod.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh index 8b944cf042f6c..315a43111e046 100755 --- a/tools/testing/selftests/kmod/kmod.sh +++ b/tools/testing/selftests/kmod/kmod.sh @@ -505,18 +505,23 @@ function test_num() fi } -function get_test_count() +function get_test_data() { test_num $1 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') + local field_num=$(echo $1 | sed 's/^0*//') + echo $ALL_TESTS | awk '{print $'$field_num'}' +} + +function get_test_count() +{ + TEST_DATA=$(get_test_data $1) LAST_TWO=${TEST_DATA#*:*} echo ${LAST_TWO%:*} } function get_test_enabled() { - test_num $1 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') + TEST_DATA=$(get_test_data $1) echo ${TEST_DATA#*:*:} } -- 2.25.1