You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Mo DeJong <su...@bayarea.net> on 2001/10/03 02:29:46 UTC
Re: Test cases broken when builddir != srcdir
Hi all.
Some time ago, I posted a patch to fix running of the test cases when building
outside the srcdir. The problem with that older patch was that it did not include
fixes for the Python tests. I ended up breaking down and learning a little bit
of Python and finally fixed those too. Here is the new patch.
2001-10-02 Mo DeJong <su...@bayarea.net>
Fix `make check` when srcdir != builddr.
* 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. Create the given directory in the
builddir if it does not exist. Redirect standard
error to tests.log file so that python stack traces
appear in the log if something goes wrong. Print
warning about a failed test after all of the test
have been run.
* 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.
* subversion/tests/clients/cmdline/update_tests.py:
Pull in the relative srcdir from a file named srcdir
before reading a png file.
Index: ./Makefile.in
===================================================================
--- ./SVN/text-base/Makefile.in Thu Sep 27 13:10:12 2001
+++ ./Makefile.in Tue Oct 2 13:27:13 2001
@@ -104,34 +104,40 @@
local-install: @INSTALL_RULES@
-### 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" ; \
+ elif echo $$progbase | grep \\.sh$$ > /dev/null; then \
+ runprog="$(SHELL) $(top_srcdir)/$$prog" ; \
+ elif test -x $$prog ; then \
runprog="./$$progbase" ; \
+ else \
+ echo "Don't know what to do about $$progbase" ; \
+ exit 1 ; \
+ fi ; \
+ if test ! -d $$progdir ; then \
+ $(MKDIR) $$progdir > /dev/null 2>&1 ; \
fi ; \
- if ( cd $$progdir && $$runprog ) >> $$logfile ; then \
+ if ( cd $$progdir && echo $(top_srcdir)/$$progdir > srcdir && \
+ $$runprog && rm srcdir ) >> $$logfile 2>&1 ; then \
echo "SUCCESS" ; \
else \
failed=yes; \
echo "FAILED" ; \
- echo "--- at least one test FAILED, check tests.log." ; \
fi; \
echo "END: $$progbase" >> $$logfile ; \
echo >> $$logfile ; \
done ; \
if test "$$failed" = "yes"; then \
+ echo "at least one test FAILED, checking tests.log." ; \
grep FAIL $$logfile || true ; \
fi
Index: ./subversion/tests/clients/cmdline/xmltests/svn-test.sh
===================================================================
--- ./subversion/tests/clients/cmdline/xmltests/SVN/text-base/svn-test.sh Thu Sep 27 13:12:45 2001
+++ ./subversion/tests/clients/cmdline/xmltests/svn-test.sh Tue Oct 2 13:50:19 2001
@@ -1,7 +1,7 @@
#!/bin/sh
SVN_PROG=../../../../clients/cmdline/svn
-XML_DIR=../../../xml
+XML_DIR=`cat srcdir`/../../../xml
TEST_DIR_1=t1
TEST_DIR_2=t2
COMMIT_RESULTFILE_NAME=commit
Index: ./subversion/tests/clients/cmdline/xmltests/svn-test2.sh
===================================================================
--- ./subversion/tests/clients/cmdline/xmltests/SVN/text-base/svn-test2.sh Thu Sep 27 13:12:45 2001
+++ ./subversion/tests/clients/cmdline/xmltests/svn-test2.sh Tue Oct 2 13:51:13 2001
@@ -3,7 +3,7 @@
# Testing merging and conflict resolution.
SVN_PROG=../../../../clients/cmdline/svn
-XML_DIR=../../../xml
+XML_DIR=`cat srcdir`/../../../xml
TEST_DIR_1=t1
TEST_DIR_2=t2
COMMIT_RESULTFILE_NAME=commit2
@@ -38,14 +38,14 @@
### Give t1/iota some file-properties via update.
echo "Updating t1/iota with properties. (up2.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/up2.xml --revision 17)
+ ../${SVN_PROG} update --xml-file $XML_DIR/up2.xml --revision 17)
check_status 2
### Give t1/A some dir-properties via update.
echo "Updating t1/A/ with properties. (up5.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/up5.xml --revision 18)
+ ../${SVN_PROG} update --xml-file $XML_DIR/up5.xml --revision 18)
check_status 3
@@ -91,14 +91,14 @@
### Update again. This update should create conflicting properties.
echo "Updating with (conflicting) properties. (up-props.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/up-props.xml --revision 20)
+ ../${SVN_PROG} update --xml-file $XML_DIR/up-props.xml --revision 20)
check_status 9
### Update again. This update should create conflicting text.
echo "Updating with (conflicting) text. (pipatch.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/pipatch.xml --revision 21)
+ ../${SVN_PROG} update --xml-file $XML_DIR/pipatch.xml --revision 21)
check_status 10
Index: ./subversion/tests/clients/cmdline/update_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/SVN/text-base/update_tests.py Tue Oct 2 12:14:39 2001
+++ ./subversion/tests/clients/cmdline/update_tests.py Tue Oct 2 14:40:04 2001
@@ -86,8 +86,14 @@
if svntest.actions.make_repo_and_wc(sbox):
return 1
- # Add a binary file to the project.
- fp = open("theta.png")
+ # Add a binary file to the project from the srcdir.
+ fp = open("srcdir")
+ srcdir = fp.readline()
+ fp.close()
+ # Strip \n off end since it hoses os.path.join()
+ srcdir = string.rstrip(srcdir)
+ theta_path = os.path.join(srcdir, 'theta.png')
+ fp = open(theta_path)
theta_contents = fp.read() # suck up contents of a test .png file
fp.close()
@@ -215,8 +221,14 @@
return 1
# Suck up contents of a test .png file.
- fp = open("theta.png")
- theta_contents = fp.read()
+ fp = open("srcdir")
+ srcdir = fp.readline()
+ fp.close()
+ # Strip \n off end since it hoses os.path.join()
+ srcdir = string.rstrip(srcdir)
+ theta_path = os.path.join(srcdir, 'theta.png')
+ fp = open(theta_path)
+ theta_contents = fp.read()
fp.close()
# 102400 is svn_txdelta_window_size. We're going to make sure we
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Mo DeJong <su...@bayarea.net>.
On Fri, 16 Nov 2001 10:11:04 +0200
Michael Wood <mw...@its.uct.ac.za> wrote:
> On Thu, Nov 15, 2001 at 07:25:37PM -0600, Ben Collins-Sussman wrote:
> > Greg Stein <gs...@lyra.org> writes:
> >
> > > The whole "srcdir" file concept is really bogus... We should
> > > be passing the source directory on the command line. Apps
> > > that don't want it should ignore it. I had coded this at
> > > some point, but then somebody ripped it out. It really
> > > should go back in.
> >
> > It was taken out because nearly every test was complaining:
> > "warning: ignoring bogus argument". It seems awfully silly to
> > me that *every* test we write, past and future, now have this
> > obligation to expect (or deliberately ignore) a srcdir on the
> > commandline. It seems like an extra, unnecessary maintenance
> > hassle to me. :-(
>
> Any objections to using an environment variable?
Oh please no. Env vars work great under Unix but dealing with them
under Windows is like pulling teeth. You could not set one env var
anyway since each subdir is going to need its own srcdir. That is why
you need a different srcdir file in each subdirectory in the build dir.
For example, assume you root srcdir was /tmp/src/foo and you were running
in /tmp/build/foo/one and /tmp/build/foo/tmp. You would need to set
the var to /tmp/src/foo/one and then run the first test. You would then need
to set the var to /tmp/src/foo/tmp and run the second test. It would just be
a big pain since you would also need to pass the fully qualified path of the
python script on the command line:
cd /tmp/build/foo/one
setenv SRCDIR /tmp/src/foo/one
python /tmp/src/foo/one/test.python
Yuck, right?
Mo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Michael Wood <mw...@its.uct.ac.za> writes:
> Any objections to using an environment variable?
Env vars are the spawn of the devil.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Michael Wood <mw...@its.uct.ac.za>.
On Thu, Nov 15, 2001 at 07:25:37PM -0600, Ben Collins-Sussman wrote:
> Greg Stein <gs...@lyra.org> writes:
>
> > The whole "srcdir" file concept is really bogus... We should
> > be passing the source directory on the command line. Apps
> > that don't want it should ignore it. I had coded this at
> > some point, but then somebody ripped it out. It really
> > should go back in.
>
> It was taken out because nearly every test was complaining:
> "warning: ignoring bogus argument". It seems awfully silly to
> me that *every* test we write, past and future, now have this
> obligation to expect (or deliberately ignore) a srcdir on the
> commandline. It seems like an extra, unnecessary maintenance
> hassle to me. :-(
Any objections to using an environment variable?
Parent processes could start children with the environment
variable set (similar to adding a command line argument) and the
children will ignore them by default without complaining about
extra arguments etc. For things that need to find the srcdir,
they can just look at $srcdir (or whatever.)
--
Michael Wood <mw...@its.uct.ac.za>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Ben Collins-Sussman <su...@collab.net>.
Greg Stein <gs...@lyra.org> writes:
> The whole "srcdir" file concept is really bogus... We should be passing the
> source directory on the command line. Apps that don't want it should ignore
> it. I had coded this at some point, but then somebody ripped it out. It
> really should go back in.
It was taken out because nearly every test was complaining: "warning:
ignoring bogus argument". It seems awfully silly to me that *every*
test we write, past and future, now have this obligation to expect (or
deliberately ignore) a srcdir on the commandline. It seems like an
extra, unnecessary maintenance hassle to me. :-(
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Greg Stein <gs...@lyra.org>.
The whole "srcdir" file concept is really bogus... We should be passing the
source directory on the command line. Apps that don't want it should ignore
it. I had coded this at some point, but then somebody ripped it out. It
really should go back in.
I really dislike "dropping something off and picking it up from elsewhere."
Whether that applies to dropping values into a global variable, into the
uesrdata on a pool, or into a file in the filesystem. It introduces control
flow dependencies that are non-obvious and error prone.
Mike's point about not being able to run some of the tests without a
'srcdir' file are quite valid. And that problem is going to keep happening
because people aren't going to know about this magic little file.
I see no reason that we can't pass a source directory on the command line.
Or more specifically, the location of the input test data.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Mo DeJong <su...@bayarea.net>.
On 15 Nov 2001 08:52:17 -0600
cmpilato@collab.net wrote:
> Mo DeJong <su...@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. :-)
My mistake.
* subversion/tests/clients/cmdline/update_tests.py:
Pull in the relative srcdir from a file named srcdir
before reading a png file.
> > -### 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.
First, assume that the following is saved in "Makefile":
bad:
@files='ls *'; for file in $$files; do \
if echo $$file | grep \.py > /dev/null; then \
echo "Matched $$file" ;\
fi ; \
done ;
good:
@files='ls *'; for file in $$files; do \
if echo $$file | grep \\.py$$ > /dev/null; then \
echo "Matched $$file" ;\
fi ; \
done ;
Then run:
% touch foo.py
% touch foo_py
% touch foo_python
% touch foo.python
% ls *.py
foo.py
% make bad
Matched foo.py
Matched foo.python
Matched foo_py
Matched foo_python
% make good
Matched foo.py
This demonstrates that that "\\." is needed so that "\."
makes it to grep. Without the escape the . char would match
any char and a file ending in _py would also match. The
same thing goes for $$, it passed $ to grep but needs to
be escaped with an extra $ so that Make does not hose it.
> 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
It is not a matter of running "make check" before. One simply needs to create a
file named "srcdir" in the current dir before running the test. This file is created
and removed from the build dir by the "make check" rule.
echo . > srcdir
./update_tests.py
If this really matters to you, then the code could easily be changed to default
to "." if no srcdir file exists. It does not matter to me since I would not
build or run anything in the srcdir, so I am forced to use "make check".
I am not really clear on how just one test or a set of named tests could
be run from the command line via "make check" so this has not really come up.
> 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.
Well, these srcdir files only live in the build directory so I can't really
see a downside to having them sitting around. The current rule removes
them but you could just as well create them at ./configure time and
just leave them there. If you build inside the srcdir then they would seem
like "extra" files and would show up in a `svn update` and that might
bother folks.
cheers
Mo
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by cm...@collab.net.
Mo DeJong <su...@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
Re: Test cases broken when builddir != srcdir
Posted by cm...@collab.net.
Mo DeJong <su...@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.
Hey, Mo, I'll try to get around to reviewing this tomorrow morning.
Sorry about the delay. At this point I seriously can't keep track of
what outstanding patches exist on our list.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Mo DeJong <su...@bayarea.net>.
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.
thanks
Mo
2001-11-13 Mo DeJong <su...@bayarea.net>
Fix make check when srcdir != builddr.
* 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.
Index: ./Makefile.in
===================================================================
--- ./.svn/text-base/Makefile.in Tue Nov 6 14:12:43 2001
+++ ./Makefile.in Tue Nov 6 14:12:43 2001
@@ -110,34 +110,40 @@
local-install: @INSTALL_RULES@
-### 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" ; \
+ elif echo $$progbase | grep \\.sh$$ > /dev/null; then \
+ runprog="$(SHELL) $(top_srcdir)/$$prog" ; \
+ elif test -x $$prog ; then \
runprog="./$$progbase" ; \
+ else \
+ echo "Don't know what to do about $$progbase" ; \
+ exit 1 ; \
+ fi ; \
+ if test ! -d $$progdir ; then \
+ $(MKDIR) $$progdir > /dev/null 2>&1 ; \
fi ; \
- if ( cd $$progdir && $$runprog ) >> $$logfile ; then \
+ if ( cd $$progdir && echo $(top_srcdir)/$$progdir > srcdir && \
+ $$runprog && rm srcdir ) >> $$logfile 2>&1 ; then \
echo "SUCCESS" ; \
else \
failed=yes; \
echo "FAILED" ; \
- echo "--- at least one test FAILED, check tests.log." ; \
fi; \
echo "END: $$progbase" >> $$logfile ; \
echo >> $$logfile ; \
done ; \
if test "$$failed" = "yes"; then \
+ echo "at least one test FAILED, checking tests.log." ; \
grep FAIL $$logfile || true ; \
fi
Index: ./subversion/tests/clients/cmdline/xmltests/svn-test.sh
===================================================================
--- ./subversion/tests/clients/cmdline/xmltests/.svn/text-base/svn-test.sh Thu Oct 25 16:01:37 2001
+++ ./subversion/tests/clients/cmdline/xmltests/svn-test.sh Thu Oct 25 16:29:28 2001
@@ -1,7 +1,7 @@
#!/bin/sh
SVN_PROG=../../../../clients/cmdline/svn
-XML_DIR=../../../xml
+XML_DIR=`cat srcdir`/../../../xml
TEST_DIR_1=t1
TEST_DIR_2=t2
COMMIT_RESULTFILE_NAME=commit
Index: ./subversion/tests/clients/cmdline/xmltests/svn-test2.sh
===================================================================
--- ./subversion/tests/clients/cmdline/xmltests/.svn/text-base/svn-test2.sh Thu Oct 25 16:01:37 2001
+++ ./subversion/tests/clients/cmdline/xmltests/svn-test2.sh Thu Oct 25 16:29:28 2001
@@ -3,7 +3,7 @@
# Testing merging and conflict resolution.
SVN_PROG=../../../../clients/cmdline/svn
-XML_DIR=../../../xml
+XML_DIR=`cat srcdir`/../../../xml
TEST_DIR_1=t1
TEST_DIR_2=t2
COMMIT_RESULTFILE_NAME=commit2
@@ -38,14 +38,14 @@
### Give t1/iota some file-properties via update.
echo "Updating t1/iota with properties. (up2.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/up2.xml --revision 17)
+ ../${SVN_PROG} update --xml-file $XML_DIR/up2.xml --revision 17)
check_status 2
### Give t1/A some dir-properties via update.
echo "Updating t1/A/ with properties. (up5.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/up5.xml --revision 18)
+ ../${SVN_PROG} update --xml-file $XML_DIR/up5.xml --revision 18)
check_status 3
@@ -91,14 +91,14 @@
### Update again. This update should create conflicting properties.
echo "Updating with (conflicting) properties. (up-props.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/up-props.xml --revision 20)
+ ../${SVN_PROG} update --xml-file $XML_DIR/up-props.xml --revision 20)
check_status 9
### Update again. This update should create conflicting text.
echo "Updating with (conflicting) text. (pipatch.xml)"
(cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../$XML_DIR/pipatch.xml --revision 21)
+ ../${SVN_PROG} update --xml-file $XML_DIR/pipatch.xml --revision 21)
check_status 10
Index: ./subversion/tests/clients/cmdline/update_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/.svn/text-base/update_tests.py Thu Oct 25 16:01:31 2001
+++ ./subversion/tests/clients/cmdline/update_tests.py Thu Oct 25 16:29:28 2001
@@ -86,8 +86,14 @@
if svntest.actions.make_repo_and_wc(sbox):
return 1
- # Add a binary file to the project.
- fp = open("theta.png")
+ # Add a binary file to the project from the srcdir.
+ fp = open("srcdir")
+ srcdir = fp.readline()
+ fp.close()
+ # Strip \n off end since it hoses os.path.join()
+ srcdir = string.rstrip(srcdir)
+ theta_path = os.path.join(srcdir, 'theta.png')
+ fp = open(theta_path)
theta_contents = fp.read() # suck up contents of a test .png file
fp.close()
@@ -215,8 +221,14 @@
return 1
# Suck up contents of a test .png file.
- fp = open("theta.png")
- theta_contents = fp.read()
+ fp = open("srcdir")
+ srcdir = fp.readline()
+ fp.close()
+ # Strip \n off end since it hoses os.path.join()
+ srcdir = string.rstrip(srcdir)
+ theta_path = os.path.join(srcdir, 'theta.png')
+ fp = open(theta_path)
+ theta_contents = fp.read()
fp.close()
# 102400 is svn_txdelta_window_size. We're going to make sure we
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: Test cases broken when builddir != srcdir
Posted by Mo DeJong <su...@bayarea.net>.
Hi all.
Could someone review the patch I posted a couple of weeks ago that fixes running of test cases
from a build directory?
http://subversion.tigris.org/servlets/ReadMsg?msgId=39043&listName=dev
thanks
Mo DeJong
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org