mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 903606 - Use mozfile.TemporaryDirectory in cppunittest scripts;r=ted
This commit is contained in:
parent
b1c2b07b0e
commit
eaaf70938d
@ -132,7 +132,7 @@ class RemoteCPPUnitTests(cppunittests.CPPUnitTests):
|
||||
returncode = self.device.shell([remote_bin], buf, env=env, cwd=self.remote_home_dir,
|
||||
timeout=cppunittests.CPPUnitTests.TEST_PROC_TIMEOUT)
|
||||
print >> sys.stdout, buf.getvalue()
|
||||
with cppunittests.TemporaryDirectory() as tempdir:
|
||||
with mozfile.TemporaryDirectory() as tempdir:
|
||||
self.device.getDirectory(self.remote_home_dir, tempdir)
|
||||
if mozcrash.check_for_crashes(tempdir, symbols_path,
|
||||
test_name=basename):
|
||||
|
@ -7,17 +7,11 @@
|
||||
from __future__ import with_statement
|
||||
import sys, os, tempfile, shutil
|
||||
from optparse import OptionParser
|
||||
import mozprocess, mozinfo, mozlog, mozcrash
|
||||
import mozprocess, mozinfo, mozlog, mozcrash, mozfile
|
||||
from contextlib import contextmanager
|
||||
|
||||
log = mozlog.getLogger('cppunittests')
|
||||
|
||||
@contextmanager
|
||||
def TemporaryDirectory():
|
||||
tempdir = tempfile.mkdtemp()
|
||||
yield tempdir
|
||||
shutil.rmtree(tempdir)
|
||||
|
||||
class CPPUnitTests(object):
|
||||
# Time (seconds) to wait for test process to complete
|
||||
TEST_PROC_TIMEOUT = 1200
|
||||
@ -38,7 +32,7 @@ class CPPUnitTests(object):
|
||||
"""
|
||||
basename = os.path.basename(prog)
|
||||
log.info("Running test %s", basename)
|
||||
with TemporaryDirectory() as tempdir:
|
||||
with mozfile.TemporaryDirectory() as tempdir:
|
||||
proc = mozprocess.ProcessHandler([prog],
|
||||
cwd=tempdir,
|
||||
env=env)
|
||||
|
Loading…
Reference in New Issue
Block a user