Mercurial > hg > mercurial-crew-with-dirclash
comparison tests/run-tests.py @ 4320:f9b61e0fc929
run-tests.py: small cleanup
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 07 Apr 2007 04:27:55 -0300 |
parents | 8ece1ba156c7 |
children | 99184c6fd88f |
comparison
equal
deleted
inserted
replaced
4319:8ece1ba156c7 | 4320:f9b61e0fc929 |
---|---|
228 hgrc = file(HGRCPATH, 'w+') | 228 hgrc = file(HGRCPATH, 'w+') |
229 hgrc.close() | 229 hgrc.close() |
230 | 230 |
231 err = os.path.join(TESTDIR, test+".err") | 231 err = os.path.join(TESTDIR, test+".err") |
232 ref = os.path.join(TESTDIR, test+".out") | 232 ref = os.path.join(TESTDIR, test+".out") |
233 testpath = os.path.join(TESTDIR, test) | |
233 | 234 |
234 if os.path.exists(err): | 235 if os.path.exists(err): |
235 os.remove(err) # Remove any previous output files | 236 os.remove(err) # Remove any previous output files |
236 | 237 |
237 # Make a tmp subdirectory to work in | 238 # Make a tmp subdirectory to work in |
240 os.chdir(tmpd) | 241 os.chdir(tmpd) |
241 | 242 |
242 lctest = test.lower() | 243 lctest = test.lower() |
243 | 244 |
244 if lctest.endswith('.py'): | 245 if lctest.endswith('.py'): |
245 cmd = '%s "%s"' % (python, os.path.join(TESTDIR, test)) | 246 cmd = '%s "%s"' % (python, testpath) |
246 elif lctest.endswith('.bat'): | 247 elif lctest.endswith('.bat'): |
247 # do not run batch scripts on non-windows | 248 # do not run batch scripts on non-windows |
248 if os.name != 'nt': | 249 if os.name != 'nt': |
249 print '\nSkipping %s: batch script' % test | 250 print '\nSkipping %s: batch script' % test |
250 return None | 251 return None |
251 # To reliably get the error code from batch files on WinXP, | 252 # To reliably get the error code from batch files on WinXP, |
252 # the "cmd /c call" prefix is needed. Grrr | 253 # the "cmd /c call" prefix is needed. Grrr |
253 cmd = 'cmd /c call "%s"' % (os.path.join(TESTDIR, test)) | 254 cmd = 'cmd /c call "%s"' % testpath |
254 else: | 255 else: |
255 # do not run shell scripts on windows | 256 # do not run shell scripts on windows |
256 if os.name == 'nt': | 257 if os.name == 'nt': |
257 print '\nSkipping %s: shell script' % test | 258 print '\nSkipping %s: shell script' % test |
258 return None | 259 return None |
259 # do not try to run non-executable programs | 260 # do not try to run non-executable programs |
260 if not os.access(os.path.join(TESTDIR, test), os.X_OK): | 261 if not os.access(testpath, os.X_OK): |
261 print '\nSkipping %s: not executable' % test | 262 print '\nSkipping %s: not executable' % test |
262 return None | 263 return None |
263 cmd = '"%s"' % (os.path.join(TESTDIR, test)) | 264 cmd = '"%s"' % testpath |
264 | 265 |
265 if options.timeout > 0: | 266 if options.timeout > 0: |
266 signal.alarm(options.timeout) | 267 signal.alarm(options.timeout) |
267 | 268 |
268 vlog("# Running", cmd) | 269 vlog("# Running", cmd) |