tests/run-tests.py
branchstable
changeset 1152 9a4ed3acf89e
parent 1151 676dce49d8e6
child 1155 380eea1f5add
equal deleted inserted replaced
1151:676dce49d8e6 1152:9a4ed3acf89e
   478     vlog("# Running", cmd)
   478     vlog("# Running", cmd)
   479     if os.name == 'nt':
   479     if os.name == 'nt':
   480         replacements.append((r'\r\n', '\n'))
   480         replacements.append((r'\r\n', '\n'))
   481     return run(cmd, wd, options, replacements)
   481     return run(cmd, wd, options, replacements)
   482 
   482 
   483 def shtest(test, wd, options, replacements):
       
   484     cmd = '%s "%s"' % (options.shell, test)
       
   485     vlog("# Running", cmd)
       
   486     return run(cmd, wd, options, replacements)
       
   487 
       
   488 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
   483 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search
   489 escapesub = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub
   484 escapesub = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub
   490 escapemap = dict((chr(i), r'\x%02x' % i) for i in range(256))
   485 escapemap = dict((chr(i), r'\x%02x' % i) for i in range(256))
   491 escapemap.update({'\\': '\\\\', '\r': r'\r'})
   486 escapemap.update({'\\': '\\\\', '\r': r'\r'})
   492 def escapef(m):
   487 def escapef(m):
   872         runner = pytest
   867         runner = pytest
   873     elif lctest.endswith('.t'):
   868     elif lctest.endswith('.t'):
   874         runner = tsttest
   869         runner = tsttest
   875         ref = testpath
   870         ref = testpath
   876     else:
   871     else:
   877         # do not try to run non-executable programs
   872         return skip("unknown test type")
   878         if not os.access(testpath, os.X_OK):
       
   879             return skip("not executable")
       
   880         runner = shtest
       
   881 
   873 
   882     # Make a tmp subdirectory to work in
   874     # Make a tmp subdirectory to work in
   883     testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
   875     testtmp = os.environ["TESTTMP"] = os.environ["HOME"] = \
   884         os.path.join(HGTMP, os.path.basename(test))
   876         os.path.join(HGTMP, os.path.basename(test))
   885 
   877