tests/run-tests.py
changeset 6208 c88b9e597588
parent 6004 5af5f0f9d724
child 6209 4e8cd15240bf
equal deleted inserted replaced
6207:03b13d853dc6 6208:c88b9e597588
    36     help="exit on the first test failure")
    36     help="exit on the first test failure")
    37 parser.add_option("-i", "--interactive", action="store_true",
    37 parser.add_option("-i", "--interactive", action="store_true",
    38     help="prompt to accept changed output")
    38     help="prompt to accept changed output")
    39 parser.add_option("-j", "--jobs", type="int",
    39 parser.add_option("-j", "--jobs", type="int",
    40     help="number of jobs to run in parallel")
    40     help="number of jobs to run in parallel")
       
    41 parser.add_option("--keep-tmpdir", action="store_true",
       
    42     help="keep temporary directory after running tests (best used with --tmpdir)")
    41 parser.add_option("-R", "--restart", action="store_true",
    43 parser.add_option("-R", "--restart", action="store_true",
    42     help="restart at last error")
    44     help="restart at last error")
    43 parser.add_option("-p", "--port", type="int",
    45 parser.add_option("-p", "--port", type="int",
    44     help="port on which servers should listen")
    46     help="port on which servers should listen")
    45 parser.add_option("-r", "--retest", action="store_true",
    47 parser.add_option("-r", "--retest", action="store_true",
   131             vlog("# Found prerequisite", p, "at", found)
   133             vlog("# Found prerequisite", p, "at", found)
   132         else:
   134         else:
   133             print "WARNING: Did not find prerequisite tool: "+p
   135             print "WARNING: Did not find prerequisite tool: "+p
   134 
   136 
   135 def cleanup_exit():
   137 def cleanup_exit():
   136     if verbose:
   138     if not options.keep_tmpdir:
   137         print "# Cleaning up HGTMP", HGTMP
   139         if verbose:
   138     shutil.rmtree(HGTMP, True)
   140             print "# Cleaning up HGTMP", HGTMP
       
   141         shutil.rmtree(HGTMP, True)
   139 
   142 
   140 def use_correct_python():
   143 def use_correct_python():
   141     # some tests run python interpreter. they must use same
   144     # some tests run python interpreter. they must use same
   142     # interpreter we use or bad things will happen.
   145     # interpreter we use or bad things will happen.
   143     exedir, exename = os.path.split(sys.executable)
   146     exedir, exename = os.path.split(sys.executable)
   396         os.unlink(DAEMON_PIDS)
   399         os.unlink(DAEMON_PIDS)
   397     except IOError:
   400     except IOError:
   398         pass
   401         pass
   399 
   402 
   400     os.chdir(TESTDIR)
   403     os.chdir(TESTDIR)
   401     shutil.rmtree(tmpd, True)
   404     if not options.keep_tmpdir:
       
   405 	    shutil.rmtree(tmpd, True)
   402     if skipped:
   406     if skipped:
   403         return None
   407         return None
   404     return ret == 0
   408     return ret == 0
   405 
   409 
   406 if not options.child:
   410 if not options.child: