SCons / runtest.py

Diff from to

runtest.py

 if not hasattr(os, 'WEXITSTATUS'):
     os.WEXITSTATUS = lambda x: x
 
+cwd = os.getcwd()
+
 all = 0
 baseline = 0
+builddir = os.path.join(cwd, 'build')
 debug = ''
 execute_tests = 1
 format = None
 sp = None
 spe = None
 
-cwd = os.getcwd()
-
 helpstr = """\
 Usage: runtest.py [OPTIONS] [TEST ...]
 Options:
   -a, --all                   Run all tests.
   --aegis                     Print results in Aegis format.
   -b BASE, --baseline BASE    Run test scripts against baseline BASE.
+  --builddir DIR              Directory in which packages were built.
   -d, --debug                 Run test scripts under the Python debugger.
   -f FILE, --file FILE        Run tests in specified FILE.
   -h, --help                  Print this message and exit.
 """
 
 opts, args = getopt.getopt(sys.argv[1:], "ab:df:hlno:P:p:qv:Xx:t",
-                            ['all', 'aegis', 'baseline=',
+                            ['all', 'aegis', 'baseline=', 'builddir=',
                              'debug', 'file=', 'help',
                              'list', 'no-exec', 'noqmtest', 'output=',
                              'package=', 'passed', 'python=',
         all = 1
     elif o in ['-b', '--baseline']:
         baseline = a
+    elif o in ['--builddir']:
+        builddir = a
+        if not os.path.isabs(builddir):
+            builddir = os.path.normpath(os.path.join(cwd, builddir))
     elif o in ['-d', '--debug']:
         for dir in sys.path:
             pdb = os.path.join(dir, 'pdb.py')
 if spe is None:
     spe = []
 
+sp.append(builddir)
 sp.append(cwd)
 
 #
         sys.stderr.write("Unknown package '%s'\n" % package)
         sys.exit(2)
 
-    test_dir = os.path.join(cwd, 'build', 'test-%s' % package)
+    test_dir = os.path.join(builddir, 'test-%s' % package)
 
     if dir[package] is None:
         scons_script_dir = test_dir
         scons_lib_dir = os.path.join(test_dir, dir[package], 'lib', l)
         pythonpath_dir = scons_lib_dir
 
-    scons_runtest_dir = os.path.join(cwd, 'build')
+    scons_runtest_dir = builddir
 
 else:
     sd = None
     qmtest_args = [ qmtest, ]
 
     if format == '--aegis':
-        dir = os.path.join(cwd, 'build')
+        dir = builddir
         if not os.path.isdir(dir):
             dir = cwd
         qmtest_args.extend(['-D', dir])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.