Jim Meyering wrote: > Eric Blake wrote: >> On 06/21/2011 08:21 AM, Jim Meyering wrote: >>> I suppose I should make them consistent, but it really doesn't matter, >>> since each is invoked via "$(SHELL) test_name". >>> Back when scripts were invoked via ./test_name it used to matter. >> >> You are right that when invoked by 'make check', it doesn't matter, >> thanks to our use of $(SHELL). But the tests seem independently useful >> - if they have a chance of running in isolation without having any of >> the 'make check' TESTS_ENVIRONMENT, then they should probably be all >> executable so that someone could do 'cd tests && ./test-foo' rather than >> 'make -C tests check TESTS=test-foo' to rerun just a single test. > > I do that rarely, and don't recommend it, because it requires manually > defining srcdir, but I agree it's worthwhile, so I've done the following. > Thanks!
In adjusting the commit log to explain better why I would discourage running a test manually (i.e., not via "make check [TESTS=...]), now I'm considering making the scripts *not* executable: From 8a54f203127575f11b9a809e002aba22a365aebe Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Tue, 21 Jun 2011 17:45:11 +0200 Subject: [PATCH 1/2] tests: ensure that each test script is executable This adds a rule run at "make check" time to ensure that test scripts are consistently executable. This change is not required for "make check", but makes it easier for people to run scripts manually, but that is discouraged because doing so makes it easy to omit important variable settings that are normally provided via TESTS_ENVIRONMENT. This change also makes each of the existing TESTS executable. * tests/Makefile.am (check_executable_TESTS): New rule. (check): Depend on it. * tests/{all_scripts}: chmod 755. Prompted by a report from Eric Blake. ... It's not just srcdir that must be set. For example, most tests malfunction when GREP_OPTIONS is set. Here's the full list: TESTS_ENVIRONMENT = \ tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \ TMPDIR=$$tmp__; export TMPDIR; \ export \ VERSION='$(VERSION)' \ LOCALE_FR='$(LOCALE_FR)' \ LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)' \ AWK=$(AWK) \ GREP_OPTIONS='' \ LC_ALL=C \ abs_top_builddir='$(abs_top_builddir)' \ abs_top_srcdir='$(abs_top_srcdir)' \ abs_srcdir='$(abs_srcdir)' \ built_programs='grep egrep fgrep' \ srcdir='$(srcdir)' \ top_srcdir='$(top_srcdir)' \ CC='$(CC)' \ GREP_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \ MAKE=$(MAKE) \ MALLOC_PERTURB_=$(MALLOC_PERTURB_); export MALLOC_PERTURB_ \ PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \ PACKAGE_VERSION=$(PACKAGE_VERSION) \ PERL='$(PERL)' \ SHELL='$(SHELL)' \ PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" \ ; $(SHELL) 9>&2 Hmm... some of these are probably unnecessary. At least the PERL setting is not used.
