Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp403041pxp; Wed, 9 Mar 2022 05:23:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeQaSIpmldB1h2DFdggOfEsIJSnjBw7gxNzEA6yCQqRuPRjvv2Cj1Gx+5lKYIIMyMywRwu X-Received: by 2002:a63:a45:0:b0:380:caf9:e50a with SMTP id z5-20020a630a45000000b00380caf9e50amr602325pgk.141.1646832231377; Wed, 09 Mar 2022 05:23:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646832231; cv=none; d=google.com; s=arc-20160816; b=BBWjtZl7Fnr6bClh2zfjKHTwQUYNAWk2+9erN0tzD3+Kfzd49EkjmGDQebZyqBVwYF z320I/g9Bj39gFh1xuHhb1AP9JUAwTYuUrDAC43xdOJOMAnK8QhowVv1wvfAtAuudmkQ qt4+n5GJVr7tLKVd+14Jj1LYFYgxJvbTcFcfFfHFO5qp4S3qUbhH845i+IgrlYqaD/W0 icBwFuoumoUqzI6/pO3Nz034YFwa9JCNyrR9uFmiERnxamBxVeCop6gbRmAyUDjqmo1U TMb394IZDphlrjuqu7kgEEGSwyuLf9H4gROjMyqeBjGf1zbROifASAim+V9jfUotaRin yv0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=g+HRZY5PQvJ2JkFl1MUa9sFSBk6MmuZlDbwmTk87Vhw=; b=bwyb9Nd8uuQjmw/af9I94RPjmOX8aZyGdyxMdRARjSQst+qJpQpR20WHWb4k6ptvFo o+42GECLSBXXmb5n0k5m0lwzojMiSJ/L+hrupIK4R9THYl3rW9+SP0QMzDYjOJTqWlc+ 9uugwCIRkiiSlM6zojlmMdiGCnD4L+fAEF991eHKmVv8SVpPoKpvwtM1ab/kF3x/FHb1 K/Rf4dCAZKfLFnyUuw+caGAvozqQibZdeBXpXIlb/8AkARSjG5reSUfonrQnwvV9m2Cm QiMmeCXo4CnOri2/j5Ua2NfVT/+2rJ/MBit1MYDmE6Iwvs40AwMjiuMdC3U0ynX/yEB9 +0oQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf14-20020a17090b1d8e00b001bd14e030b1si5729573pjb.137.2022.03.09.05.23.32; Wed, 09 Mar 2022 05:23:51 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232782AbiCIMcU (ORCPT + 99 others); Wed, 9 Mar 2022 07:32:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232757AbiCIMcR (ORCPT ); Wed, 9 Mar 2022 07:32:17 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9F0D51768E3; Wed, 9 Mar 2022 04:31:16 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 63BB91688; Wed, 9 Mar 2022 04:31:16 -0800 (PST) Received: from e126387.arm.com (unknown [10.57.39.232]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 34BFA3FA4D; Wed, 9 Mar 2022 04:31:15 -0800 (PST) From: carsten.haitzler@foss.arm.com To: linux-kernel@vger.kernel.org Cc: coresight@lists.linaro.org, suzuki.poulose@arm.com, mathieu.poirier@linaro.org, mike.leach@linaro.org, leo.yan@linaro.org, linux-perf-users@vger.kernel.org, acme@kernel.org Subject: [PATCH 2/3] perf test: Shell - only run .sh shell files to skip other files Date: Wed, 9 Mar 2022 12:28:58 +0000 Message-Id: <20220309122859.31487-2-carsten.haitzler@foss.arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309122859.31487-1-carsten.haitzler@foss.arm.com> References: <20220309122859.31487-1-carsten.haitzler@foss.arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Carsten Haitzler You edit your scripts in the tests and end up with your usual shell backup files with ~ or .bak or something else at the end, but then your next perf test run wants to run the backups too. You might also have perf .data files in the directory or something else undesireable as well. You end up chasing which test is the one you edited and the backup and have to keep removing all the backup files, so automatically skip any files that are not plain *.sh scripts to limit the time wasted in chasing ghosts. Signed-off-by: Carsten Haitzler --- tools/perf/tests/builtin-test.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 3c34cb766724..3a02ba7a7a89 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -296,9 +296,22 @@ static const char *shell_test__description(char *description, size_t size, #define for_each_shell_test(entlist, nr, base, ent) \ for (int __i = 0; __i < nr && (ent = entlist[__i]); __i++) \ - if (!is_directory(base, ent) && \ + if (ent->d_name[0] != '.' && \ + !is_directory(base, ent) && \ is_executable_file(base, ent) && \ - ent->d_name[0] != '.') + is_shell_script(ent->d_name)) + +static bool is_shell_script(const char *file) +{ + const char *ext; + + ext = strrchr(file, '.'); + if (!ext) + return false; + if (!strcmp(ext, ".sh")) + return true; + return false; +} static const char *shell_tests__dir(char *path, size_t size) { -- 2.32.0