Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3717196pxt; Tue, 10 Aug 2021 09:42:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUh8F3agiY/1E5wj8WoDRcbpc5gGBtUDCxhEQ2dxQuShp8xemUy15x/QC8zoaEZnSmCdz/ X-Received: by 2002:aa7:c6d2:: with SMTP id b18mr5853025eds.266.1628613749660; Tue, 10 Aug 2021 09:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628613749; cv=none; d=google.com; s=arc-20160816; b=adlOkBGGYblBQ0qCO3Lt6WSmKGI6uEOlq2rRVuSnrzXnRvGBsPFs6kB1oblT5kelwb Zb6j8/XeEMs8avYv/B1/05Hx0IBihFCvwQzJmCp+LZ1ulyiw0LyjsL7Fa8mT5e5aZDgB p3c82TK9YHsT2Z19T26E+uo88qW/4pfLNJBm7DCFZAadua3D55PdMyTNFi/FW9V8X7MY Uq9oeLrRZp1QiraBIppyOvb9T8ZTBtalAeutcf/8o+zVjJ8YofoCPajIXFW736/EGjbK EfQH3B49Z83O67585plbpBOOCoEFn13obO4AykAJ7N0b4Tf32qr0AqiA2G6mx848wbZL PMmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=r+Ogh1iqtilQ0l/2osjjxSXdZMUNaO0KlzTusaDtLHY=; b=qRo9L+EhZptqJeHMZxduT56TV0n7qEsHFjgZ2TaTd2EaGLDCodvMBfYahdDF9wvkDQ 7OQ9ZzmPtQrUoDorcSP6NgOnvW2NYru+8r1Uqaq2np6Jwpwdjavwq5uEFltyRt3u1pBI uEjsEeJGf3WiYfxbtysVlDhV4lD4Vr9Lxlc/tqhftsSr8jWcCsZ0Bb2l7mqTpVZVU5FI HLw+v1YvjS/i3HNRWBjrxBST3BCmIdjLhe8hingUG8M/FLOzmUSCPbOOSBT5lf5r5TeI OnBAx7+BmRCTk2Tp5arjEMDlishZnwCJO4K7hA/W9bE9QITrPtEy3BljJc5Iz8Ruq8t+ bdzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CKTePO4B; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si20926746ejc.168.2021.08.10.09.42.05; Tue, 10 Aug 2021 09:42:29 -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=@linuxfoundation.org header.s=korg header.b=CKTePO4B; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242258AbhHJPHz (ORCPT + 99 others); Tue, 10 Aug 2021 11:07:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:50092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239566AbhHJPHx (ORCPT ); Tue, 10 Aug 2021 11:07:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B7F160F02; Tue, 10 Aug 2021 15:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628608050; bh=A5PbUmTsXQZBjkC+nNDrH6QQ31IyCLpIpv2s5zp9XCI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CKTePO4BVdtuE1J3Bfi4pR6TUe4GAyyU5TQmBtWIVdV7JLEAaU35ecGfEu2Zd++O2 vTfqYPemHvn4DfJjbmz+tapfUi7dkLG4UKxDE3LvS54u7xLy8an8VdKE6aR+ByoW9H RHceFtR+KSvwAQgm/8GBi6PVnPea+tPdU7SkU2Mg= Date: Tue, 10 Aug 2021 17:07:28 +0200 From: Greg KH To: SeongJae Park Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, SeongJae Park Subject: Re: [PATCH] selftests/kselftest/runner/run_one(): Allow running non-executable files Message-ID: References: <20210810140459.23990-1-sj38.park@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210810140459.23990-1-sj38.park@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 02:04:59PM +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 run the program after giving the > execution permission in the case. To make nothing corrupted, it also > restores the permission after running it. > > [1] https://lore.kernel.org/mm-commits/YRJisBs9AunccCD4@kroah.com/ > > Suggested-by: Greg Kroah-Hartman > Signed-off-by: SeongJae Park > --- > tools/testing/selftests/kselftest/runner.sh | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh > index cc9c846585f0..2eb31e945709 100644 > --- a/tools/testing/selftests/kselftest/runner.sh > +++ b/tools/testing/selftests/kselftest/runner.sh > @@ -65,15 +65,16 @@ 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 > + permission_added="false" > + if [ ! -x "$TEST" ]; then > + echo "# Warning: file $TEST is not executable" > + chmod u+x "$TEST" > + permission_added="true" No, why would you change the permission of a test? What happens if this is on a read-only filesystem? You should not be modifying it as it will end up causing changes when not needed. thanks, greg k-h