runtest.py follow-on fixes
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 10 Sep 2001 16:17:42 +0000 (16:17 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Mon, 10 Sep 2001 16:17:42 +0000 (16:17 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@35 fdb21ef1-2011-0410-befe-b5e4ea1792b1

README
config
runtest.py

diff --git a/README b/README
index 132abcdc9ecc899fc0e120bdfaffdc3d66b67098..0ce7716b038a0b83d037754dfe728f2d7366e988 100644 (file)
--- a/README
+++ b/README
@@ -27,13 +27,11 @@ etc/
         their own just to help out with SCons development.
 
 runtest.py
-runtest.sh
-        Scripts for running our tests.  The Python version is used
-        by Aegis for running tests against a copy of the source as
-        extracted from an archive.  The shell version runs tests against
-        the local src/ tree, so you don't have to do a build before
-        testing your changes.  (Hmm, that should probably just be an
-        option to runtest.py...)
+       Script for running our tests.  By default, this will run a
+       test against the code in the local src/ tree, so you don't
+       have to do a build before testing your changes.  Aegis uses
+       it with an option that requires that you've done a build
+       (aeb) before running tests.
 
 src/
        Where the actual source code is kept, of course.
diff --git a/config b/config
index d653bb2db4481d94c4307c572982e59cef9300f3..9618a967103c649ddfa589fbac7792cc7f48409b 100644 (file)
--- a/config
+++ b/config
@@ -242,7 +242,7 @@ diff_command =
  * written to conform to Perl conventions) and Aegis' expectations.
  * See the comments in the test.pl script itself for details.
  */
-test_command = "python runtest.py -b aegis -v ${VERsion} ${File_Name}";
+test_command = "python runtest.py -b aegis -q -v ${VERsion} ${File_Name}";
 
 new_test_filename = "test/CHANGETHIS.py";
 
index 3181757fc3687ee35ce6eaeba7ebb42598f36172..965e24c9e23e372e3b65e379aa5a1a83659a1985 100644 (file)
@@ -1,4 +1,38 @@
 #!/usr/bin/env python
+#
+# runtests.py - wrapper script for running SCons tests
+#
+# This script mainly exists to set PYTHONPATH to the right list of
+# directories to test the SCons modules.
+#
+# By default, it directly uses the modules in the local tree:
+# ./src/ (source files we ship) and ./etc/ (other modules we don't)
+#
+# When "-b aegis" is specified, it assumes it's in a directory
+# in which an Aegis build (aeb) has been performed, and sets
+# PYTHONPATH so that it *only* references the modules that have
+# unpacked from the built packages, to test whether the packages
+# are good.
+#
+# Options:
+#
+#      -a              Run all tests; does a virtual 'find' for
+#                      all SCons tests under the current directory.
+#
+#      -b system       Assume you're in the specified built system.
+#                      'aegis' is the only one currently defined.
+#
+#      -d              Debug.  Runs the script under the Python
+#                      debugger (pdb.py) so you don't have to
+#                      muck with PYTHONPATH yourself.
+#
+#      -q              Quiet.  By default, runtest.py prints the
+#                      command line it will execute before
+#                      executing it.  This suppresses that print.
+#
+#      -v              Version.  Specifies the version number to
+#                      be used for Aegis interaction.
+#
 
 import getopt
 import os
@@ -11,15 +45,21 @@ all = 0
 build = None
 debug = ''
 tests = []
+printcmd = 1
 version = None
 
-opts, tests = getopt.getopt(sys.argv[1:], "ab:dv:",
-                           ['all','build=','debug','version='])
+opts, tests = getopt.getopt(sys.argv[1:], "ab:dqv:",
+                           ['all','build=','debug','quiet','version='])
 
 for o, a in opts:
     if o == '-a' or o == '--all': all = 1
-    elif o == '-b' or o == '-build': build = a
-    elif o == '-d' or o == '--debug': debug = "/usr/lib/python1.5/pdb.py"
+    elif o == '-b' or o == '--build': build = a
+    elif o == '-d' or o == '--debug': debug = os.path.join(
+                                       sys.exec_prefix,
+                                       "lib",
+                                       "python" + sys.version[0:3],
+                                       "pdb.py")
+    elif o == '-q' or o == '--quiet': printcmd = 0
     elif o == '-v' or o == '--version': version = a
 
 cwd = os.getcwd()
@@ -85,7 +125,7 @@ for path in tests:
     else:
        abs = os.path.join(cwd, path)
     cmd = string.join(["python", debug, abs], " ")
-    if all:
+    if printcmd:
        print cmd
     if os.system(cmd):
        fail.append(path)