tests/run-tests.py
changeset 21447 f8c5b8a288c5
parent 21446 9a3b4f795f62
child 21448 f2dbbcacc763
equal deleted inserted replaced
21446:9a3b4f795f62 21447:f8c5b8a288c5
   354         self._daemonpids = []
   354         self._daemonpids = []
   355         self._refpath = refpath
   355         self._refpath = refpath
   356         self._errpath = errpath
   356         self._errpath = errpath
   357         self._unittest = unittest
   357         self._unittest = unittest
   358 
   358 
       
   359         self._finished = None
       
   360 
   359         # If we're not in --debug mode and reference output file exists,
   361         # If we're not in --debug mode and reference output file exists,
   360         # check test output against it.
   362         # check test output against it.
   361         if runner.options.debug:
   363         if runner.options.debug:
   362             self._refout = None # to match "out is None"
   364             self._refout = None # to match "out is None"
   363         elif os.path.exists(refpath):
   365         elif os.path.exists(refpath):
   377         if self._threadtmp and not self._options.keep_tmpdir:
   379         if self._threadtmp and not self._options.keep_tmpdir:
   378             shutil.rmtree(self._threadtmp, True)
   380             shutil.rmtree(self._threadtmp, True)
   379 
   381 
   380     def setUp(self):
   382     def setUp(self):
   381         """Tasks to perform before run()."""
   383         """Tasks to perform before run()."""
       
   384         self._finished = False
   382 
   385 
   383     def run(self):
   386     def run(self):
   384         """Run this test instance.
   387         """Run this test instance.
   385 
   388 
   386         This will return a tuple describing the result of the test.
   389         This will return a tuple describing the result of the test.
   387         """
   390         """
       
   391         if not self._unittest:
       
   392             self.setUp()
       
   393 
   388         if not os.path.exists(self._path):
   394         if not os.path.exists(self._path):
   389             return self.skip("Doesn't exist")
   395             return self.skip("Doesn't exist")
   390 
   396 
   391         options = self._options
   397         options = self._options
   392         if not (options.whitelisted and self.name in options.whitelisted):
   398         if not (options.whitelisted and self.name in options.whitelisted):
   424 
   430 
   425         starttime = time.time()
   431         starttime = time.time()
   426         try:
   432         try:
   427             ret, out = self._run(testtmp, replacements, env)
   433             ret, out = self._run(testtmp, replacements, env)
   428             duration = time.time() - starttime
   434             duration = time.time() - starttime
       
   435             self._finished = True
   429         except KeyboardInterrupt:
   436         except KeyboardInterrupt:
   430             duration = time.time() - starttime
   437             duration = time.time() - starttime
   431             log('INTERRUPTED: %s (after %d seconds)' % (self.name, duration))
   438             log('INTERRUPTED: %s (after %d seconds)' % (self.name, duration))
   432             raise
   439             raise
   433         except Exception, e:
   440         except Exception, e: