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

Re: running 'make check' when builddir != srcdir

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-01-17 17:27:45 CET

Philip Martin <philip@codematters.co.uk> writes:

> I don't know how to tweak build.conf to create the missing
> directories, however I can create them by hand for now. The following
> patch allows nearly everything else to work. Only update_tests.py
> fails as it cannot locate theta.png. Suggestions/solutions to these
> problems are welcome.

OK, after reading some Python documentation, I have fixed the above
problems. So now the following patch enables 'make check' when
builddir != srcdir. The scripts still run if you cd into the directory
and run them by hand, and of course 'make check' for builddir==srcdir
works as before.

So, how about this patch?

* Makefile.in: Use full path to scripts in 'check' target. Remove
  unnecessary chmod.

* gen-make.py: Add the directories for scripts to BUILD_DIRS

* subversion/tests/clients/cmdline/update_tests.py: Use sys.path to
  locate theta.png file.

* subversion/tests/clients/cmdline/xmltests/svn-test.sh: Accept two optional
  parameters to define paths into builddir and srcdir.

* subversion/tests/clients/cmdline/xmltests/svn-test2.sh: Accept two optional
  parameters to define paths into builddir and srcdir.

Index: ./Makefile.in
===================================================================
--- ./Makefile.in
+++ ./Makefile.in Thu Jan 17 16:23:38 2002
@@ -117,15 +117,14 @@
         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 $$progbase | grep \\.py$$ > /dev/null; then \
- runprog="$(PYTHON) $$progbase" ; \
+ runprog="$(PYTHON) $(abs_srcdir)/$$prog" ; \
             elif echo $$progbase | grep \\.sh$$ > /dev/null; then \
- runprog="$(SHELL) $$progbase" ; \
+ runprog="$(SHELL) $(abs_srcdir)/$$prog $(abs_builddir)/$$progdir $(abs_srcdir)/$$progdir" ; \
             elif test -x $$prog ; then \
                 runprog="./$$progbase" ; \
             else \
Index: ./gen-make.py
===================================================================
--- ./gen-make.py
+++ ./gen-make.py Thu Jan 17 15:58:03 2002
@@ -153,8 +153,6 @@
 
     ofile.write('%s: %s\n\n' % (g_name, string.join(target_names)))
 
- ofile.write('BUILD_DIRS = %s\n' % string.join(target_dirs.keys()))
-
   cfiles = [ ]
   for target in targets.values():
     # .la files are handled by the standard 'clean' rule; clean all the
@@ -248,8 +246,15 @@
   scripts, s_errors = _collect_paths(parser.get('test-scripts', 'paths'))
   errors = errors or s_errors
 
+ script_dirs = []
+ for script in scripts:
+ script_dirs.append(re.compile("[-a-z0-9A-Z_.]*$").sub("", script))
+
   fs_scripts, fs_errors = _collect_paths(parser.get('fs-test-scripts', 'paths'))
   errors = errors or fs_errors
