From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbdHHRuc (ORCPT ); Tue, 8 Aug 2017 13:50:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:50993 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752092AbdHHRua (ORCPT ); Tue, 8 Aug 2017 13:50:30 -0400 Date: Tue, 8 Aug 2017 19:50:28 +0200 From: "Luis R. Rodriguez" To: "Luis R. Rodriguez" Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org, akpm@linux-foundation.org, keescook@chromium.org, pmladek@suse.com, dan.carpenter@oracle.com, colin.king@canonical.com, dcb314@hotmail.com, linux-kernel@vger.kernel.org, Michael Ellerman Subject: Re: [PATCH v2] selftests: warn if failure is due to lack of executable bit Message-ID: <20170808175028.GP27873@wotan.suse.de> References: <20170803202436.6877-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170803202436.6877-1-mcgrof@kernel.org> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 03, 2017 at 01:24:36PM -0700, Luis R. Rodriguez wrote: > Executing selftests is fragile as if someone forgot to set a secript > as executable the test will fail, and you won't know for sure if the > failure was caused by the lack of proper permissions or something else. > > Setting scripts as executable is required, this also enable folks to > execute selftests as independent units. > > Signed-off-by: Luis R. Rodriguez > --- > tools/testing/selftests/lib.mk | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk > index 959273c3a52e..e71f8e4633b1 100644 > --- a/tools/testing/selftests/lib.mk > +++ b/tools/testing/selftests/lib.mk > @@ -14,7 +14,12 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) > define RUN_TESTS > @for TEST in $(TEST_GEN_PROGS) $(TEST_PROGS); do \ > BASENAME_TEST=`basename $$TEST`; \ > - cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\ > + if [ ! -x $$BASENAME_TEST ]; then \ > + echo "selftests: Warning: file $$BASENAME_TEST is not executable, correct this.";\ > + echo "selftests: $$BASENAME_TEST [FAIL]"; \ > + else \ > + cd `dirname $$TEST`; (./$$BASENAME_TEST && echo "selftests: $$BASENAME_TEST [PASS]") || echo "selftests: $$BASENAME_TEST [FAIL]"; cd -;\ > + fi; \ > done; > endef > *poke* Luis