[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Test cases broken when builddir != srcdir

From: <cmpilato_at_collab.net>
Date: 2001-11-15 15:52:17 CET

Mo DeJong <supermo@bayarea.net> writes:

> Here is a repost of the patch I wrote to fix running of test cases in
> a build dir that is not the src dir. This patch has been floating around
> for a couple of months now. If there is something wrong that
> is keeping that patch from being committed could someone say something?
> I had to learn Python to write this patch so I don't want it to go
> to waste.

Okay, so I'm probably not the best person to be reviewing this patch,
but I'll give it a shot. Forgive me for doing more asking than
telling.

> * Makefile.in:
> Remove nasty chmod +x hack. Run .py and .sh scripts
> out of the srcdir. Save the relative srcdir in a
> file named srcdir while test is running. Programs can
> use this fully qualified path to find needed files
> in the srcdir.
> * subversion/tests/clients/cmdline/xmltests/svn-test.sh:
> * subversion/tests/clients/cmdline/xmltests/svn-test2.sh:
> Pull in the relative srcdir from a file named srcdir
> when setting the path to XML test files.

Log message is fine, but you didn't update_tests.py. And since you
had to learn Python for this change, it would be a tragedy not to
mention the one place you used your newfound skillz. :-)

> -### the chmod really sucks, but some repository files don't have it like
> -### they should ...
> check: $(TEST_DEPS) @FS_TEST_DEPS@
> @logfile=`pwd`/tests.log ; \
> echo > $$logfile ; \
> failed=no ; \
> list='$(TEST_PROGRAMS) @FS_TEST_PROGRAMS@'; for prog in $$list; do \
> - chmod a+x $$prog ; \
> progbase=`echo $$prog | sed 's?.*/??'` ; \
> progdir=`echo $$prog | sed 's?/[^/]*$$??'` ; \
> echo -n "Running all tests in $$progbase..." ; \
> echo "START: $$progbase" >> $$logfile ; \
> - if echo $$prog | grep \.py > /dev/null; then \
> - runprog="$(PYTHON) $$progbase" ; \
> - else \
> + if echo $$progbase | grep \\.py$$ > /dev/null; then \
> + runprog="$(PYTHON) $(top_srcdir)/$$prog" ; \

Is it intentional that the old code calls grep with '\.py' and the new
one uses '\\.py$$' ? I understand the '$$' portion (matching
end-of-line, yes?), it's the additional '\' I'm not sure of. Teach me
what the difference is here.

>From here on out, it looks okay, save for one final concern. You have
basically rendered useless both XML tests and update_tests.py unless
someone has previously run 'make check'. To verify this concern, I
applied you patch, did NOT run 'make check', and got this when I ran
update_tests.py:

   ~/projects/subversion/subversion/tests/clients/cmdline % ./update_tests.py
   Traceback (most recent call last):
     File "./update_tests.py", line 469, in ?
       err = svntest.main.run_tests(test_list)
     File "svntest/main.py", line 330, in run_tests
       if run_one_test(n, test_list):
     File "svntest/main.py", line 274, in run_one_test
       error = test_list[n]()
     File "./update_tests.py", line 90, in update_binary_file
       fp = open("srcdir")
   IOError: [Errno 2] No such file or directory: 'srcdir'

Now, I dunno. Maybe it's fair to ask that before someone runs our
tests individually, he/she/it must have run 'make check' first. But
it feels wrong to me.

Now, perhaps if these little 'srcdir' turds were being dropped
sometime earlier, like during the ./configure step or some other time
prior to building the source code itself, that wouldn't be so bad.

List-folk, whatcha think?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:48 2006

This is an archived mail posted to the Subversion Dev mailing list.