+
+ ofile.write('BUILD_DIRS = %s %s\n' % (string.join(target_dirs.keys()),
+ string.join(script_dirs)))
 
   ofile.write('FS_TEST_DEPS = %s\n\n' % string.join(fs_test_deps + fs_scripts))
   ofile.write('FS_TEST_PROGRAMS = %s\n\n' %
Index: ./subversion/tests/clients/cmdline/update_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/update_tests.py
+++ ./subversion/tests/clients/cmdline/update_tests.py Thu Jan 17 14:33:59 2002
@@ -87,7 +87,7 @@
     return 1
 
   # Add a binary file to the project.
- fp = open("theta.png")
+ fp = open(os.path.join(sys.path[0], "theta.png"))
   theta_contents = fp.read() # suck up contents of a test .png file
   fp.close()
 
@@ -212,7 +212,7 @@
     return 1
 
   # Suck up contents of a test .png file.
- fp = open("theta.png")
+ fp = open(os.path.join(sys.path[0], "theta.png"))
   theta_contents = fp.read()
   fp.close()
 
Index: ./subversion/tests/clients/cmdline/xmltests/svn-test.sh
===================================================================
--- ./subversion/tests/clients/cmdline/xmltests/svn-test.sh
+++ ./subversion/tests/clients/cmdline/xmltests/svn-test.sh Wed Jan 16 23:45:02 2002
@@ -1,7 +1,15 @@
 #!/bin/sh
 
 SVN_PROG=../../../../clients/cmdline/svn
+SVN_PROG_UP=../${SVN_PROG}
 XML_DIR=../../../xml
+if [ "x${1}" != "x" ]; then
+ SVN_PROG=${1}/${SVN_PROG}
+ SVN_PROG_UP=${SVN_PROG}
+fi
+if [ "x${2}" != "x" ]; then
+ XML_DIR=${2}/${XML_DIR}
+fi
 TEST_DIR_1=t1
 TEST_DIR_2=t2
 COMMIT_RESULTFILE_NAME=commit
@@ -75,7 +83,7 @@
 ### Commit.
 echo "Committing changes in ${TEST_DIR_1}."
 (cd ${TEST_DIR_1}; \
- ../${SVN_PROG} commit --xml-file ../${COMMIT_RESULTFILE_NAME}-2.xml \
+ ${SVN_PROG_UP} commit --xml-file ../${COMMIT_RESULTFILE_NAME}-2.xml \
                 --revision 2; \
  )
 
@@ -84,7 +92,7 @@
 ### Update.
 echo "Updating ${TEST_DIR_2} from changes in ${TEST_DIR_1}."
 (cd ${TEST_DIR_2}; \
- ../${SVN_PROG} update --xml-file ../${COMMIT_RESULTFILE_NAME}-2.xml \
+ ${SVN_PROG_UP} update --xml-file ../${COMMIT_RESULTFILE_NAME}-2.xml \
                 --revision 2; \
  )
 
@@ -116,7 +124,7 @@
 ### Commit.
 echo "Committing changes, this time from ${TEST_DIR_2}."
 (cd ${TEST_DIR_2}; \
- ../${SVN_PROG} commit --xml-file ../${COMMIT_RESULTFILE_NAME}-3.xml \
+ ${SVN_PROG_UP} commit --xml-file ../${COMMIT_RESULTFILE_NAME}-3.xml \
                 --revision 3; \
  )
 
@@ -126,7 +134,7 @@
 ### Update.
 echo "Updating ${TEST_DIR_1} from changes in ${TEST_DIR_2}."
 (cd ${TEST_DIR_1}; \
- ../${SVN_PROG} update --xml-file ../${COMMIT_RESULTFILE_NAME}-3.xml \
+ ${SVN_PROG_UP} update --xml-file ../${COMMIT_RESULTFILE_NAME}-3.xml \
                 --revision 3; \
  )
 
@@ -165,7 +173,7 @@
 ### Commit.
 echo "Committing changes for merge, from ${TEST_DIR_1}."
 (cd ${TEST_DIR_1}; \
- ../${SVN_PROG} commit --xml-file ../${COMMIT_RESULTFILE_NAME}-4.xml \
+ ${SVN_PROG_UP} commit --xml-file ../${COMMIT_RESULTFILE_NAME}-4.xml \
                 --revision 4; \
  )
 
@@ -175,7 +183,7 @@
 ### Update.
 echo "Updating ${TEST_DIR_2}, merging changes from ${TEST_DIR_1}."
 (cd ${TEST_DIR_2}; \
- ../${SVN_PROG} update --xml-file ../${COMMIT_RESULTFILE_NAME}-4.xml \
+ ${SVN_PROG_UP} update --xml-file ../${COMMIT_RESULTFILE_NAME}-4.xml \
                 --revision 4; \
  )
 
Index: ./subversion/tests/clients/cmdline/xmltests/svn-test2.sh
===================================================================
--- ./subversion/tests/clients/cmdline/xmltests/svn-test2.sh
+++ ./subversion/tests/clients/cmdline/xmltests/svn-test2.sh Wed Jan 16 23:47:25 2002
@@ -3,7 +3,17 @@
 # Testing merging and conflict resolution.
 
 SVN_PROG=../../../../clients/cmdline/svn
+SVN_PROG_UP=../${SVN_PROG}
 XML_DIR=../../../xml
+XML_DIR_UP=../${XML_DIR}
+if [ "x${1}" != "x" ]; then
+ SVN_PROG=${1}/${SVN_PROG}
+ SVN_PROG_UP=${SVN_PROG}
+fi
+if [ "x${2}" != "x" ]; then
+ XML_DIR=${2}/${XML_DIR}
+ XML_DIR_UP=${XML_DIR}
+fi
 TEST_DIR_1=t1
 TEST_DIR_2=t2
 COMMIT_RESULTFILE_NAME=commit2
@@ -38,14 +48,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_UP} update --xml-file ${XML_DIR_UP}/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_UP} update --xml-file ${XML_DIR}/up5.xml --revision 18)
 
 check_status 3
 
@@ -91,14 +101,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_UP} 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_UP} update --xml-file ${XML_DIR}/pipatch.xml --revision 21)
 
 check_status 10
 

-- 
Philip
---------------------------------------------------------------------
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:57 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.