1. dirkbaechle
  2. SCons


Steven Knight  committed 00bddf4

runtest.py follow-on fixes

  • Participants
  • Parent commits 299289e
  • Branches default

Comments (0)

Files changed (3)


View file
         their own just to help out with SCons development.
-        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.
 	Where the actual source code is kept, of course.

File config

View file
  * 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";

File runtest.py

View file
 #!/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
 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()
 	abs = os.path.join(cwd, path)
     cmd = string.join(["python", debug, abs], " ")
-    if all:
+    if printcmd:
 	print cmd
     if os.system(cmd):