tests/run-tests.py
changeset 21321 d06b09dc80a5
parent 21320 e5eed8ded168
child 21322 512968bfb00a
equal deleted inserted replaced
21320:e5eed8ded168 21321:d06b09dc80a5
   549 
   549 
   550     Test instances can be run multiple times via run(). However, multiple
   550     Test instances can be run multiple times via run(). However, multiple
   551     runs cannot be run concurrently.
   551     runs cannot be run concurrently.
   552     """
   552     """
   553 
   553 
   554     def __init__(self, test, path, options, count, refpath):
   554     def __init__(self, test, path, options, count, refpath, errpath):
   555         self._test = test
   555         self._test = test
   556         self._path = path
   556         self._path = path
   557         self._options = options
   557         self._options = options
   558         self._count = count
   558         self._count = count
   559         self._daemonpids = []
   559         self._daemonpids = []
       
   560         self._refpath = refpath
       
   561         self._errpath = errpath
   560 
   562 
   561         # If we're not in --debug mode and reference output file exists,
   563         # If we're not in --debug mode and reference output file exists,
   562         # check test output against it.
   564         # check test output against it.
   563         if options.debug:
   565         if options.debug:
   564             self._refout = None # to match "out is None"
   566             self._refout = None # to match "out is None"
   578 
   580 
   579         if self._threadtmp and not self._options.keep_tmpdir:
   581         if self._threadtmp and not self._options.keep_tmpdir:
   580             shutil.rmtree(self._threadtmp, True)
   582             shutil.rmtree(self._threadtmp, True)
   581 
   583 
   582     def run(self, result):
   584     def run(self, result):
       
   585         # Remove any previous output files.
       
   586         if os.path.exists(self._errpath):
       
   587             os.remove(self._errpath)
       
   588 
   583         testtmp = os.path.join(self._threadtmp, os.path.basename(self._path))
   589         testtmp = os.path.join(self._threadtmp, os.path.basename(self._path))
   584         os.mkdir(testtmp)
   590         os.mkdir(testtmp)
   585         replacements, port = self._getreplacements(testtmp)
   591         replacements, port = self._getreplacements(testtmp)
   586         env = self._getenv(testtmp, port)
   592         env = self._getenv(testtmp, port)
   587         self._daemonpids.append(env['DAEMON_PIDS'])
   593         self._daemonpids.append(env['DAEMON_PIDS'])
  1088     else:
  1094     else:
  1089         return skip("unknown test type")
  1095         return skip("unknown test type")
  1090 
  1096 
  1091     vlog("# Test", test)
  1097     vlog("# Test", test)
  1092 
  1098 
  1093     if os.path.exists(err):
  1099     t = runner(test, testpath, options, count, ref, err)
  1094         os.remove(err)       # Remove any previous output files
       
  1095 
       
  1096     t = runner(test, testpath, options, count, ref)
       
  1097     res = TestResult()
  1100     res = TestResult()
  1098     t.run(res)
  1101     t.run(res)
  1099     t.cleanup()
  1102     t.cleanup()
  1100 
  1103 
  1101     if res.exception:
  1104     if res.exception: