tests/run-tests.py
branchstable
changeset 1298 d69c1db7cf8b
parent 1295 8e66ac9c0f0e
child 1304 366b3a1bfea9
equal deleted inserted replaced
1297:60e578eae19d 1298:d69c1db7cf8b
   760     if skipping is not None:
   760     if skipping is not None:
   761         after.setdefault(pos, []).append('  !!! missing #endif\n')
   761         after.setdefault(pos, []).append('  !!! missing #endif\n')
   762     addsalt(n + 1, False)
   762     addsalt(n + 1, False)
   763 
   763 
   764     # Write out the script and execute it
   764     # Write out the script and execute it
   765     fd, name = tempfile.mkstemp(suffix='hg-tst')
   765     name = wd + '.sh'
   766     try:
   766     f = open(name, 'w')
   767         for l in script:
   767     for l in script:
   768             os.write(fd, l)
   768         f.write(l)
   769         os.close(fd)
   769     f.close()
   770 
   770 
   771         cmd = '%s "%s"' % (options.shell, name)
   771     cmd = '%s "%s"' % (options.shell, name)
   772         vlog("# Running", cmd)
   772     vlog("# Running", cmd)
   773         exitcode, output = run(cmd, wd, options, replacements, env)
   773     exitcode, output = run(cmd, wd, options, replacements, env)
   774         # do not merge output if skipped, return hghave message instead
   774     # do not merge output if skipped, return hghave message instead
   775         # similarly, with --debug, output is None
   775     # similarly, with --debug, output is None
   776         if exitcode == SKIPPED_STATUS or output is None:
   776     if exitcode == SKIPPED_STATUS or output is None:
   777             return exitcode, output
   777         return exitcode, output
   778     finally:
       
   779         os.remove(name)
       
   780 
   778 
   781     # Merge the script output back into a unified test
   779     # Merge the script output back into a unified test
   782 
   780 
   783     pos = -1
   781     pos = -1
   784     postout = []
   782     postout = []