[pypy-svn] r59802 - in pypy/build/testrunner: . test
fijal at codespeak.net
fijal at codespeak.net
Sat Nov 8 15:44:55 CET 2008
Author: fijal
Date: Sat Nov 8 15:44:53 2008
New Revision: 59802
Modified:
pypy/build/testrunner/runner.py
pypy/build/testrunner/test/test_runner.py
Log:
add support for scratchbox
Modified: pypy/build/testrunner/runner.py
==============================================================================
--- pypy/build/testrunner/runner.py (original)
+++ pypy/build/testrunner/runner.py Sat Nov 8 15:44:53 2008
@@ -51,6 +51,13 @@
finally:
f.close()
+def args_for_scratchbox(cwd, args):
+ return ['/scratchbox/login', '-d', str(cwd)] + args
+
+
+def run_scratchbox(args, cwd, out, timeout=None):
+ return run(args_for_scratchbox(cwd, args), cwd, out, timeout)
+
def dry_run(args, cwd, out, timeout=None):
f = out.open('w')
try:
@@ -66,13 +73,15 @@
return 'signal %d' % (n,)
def execute_test(cwd, test, out, logfname, interp, test_driver,
- do_dry_run=False, timeout=None):
+ do_dry_run=False, timeout=None, run_scratchbox=False):
args = interp+test_driver
args += ['--resultlog=%s' % logfname, test]
args = map(str, args)
if do_dry_run:
runfunc = dry_run
+ elif run_scratchbox:
+ runfunc = run_scratchbox
else:
runfunc = run
@@ -118,7 +127,8 @@
exitcode = execute_test(root, test, one_output, logfname,
interp, test_driver, do_dry_run=dry_run,
- timeout=timeout)
+ timeout=timeout,
+ run_scratchbox=run_param.scratchbox)
# xxx cfg cleanup after testdir
@@ -197,6 +207,7 @@
interp = [os.path.abspath(sys.executable)]
test_driver = [os.path.abspath(os.path.join('py', 'bin', 'py.test'))]
parallel_runs = 1
+ scratchbox = False
timeout = None
cherrypick = None
@@ -253,7 +264,9 @@
help="number of parallel test runs")
parser.add_option("--dry-run", dest="dry_run", default=False,
action="store_true",
- help="dry run")
+ help="dry run"),
+ parser.add_option("--scratchbox", dest="scratchbox", default=False,
+ action="store_true"),
parser.add_option("--timeout", dest="timeout", default=None,
type="int",
help="timeout in secs for test processes")
@@ -297,6 +310,7 @@
if opts.timeout:
run_param.timeout = opts.timeout
run_param.dry_run = opts.dry_run
+ run_param.scratchbox = opts.scratchbox
if run_param.dry_run:
print >>out, run_param.__dict__
Modified: pypy/build/testrunner/test/test_runner.py
==============================================================================
--- pypy/build/testrunner/test/test_runner.py (original)
+++ pypy/build/testrunner/test/test_runner.py Sat Nov 8 15:44:53 2008
@@ -114,8 +114,11 @@
assert failure
assert extralog == """! test_foo
Killed by SIGSEGV.
-"""
+"""
+ def test_scratchbox(self):
+ expected = ['/scratchbox/login', '-d', 'x/y', 'a', 'b']
+ assert runner.args_for_scratchbox('x/y', ['a', 'b']) == expected
class RunnerTests(object):
with_thread = True
More information about the Pypy-commit
mailing list