[darcs-users] one last Solaris test harness issue?

Trent W. Buck trentbuck at gmail.com
Mon Oct 20 02:37:09 UTC 2008

On Fri, Oct 17, 2008 at 09:53:15AM +0100, Eric Kow wrote:
> On Fri, Oct 17, 2008 at 14:58:54 +1100, Trent W. Buck wrote:
> > I can investigate; can you point me at the code that invokes the shell
> > script (and prints the above output)?
> Thanks!  It's GNUmakefile and tests/shell_harness
> http://joyful.com/darcsweb/darcsweb.cgi?r=darcs-stable;a=headblob;f=/GNUmakefile#l439
> http://joyful.com/darcsweb/darcsweb.cgi?r=darcs-stable;a=headblob;f=/tests/shell_harness

Sorry, both for the delay in getting to this and because I can't spot
the problem easily.  However, I will point out that using the output
from ls is Really Bad -- particularly on weird old systems.

greybot> Please NEVER parse, pipe, grep, capture, read, or loop over
greybot> the output of 'ls'. Unlike popular belief, 'ls' is NOT
greybot> designed to enumerate files or parse their statistics. Using
greybot> 'ls' for this is dangerous (word splitting) and there's
greybot> always a better way; eg. globs: files=(*).

In GNUmakefile:

   452	define harness
   453		@echo Running $4 tests on $1 repositories...
   454		@chmod -R u+rwx tests-$4-$1.dir 2>/dev/null || true
   455		@rm -rf tests-$4-$1.dir && cp -R tests tests-$4-$1.dir
   456		@cd tests-$4-$1.dir && rm -rf .darcs; mkdir .darcs;\
   457		 $2;\
   458		 if [ -r $(TEST_FILTER_FILE) ];\
   459		 then grep "\.$5" $(TEST_FILTER_FILE) | grep -v '^#' | $3 | xargs $6; \
   460		 else ls *.$5 | sort -r | $3 | xargs $6; fi
   461		@echo Done running tests on $1 repositories...
   462	endef

Line 460 should be something like

    else printf %s\\n *.'$5' | sort -r | xargs $6; fi


    else find -maxdepth 1 -name '*.$5' -exec $6 {} +; fi

While I'm at it, I believe the double quotes on 459 should be single
quotes.  (Remember that $5 gets expanded by Make regardless of quote
style, before the expression is passed to $SHELL.)

Does anyone know if $TEST_FILTER_FILE exists on the misbehaving host?

Given that the tests already require bash, is it possible to use SHELL
:= /bin/bash in GNUmakefile?  This would allow useful bashisms like
the one greybot mentioned above.

Incidentally, grumble about using @ to hide what is actually happening
in makefiles.  It makes debugging makefiles from build daemons' dumps

More information about the darcs-users mailing list