tests/run-tests.py
branchstable
changeset 834 5a6898736b1a
parent 833 a9c6ada32647
child 844 e5e1c16fe5b7
equal deleted inserted replaced
833:a9c6ada32647 834:5a6898736b1a
   452 def shtest(test, options, replacements):
   452 def shtest(test, options, replacements):
   453     cmd = '"%s"' % test
   453     cmd = '"%s"' % test
   454     vlog("# Running", cmd)
   454     vlog("# Running", cmd)
   455     return run(cmd, options, replacements)
   455     return run(cmd, options, replacements)
   456 
   456 
   457 def battest(test, options, replacements):
       
   458     # To reliably get the error code from batch files on WinXP,
       
   459     # the "cmd /c call" prefix is needed. Grrr
       
   460     cmd = 'cmd /c call "%s"' % testpath
       
   461     vlog("# Running", cmd)
       
   462     return run(cmd, options, replacements)
       
   463 
       
   464 def tsttest(test, options, replacements):
   457 def tsttest(test, options, replacements):
   465     t = open(test)
   458     t = open(test)
   466     out = []
   459     out = []
   467     script = []
   460     script = []
   468     salt = "SALT" + str(time.time())
   461     salt = "SALT" + str(time.time())
   662         firstline = ''
   655         firstline = ''
   663     lctest = test.lower()
   656     lctest = test.lower()
   664 
   657 
   665     if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
   658     if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
   666         runner = pytest
   659         runner = pytest
   667     elif lctest.endswith('.bat'):
       
   668         # do not run batch scripts on non-windows
       
   669         if os.name != 'nt':
       
   670             return skip("batch script")
       
   671         runner = battest
       
   672     elif lctest.endswith('.t'):
   660     elif lctest.endswith('.t'):
   673         runner = tsttest
   661         runner = tsttest
   674         ref = testpath
   662         ref = testpath
   675     else:
   663     else:
   676         # do not run shell scripts on windows
       
   677         if os.name == 'nt':
       
   678             return skip("shell script")
       
   679         # do not try to run non-executable programs
   664         # do not try to run non-executable programs
   680         if not os.path.exists(testpath):
   665         if not os.access(testpath, os.X_OK):
   681             return fail("does not exist")
       
   682         elif not os.access(testpath, os.X_OK):
       
   683             return skip("not executable")
   666             return skip("not executable")
   684         runner = shtest
   667         runner = shtest
   685 
   668 
   686     # Make a tmp subdirectory to work in
   669     # Make a tmp subdirectory to work in
   687     testtmp = os.environ["TESTTMP"] = os.path.join(HGTMP, test)
   670     testtmp = os.environ["TESTTMP"] = os.path.join(HGTMP, test)