diff options
author | Steven Knight <knight@baldmt.com> | 2006-07-25 02:30:45 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2006-07-25 02:30:45 (GMT) |
commit | dd9bbc79353ae90b2402c16b1613dad4e502d250 (patch) | |
tree | 42f857f72bb4dcab6d876d1f9c73e0a1dd70d8c2 /runtest.py | |
parent | 57fcbbc5d24fb16f988e4fe3294d5d49abef8e2a (diff) | |
download | SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.zip SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.tar.gz SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.tar.bz2 |
Merged revisions 1441-1539 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r1441 | stevenknight | 2006-04-22 23:06:53 -0400 (Sat, 22 Apr 2006) | 1 line
0.96.D397 - The scons command, branch 0.96.91.
........
r1442 | stevenknight | 2006-04-27 00:45:12 -0400 (Thu, 27 Apr 2006) | 1 line
0.96.D398 - The scons command, branch 0.96.92.
........
r1443 | stevenknight | 2006-04-27 00:49:25 -0400 (Thu, 27 Apr 2006) | 1 line
0.96.D399 - Taskmaster clean-ups in anticipation of refactoring speedups.
........
r1450 | stevenknight | 2006-05-02 00:04:55 -0400 (Tue, 02 May 2006) | 1 line
0.96.D400 - Fix VC+++ 2005 Express detection. (Atul Varma) Fix parsing Intel C compiler Li
........
r1451 | stevenknight | 2006-05-02 01:14:24 -0400 (Tue, 02 May 2006) | 1 line
0.96.D401 - Enhance ParseConfig() to understand -arch and -isysroot options. (Gary Oberbrun
........
r1458 | stevenknight | 2006-05-02 23:21:04 -0400 (Tue, 02 May 2006) | 1 line
0.96.D402 - Make strfunction handling consistent. (David Gruener)
........
r1459 | stevenknight | 2006-05-02 23:37:08 -0400 (Tue, 02 May 2006) | 1 line
0.96.D403 - Comment out the test of CVS checkout from the old tigris.org repository.
........
r1460 | stevenknight | 2006-05-03 23:47:54 -0400 (Wed, 03 May 2006) | 1 line
0.96.D404 - Preserve white space in display Action string. (David Gruener)
........
r1461 | stevenknight | 2006-05-04 09:16:15 -0400 (Thu, 04 May 2006) | 1 line
0.96.D405 - Add MergeFlags() and AddFlags() methods. (Greg Noel) Support recognizing compi
........
r1462 | stevenknight | 2006-05-04 23:46:53 -0400 (Thu, 04 May 2006) | 1 line
0.96.D406 - Fix stack trace when ParseFlags has a null string.
........
r1464 | stevenknight | 2006-05-05 17:21:27 -0400 (Fri, 05 May 2006) | 1 line
0.96.D408 - Fix the string displayed by InstallAs() when called through the default construc
........
r1465 | stevenknight | 2006-05-05 18:30:28 -0400 (Fri, 05 May 2006) | 1 line
0.96.D409 - Fix test/ParseConfig.py, broken in the previous checkin by ParseFlags() changes.
........
r1466 | stevenknight | 2006-05-05 20:42:35 -0400 (Fri, 05 May 2006) | 1 line
0.96.D407 - Avoid recursive calls to main() in SConf test programs. (Karol Pietrzak)
........
r1467 | stevenknight | 2006-05-06 00:27:21 -0400 (Sat, 06 May 2006) | 1 line
0.96.D410 - Catch errors from commands that ParseConfig() calls. (John Pye)
........
r1468 | stevenknight | 2006-05-06 10:55:38 -0400 (Sat, 06 May 2006) | 1 line
0.96.D411 - Significant taskmaster speedup by using reference counts, not list manipulation.
........
r1469 | stevenknight | 2006-05-06 18:38:02 -0400 (Sat, 06 May 2006) | 1 line
0.96.D413 - TeX improvements.
........
r1471 | stevenknight | 2006-05-07 09:07:58 -0400 (Sun, 07 May 2006) | 2 lines
Delete properties interfering with clean .jpg checkout.
........
r1472 | stevenknight | 2006-05-07 09:23:54 -0400 (Sun, 07 May 2006) | 1 line
0.96.D412 - Windows portability fixes for two tests and ParseConfig() execution.
........
r1473 | stevenknight | 2006-05-07 09:30:11 -0400 (Sun, 07 May 2006) | 1 line
0.96.D414 - Various man page and documentation updates.
........
r1474 | stevenknight | 2006-05-07 23:53:12 -0400 (Sun, 07 May 2006) | 1 line
0.96.D415 - Initial infrastructure for executing tests under QMTest. (Stefan Seefeld)
........
r1476 | stevenknight | 2006-05-09 00:03:47 -0400 (Tue, 09 May 2006) | 1 line
0.96.D416 - Fix QMTest infrastructure to avoid listing directories with no tests and to find
........
r1477 | stevenknight | 2006-05-16 06:47:51 -0400 (Tue, 16 May 2006) | 1 line
0.96.D417 - Fix Alias turning Entries into Nodes or Dirs too soon.
........
r1478 | stevenknight | 2006-05-17 08:32:58 -0400 (Wed, 17 May 2006) | 1 line
0.96.D418 - Next QMTest changes (including fixing copyrights).
........
r1479 | stevenknight | 2006-05-18 05:07:06 -0400 (Thu, 18 May 2006) | 1 line
0.96.D419 - Fix DVIPDF tests after recent changes.
........
r1497 | stevenknight | 2006-05-23 08:47:01 -0400 (Tue, 23 May 2006) | 1 line
0.96.D420 - Better error message when trying to build a file from an unknown sufix. (Gary O
........
r1498 | stevenknight | 2006-05-23 09:38:52 -0400 (Tue, 23 May 2006) | 1 line
0.96.D421 - Suppress duplicate entries in latest TeX patch. (Joel B. Mohler)
........
r1499 | stevenknight | 2006-05-23 22:00:06 -0400 (Tue, 23 May 2006) | 1 line
0.96.D422 - Add tests for tuple variable expansion. (Gary Oberbrunner)
........
r1515 | stevenknight | 2006-06-12 06:44:24 -0400 (Mon, 12 Jun 2006) | 1 line
0.96.D423 - More QMTest work: start giving runtest.py its own tests, more functionality for
........
r1517 | stevenknight | 2006-06-21 07:34:30 -0400 (Wed, 21 Jun 2006) | 1 line
0.96.D424 - Move test/Configure.py and test/Options.py to avoid confusion with similarly-nam
........
r1518 | stevenknight | 2006-06-21 12:40:37 -0400 (Wed, 21 Jun 2006) | 1 line
0.96.D425 - Change the QMTest infrastructure to use File naming, not Python. Rename tests w
........
r1533 | stevenknight | 2006-07-23 20:10:08 -0400 (Sun, 23 Jul 2006) | 1 line
0.96.D426 - Fix ramifications of changing when Node disambiguation happens.
........
r1535 | stevenknight | 2006-07-24 06:40:43 -0400 (Mon, 24 Jul 2006) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-1534" from
http://scons.tigris.org/svn/scons/trunk
........
r1536 | stevenknight | 2006-07-24 21:45:40 -0400 (Mon, 24 Jul 2006) | 2 lines
Remove svnmerge-integrated property to start over.
........
r1538 | stevenknight | 2006-07-24 21:51:32 -0400 (Mon, 24 Jul 2006) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-1440" from
http://scons.tigris.org/svn/scons/trunk
........
Diffstat (limited to 'runtest.py')
-rw-r--r-- | runtest.py | 186 |
1 files changed, 155 insertions, 31 deletions
@@ -8,7 +8,7 @@ # 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). +# ./src/ (source files we ship) and ./QMTest/ (other modules we don't). # # HOWEVER, now that SCons has Repository support, we don't have # Aegis copy all of the files into the local tree. So if you're @@ -62,6 +62,10 @@ # command line it will execute before # executing it. This suppresses that print. # +# --sp The Aegis search path. +# +# --spe The Aegis executable search path. +# # -t Print the execution time of each test. # # -X The scons "script" is an executable; don't @@ -93,6 +97,7 @@ import sys import time all = 0 +baseline = 0 debug = '' execute_tests = 1 format = None @@ -104,14 +109,13 @@ print_passed_summary = None scons = None scons_exec = None outputfile = None +qmtest = None testlistfile = None version = '' -print_time = lambda fmt, time: None - -if os.name == 'java': - python = os.path.join(sys.prefix, 'jython') -else: - python = sys.executable +print_times = None +python = None +sp = None +spe = None cwd = os.getcwd() @@ -127,6 +131,7 @@ 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. -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. @@ -145,7 +150,10 @@ Options: tar-gz .tar.gz distribution zip .zip distribution --passed Summarize which tests passed. + --qmtest Run using the QMTest harness. -q, --quiet Don't print the test being executed. + --sp PATH The Aegis search path. + --spe PATH The Aegis executable search path. -t, --time Print test execution time. -v version Specify the SCons version. --verbose=LEVEL Set verbose level: 1 = print executed commands, @@ -156,17 +164,20 @@ Options: --xml Print results in SCons XML format. """ -opts, args = getopt.getopt(sys.argv[1:], "adf:hlno:P:p:qv:Xx:t", - ['all', 'aegis', +opts, args = getopt.getopt(sys.argv[1:], "ab:df:hlno:P:p:qv:Xx:t", + ['all', 'aegis', 'baseline=', 'debug', 'file=', 'help', 'list', 'no-exec', 'output=', - 'package=', 'passed', 'python=', 'quiet', + 'package=', 'passed', 'python=', + 'qmtest', 'quiet', 'spe=', 'version=', 'exec=', 'time', 'verbose=', 'xml']) for o, a in opts: if o in ['-a', '--all']: all = 1 + elif o in ['-b', '--baseline']: + baseline = a elif o in ['-d', '--debug']: debug = os.path.join(lib_dir, "pdb.py") elif o in ['-f', '--file']: @@ -190,10 +201,16 @@ for o, a in opts: print_passed_summary = 1 elif o in ['-P', '--python']: python = a + elif o in ['--qmtest']: + qmtest = 1 elif o in ['-q', '--quiet']: printcommand = 0 + elif o in ['--sp']: + sp = string.split(a, os.pathsep) + elif o in ['--spe']: + spe = string.split(a, os.pathsep) elif o in ['-t', '--time']: - print_time = lambda fmt, time: sys.stdout.write(fmt % time) + print_times = 1 elif o in ['--verbose']: os.environ['TESTCMD_VERBOSE'] = a elif o in ['-v', '--version']: @@ -219,14 +236,21 @@ def whereis(file): aegis = whereis('aegis') -sp = [] +if format == '--aegis' and aegis: + change = os.popen("aesub '$c' 2>/dev/null", "r").read() + if change: + if sp is None: + paths = os.popen("aesub '$sp' 2>/dev/null", "r").read()[:-1] + sp = string.split(paths, os.pathsep) + if spe is None: + spe = os.popen("aesub '$spe' 2>/dev/null", "r").read()[:-1] + spe = string.split(spe, os.pathsep) + else: + aegis = None -if aegis: - paths = os.popen("aesub '$sp' 2>/dev/null", "r").read()[:-1] - sp.extend(string.split(paths, os.pathsep)) - spe = os.popen("aesub '$spe' 2>/dev/null", "r").read()[:-1] - spe = string.split(spe, os.pathsep) -else: +if sp is None: + sp = [] +if spe is None: spe = [] sp.append(cwd) @@ -330,7 +354,9 @@ format_class = { } Test = format_class[format] -if args: +if qmtest: + pass +elif args: if spe: for a in args: if os.path.isabs(a): @@ -376,7 +402,7 @@ elif all: tdict[t] = Test(t) os.path.walk('test', find_py, 0) - if aegis: + if format == '--aegis' and aegis: cmd = "aegis -list -unf pf 2>/dev/null" for line in os.popen(cmd, "r").readlines(): a = string.split(line) @@ -469,9 +495,43 @@ else: # spe = map(lambda x: os.path.join(x, 'src', 'engine'), spe) # ld = string.join(spe, os.pathsep) - scons_script_dir = sd or os.path.join(cwd, 'src', 'script') + if not baseline or baseline == '.': + base = cwd + elif baseline == '-': + # Tentative code for fetching information directly from the + # QMTest context file. + # + #import qm.common + #import qm.test.context + #qm.rc.Load("test") + #context = qm.test.context.Context() + #context.Read('context') + + url = None + svn_info = os.popen("svn info 2>&1", "r").read() + match = re.search('URL: (.*)', svn_info) + if match: + url = match.group(1) + if not url: + sys.stderr.write('runtest.py: could not find a URL:\n') + sys.stderr.write(svn_info) + sys.exit(1) + import tempfile + base = tempfile.mkdtemp(prefix='runtest-tmp-') + + command = 'cd %s && svn co -q %s' % (base, url) + + base = os.path.join(base, os.path.split(url)[1]) + if printcommand: + print command + if execute_tests: + os.system(command) + else: + base = baseline - scons_lib_dir = ld or os.path.join(cwd, 'src', 'engine') + scons_script_dir = sd or os.path.join(base, 'src', 'script') + + scons_lib_dir = ld or os.path.join(base, 'src', 'engine') pythonpath_dir = scons_lib_dir @@ -496,9 +556,16 @@ os.environ['SCONS_VERSION'] = version old_pythonpath = os.environ.get('PYTHONPATH') pythonpaths = [ pythonpath_dir ] -for p in sp: - pythonpaths.append(os.path.join(p, 'build', 'etc')) - pythonpaths.append(os.path.join(p, 'etc')) + +for dir in sp: + if format == '--aegis': + q = os.path.join(dir, 'build', 'QMTest') + else: + q = os.path.join(dir, 'QMTest') + pythonpaths.append(q) + +os.environ['SCONS_SOURCE_PATH_EXECUTABLE'] = string.join(spe, os.pathsep) + os.environ['PYTHONPATH'] = string.join(pythonpaths, os.pathsep) if old_pythonpath: @@ -506,10 +573,49 @@ if old_pythonpath: os.pathsep + \ old_pythonpath -try: - os.chdir(scons_script_dir) -except OSError: - pass +if qmtest: + if baseline: + result_stream = 'AegisBaselineStream' + qmr_file = 'baseline.qmr' + else: + result_stream = 'AegisChangeStream' + qmr_file = 'results.qmr' + #qmtest = r'D:\Applications\python23\scripts\qmtest.py' + qmtest = 'qmtest.py' + qmtest_args = [ + qmtest, + 'run', + '--output %s' % qmr_file, + '--format none', + '--result-stream=scons_tdb.%s' % result_stream, + ] + + if python: + qmtest_args.append('--context python=%s' % python) + + if print_times: + qmtest_args.append('--context print_time=1') + + if outputfile: + #rs = '--result-stream=scons_tdb.AegisBatchStream(results_file=\\"%s\\")' % outputfile + rs = '\'--result-stream=scons_tdb.AegisBatchStream(results_file="%s")\'' % outputfile + qmtest_args.append(rs) + + os.environ['SCONS'] = os.path.join(cwd, 'src', 'script', 'scons.py') + + cmd = string.join(qmtest_args + args, ' ') + if printcommand: + sys.stdout.write(cmd + '\n') + sys.stdout.flush() + status = 0 + if execute_tests: + status = os.system(cmd) + sys.exit(status) + +#try: +# os.chdir(scons_script_dir) +#except OSError: +# pass class Unbuffered: def __init__(self, file): @@ -527,9 +633,27 @@ if list_only: sys.stdout.write(t.abspath + "\n") sys.exit(0) +# +if not python: + if os.name == 'java': + python = os.path.join(sys.prefix, 'jython') + else: + python = sys.executable + # time.clock() is the suggested interface for doing benchmarking timings, # but time.time() does a better job on Linux systems, so let that be # the non-Windows default. + +if print_times: + print_time_func = lambda fmt, time: sys.stdout.write(fmt % time) +else: + print_time_func = lambda fmt, time: None + +if sys.platform == 'win32': + time_func = time.clock +else: + time_func = time.time + if sys.platform == 'win32': time_func = time.clock else: @@ -548,10 +672,10 @@ for t in tests: if execute_tests: t.execute() t.test_time = time_func() - test_start_time - print_time("Test execution time: %.1f seconds\n", t.test_time) + print_time_func("Test execution time: %.1f seconds\n", t.test_time) if len(tests) > 0: tests[0].total_time = time_func() - total_start_time - print_time("Total execution time for all tests: %.1f seconds\n", tests[0].total_time) + print_time_func("Total execution time for all tests: %.1f seconds\n", tests[0].total_time) passed = filter(lambda t: t.status == 0, tests) fail = filter(lambda t: t.status == 1, tests) |