Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp497933pxb; Fri, 15 Oct 2021 09:44:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1KzKg4sk9L/+Lg9AGMMorYevlboKJrl8fYfB1o2GTJvxM7PJVFJC57Bg8fXdbw92111h7 X-Received: by 2002:a17:903:32c3:b0:13f:60e1:3f51 with SMTP id i3-20020a17090332c300b0013f60e13f51mr12160290plr.41.1634316278449; Fri, 15 Oct 2021 09:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634316278; cv=none; d=google.com; s=arc-20160816; b=srRzRC8qTV2vpn4TTLPzUsxh6HHYLH+/b+uiXlMDHWiU7cEzKScfP49RtCYGbHgkXF eBHkGzax2nJJ0ecC7WqWnDP6JvEoWO91z9YPnoWNw+Y68gY6wluQnu+kjbj/B6INOsd4 tqQGes2cTK7qt8WxhCQw0uFzxyDltD7WO/mT2W2lx6o1OUILL1yWJsqUIxdckAwDLIV4 OC4rdaS5ETNMJTLNinpbWGtz1RsW+7I4H+6gKY3LwVaAeBdwDlcWvB62olcPmz+Tw9pl XgLgvzg0h8y7I6ktLWywzn50cVWYyz+l2gNAXKSFDgSqz7BWEr4QUeTi76xPSQrKPcMD hY+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2j7NqFH2hkCaCcfYSZJfdI8LintZTrde7sMdTsX0mgk=; b=GucHSxzfF412R5BkaQzsXod1sr1DZ1v3iQo3sx2VZPK49dAHziPdYli/oJr7COXltV rLD48GSQAdWdqi+gu+S5clI0D0f7AB/dEfIsnj80tzaHu9ewQMHFlk+gFN9sdZolrHy/ DhaIGZI5v4V0EnnyGC3aQzuV35ogR2wgAYd3+vRod89MMO2Teusbtlul4f43+0qbOEas RCzeH3QpUBrccc9h9HL5UW0tR19UV1n6/1h9G9TeZsItncFWulb97NXxjWkQlPhepfiq JRkMFvq9ZSPSR9MohDevaU3c7Fl478QNj/VIo9PxCBIKUCppAvyqlvkQTalaEgnH2C7e ZcgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GF3D8JU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id q8si9330648pgq.595.2021.10.15.09.44.25; Fri, 15 Oct 2021 09:44:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GF3D8JU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S235487AbhJOIyu (ORCPT + 99 others); Fri, 15 Oct 2021 04:54:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:47444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234459AbhJOIyu (ORCPT ); Fri, 15 Oct 2021 04:54:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FA0A61053; Fri, 15 Oct 2021 08:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634287964; bh=WmLhFzVqAqmD2RimdfqsPkp2Nun4vez4+tb7P7hMIFU=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=GF3D8JU24hp5t79Ik+GzZGC6/vNO4EXuqAmiFXcf7I3m7qGUbnFW5O2xjMJnpzjMW ktHtU7sMNIfJs8c3rA0sYOqkITjn31DdeBTja/FA+rGoq+DscCBSoflavJYD5RHhFv XerWeIl5MCSt7POEg1ZYc5JmU8DN/RzVCQPKLRLYj49p8an3WCwAUk5y3LCh7aX6ik jn8SwDeFZVND897gUkPbyJKlE1ew1kHreq5Zndadt07eAY2j0R2wBOZjKoNwEEQ/sD fPYvv/CiMLWiqZWUYGgmgCMTYwSS/RV13qviOZQG+pVhl7Nq9xsyx/bn+1sRfWX5/X CmfnjqMceavFg== From: SeongJae Park To: SeongJae Park Cc: SeongJae Park , shuah@kernel.org, gregkh@linuxfoundation.org, akpm@linux-foundation.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: Re: [PATCH v2] selftests/kselftest/runner/run_one(): Allow running non-executable files Date: Fri, 15 Oct 2021 08:52:41 +0000 Message-Id: <20211015085241.16262-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211008095828.1796-1-sj@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gentle ping. On Fri, 8 Oct 2021 09:58:28 +0000 SeongJae Park wrote: > Hello Shuah, > > > I was wondering if you had a chance to read this patch. > > Without this patch, DAMON selftest fails as below: > > $ make -C tools/testing/selftests/damon/ run_tests > make: Entering directory '/home/sjpark/linux/tools/testing/selftests/damon' > TAP version 13 > 1..1 > # selftests: damon: debugfs_attrs.sh > # Warning: file debugfs_attrs.sh is not executable, correct this. > not ok 1 selftests: damon: debugfs_attrs.sh > make: Leaving directory '/home/sjpark/linux/tools/testing/selftests/damon' > > If you disagree in the approach, please also take a look in this one: > https://lore.kernel.org/linux-kselftest/20210810112050.22225-1-sj38.park@gmail.com/ > > > Thanks, > SJ > > > On Mon, 13 Sep 2021 11:24:42 +0000 SeongJae Park wrote: > > > From: SeongJae Park > > > > Hello Shuah, > > > > > > Could you I ask your comment for this patch? > > > > > > Thanks, > > SJ > > > > On Tue, 10 Aug 2021 16:45:34 +0000 SeongJae Park wrote: > > > > > From: SeongJae Park > > > > > > When running a test program, 'run_one()' checks if the program has the > > > execution permission and fails if it doesn't. However, it's easy to > > > mistakenly missing the permission, as some common tools like 'diff' > > > don't support the permission change well[1]. Compared to that, making > > > mistakes in the test program's path would only rare, as those are > > > explicitly listed in 'TEST_PROGS'. Therefore, it might make more sense > > > to resolve the situation on our own and run the program. > > > > > > For the reason, this commit makes the test program runner function to > > > still print the warning message but try parsing the interpreter of the > > > program and explicitly run it with the interpreter, in the case. > > > > > > [1] https://lore.kernel.org/mm-commits/YRJisBs9AunccCD4@kroah.com/ > > > > > > Suggested-by: Greg Kroah-Hartman > > > Signed-off-by: SeongJae Park > > > --- > > > Changes from v1 > > > (https://lore.kernel.org/linux-kselftest/20210810140459.23990-1-sj38.park@gmail.com/) > > > - Parse and use the interpreter instead of changing the file > > > > > > tools/testing/selftests/kselftest/runner.sh | 28 +++++++++++++-------- > > > 1 file changed, 18 insertions(+), 10 deletions(-) > > > > > > diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh > > > index cc9c846585f0..a9ba782d8ca0 100644 > > > --- a/tools/testing/selftests/kselftest/runner.sh > > > +++ b/tools/testing/selftests/kselftest/runner.sh > > > @@ -33,9 +33,9 @@ tap_timeout() > > > { > > > # Make sure tests will time out if utility is available. > > > if [ -x /usr/bin/timeout ] ; then > > > - /usr/bin/timeout --foreground "$kselftest_timeout" "$1" > > > + /usr/bin/timeout --foreground "$kselftest_timeout" $1 > > > else > > > - "$1" > > > + $1 > > > fi > > > } > > > > > > @@ -65,17 +65,25 @@ run_one() > > > > > > TEST_HDR_MSG="selftests: $DIR: $BASENAME_TEST" > > > echo "# $TEST_HDR_MSG" > > > - if [ ! -x "$TEST" ]; then > > > - echo -n "# Warning: file $TEST is " > > > - if [ ! -e "$TEST" ]; then > > > - echo "missing!" > > > - else > > > - echo "not executable, correct this." > > > - fi > > > + if [ ! -e "$TEST" ]; then > > > + echo "# Warning: file $TEST is missing!" > > > echo "not ok $test_num $TEST_HDR_MSG" > > > else > > > + cmd="./$BASENAME_TEST" > > > + if [ ! -x "$TEST" ]; then > > > + echo "# Warning: file $TEST is not executable" > > > + > > > + if [ $(head -n 1 "$TEST" | cut -c -2) = "#!" ] > > > + then > > > + interpreter=$(head -n 1 "$TEST" | cut -c 3-) > > > + cmd="$interpreter ./$BASENAME_TEST" > > > + else > > > + echo "not ok $test_num $TEST_HDR_MSG" > > > + return > > > + fi > > > + fi > > > cd `dirname $TEST` > /dev/null > > > - ((((( tap_timeout ./$BASENAME_TEST 2>&1; echo $? >&3) | > > > + ((((( tap_timeout "$cmd" 2>&1; echo $? >&3) | > > > tap_prefix >&4) 3>&1) | > > > (read xs; exit $xs)) 4>>"$logfile" && > > > echo "ok $test_num $TEST_HDR_MSG") || > > > -- > > > 2.17.1 > > >