Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1737444pxb; Mon, 13 Sep 2021 04:33:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgjdOBirVaU57lbrGwg++tvo+b/gUISmBS3fIFblUdSv0SHASOg90x8msGQZ5urbGkYn6h X-Received: by 2002:a05:6402:1352:: with SMTP id y18mr12619334edw.122.1631532823329; Mon, 13 Sep 2021 04:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631532823; cv=none; d=google.com; s=arc-20160816; b=Cc52uT+LEpFsze+I6pG1tL28I2i/E4S1riOEu0UC4/vNz+DvzZB2t1f7AcaCVVwVgs rrDTOjlZGSl2GK9Nm6d0QYskxlclZXVPWuzN2TthnbGojuTXRffFHZydPMIBnmvy7jay xGg2SYfgyB/jvKW4nhkDqWMiYgURP/zMIMrA12+M56d9aXUMJoCFYZM1hHSjNKsrgfEv uWaeKcllnpYu3AyRrZNHulgMyw+7yNsfXgYtnTwda5EDW8lNmWTZj04hsvbx4nxCiPvg bsLbOdVD6fxmJ4qygoXV1IGk99WVx1Ev7WO33TdvmPYwhn7v3dB6wVDYfUF2YM02vw4s H3BQ== 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=5w2GYBAb4YPolyMIT1gaOrGT0ipIggCYYFAmbOuThOM=; b=gaxT5GTLROtx1MUpUxV4keVCgd37VAWqmI6B1r4bHGU6bmpZkxiWjoQ5qnanp2XDm9 WqHH5fYiOPBduMK5+/M+VsrRpf7VPJ9779l1gTKpKGQPMYWxIJasbNpxi+7VXtaTXKqQ q7CZzAc7+KnhmBS/PQkjO2zEoMvm8//htGqzLB2+3jm3uy0mRjvRCxvk87Dx0ASM6dXG E9uCUISvdeTqeu9b9Hm2cKf4oWUF6nJvZZxNFgzq4NDBXTo06KoF7+oSx8nLNwRzYVwt ySQHwCT6X0BjI6Jc7qgPG0HiB2QiuKDjhT4D+YpvQIPwsiwZIfhOU3mtFLd49819XE+p 0UQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hPNT7kIC; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id he16si6202761ejc.430.2021.09.13.04.33.15; Mon, 13 Sep 2021 04:33:43 -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=@gmail.com header.s=20210112 header.b=hPNT7kIC; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239180AbhIML0F (ORCPT + 99 others); Mon, 13 Sep 2021 07:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238684AbhIML0F (ORCPT ); Mon, 13 Sep 2021 07:26:05 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B884C061574; Mon, 13 Sep 2021 04:24:49 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id bk29so10016708qkb.8; Mon, 13 Sep 2021 04:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to; bh=5w2GYBAb4YPolyMIT1gaOrGT0ipIggCYYFAmbOuThOM=; b=hPNT7kICwXNN8T6DuCsPSHwUh/LrHyLu4ytgdfFeDoCTAstowc9hzGFphNBp7To4Ic lv0z8syPZkyIddA4rqskr+zCablc9GfZKccObC+bDbBBfqTpbYrpj8RhHpC/Y5wBYBQk C2ul9x4E9sV+DSwK/jInLJtrcmzBptVDVPPVuX0SbN5sMv84LrkKmZeDw9xtPiW0ST5Y vB4Nb6he64vAVPdP83VT6ubE7KEGJcrL93enEeUgBm7oXUOTvd8jCAmNN4Vv/YYemLL1 7qxg8eusbAZej1xicOvsD+F5kdvPZWWI/TKkLn+BB2EQ+Clxu1sW3CnypAy99IBpnGgU x2JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to; bh=5w2GYBAb4YPolyMIT1gaOrGT0ipIggCYYFAmbOuThOM=; b=nchXf9+P9om2ql8zaytE8dstmDmYfxCTF9In4hcuYxEzbCu0TdHRoC1aLOyqYDhCHd V9ioo3WeHrn6i+RRy1sHov3Cq67r2dOk0zUa5rcl7+PMCimJtLGtFB+mZyj4INlNLclH T6Q5EUBUXxlXdt4DMD4qVnCW4aDolqj2/tNfWeD1FQ2MMMe8aCCwvPGgTI9khFJgiees IdNYvzOxbAAbAfC7cmJodoipix8PeUZVZVNNoSIcikQdSPlyAVei0BNVFShJnmUCjMw1 ytiW2vPoxH0ihrm6M5W4fTIG2Y8Yd1ehuRL/VHLbfRbx/UGtGXSPwq9nTARk66rR3pKS GzUg== X-Gm-Message-State: AOAM533nhEnU6v0Xz55ds6lzJoNiOMXh0VHlk2t5cthaJLlk1hBykQ2R tcY3wJXX0eZGoC2YVAd6s4vBGA1FQiEXtQ== X-Received: by 2002:ae9:ea19:: with SMTP id f25mr9405378qkg.341.1631532288601; Mon, 13 Sep 2021 04:24:48 -0700 (PDT) Received: from localhost.localdomain (ec2-35-169-212-159.compute-1.amazonaws.com. [35.169.212.159]) by smtp.gmail.com with ESMTPSA id s16sm3906674qtq.31.2021.09.13.04.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 04:24:48 -0700 (PDT) From: SeongJae Park X-Google-Original-From: SeongJae Park To: SeongJae Park Cc: 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: Mon, 13 Sep 2021 11:24:42 +0000 Message-Id: <20210913112442.1659-1-sjpark@amazon.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210810164534.25902-1-sj38.park@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >