OLD | NEW |
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #!/usr/bin/env python | 5 #!/usr/bin/env python |
6 # | 6 # |
7 | 7 |
8 """A test for htmlconverter.py | 8 """A test for htmlconverter.py |
9 """ | 9 """ |
10 | 10 |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 def runTest(test, target, verbose, keep_temporary_files): | 336 def runTest(test, target, verbose, keep_temporary_files): |
337 inputfile = INPUTS[test] | 337 inputfile = INPUTS[test] |
338 suffix = '-js.html' if target == 'chromium' else '-dart.html' | 338 suffix = '-js.html' if target == 'chromium' else '-dart.html' |
339 outfile = abspath(join('out', inputfile.replace(".html", suffix))) | 339 outfile = abspath(join('out', inputfile.replace(".html", suffix))) |
340 | 340 |
341 # TODO(sigmund): tests should also run in dartium before converting them | 341 # TODO(sigmund): tests should also run in dartium before converting them |
342 | 342 |
343 # run the htmlconverter.py script on it | 343 # run the htmlconverter.py script on it |
344 printLine("... converting input html [%d]" % (test + 1)) | 344 printLine("... converting input html [%d]" % (test + 1)) |
345 cmd = [sys.executable, 'tools/htmlconverter.py', inputfile, | 345 cmd = [sys.executable, './htmlconverter.py', inputfile, |
346 '-o', 'out/', '-t', target] | 346 '-o', 'out/', '-t', target] |
347 if verbose: cmd.append('--verbose') | 347 if verbose: cmd.append('--verbose') |
348 status, out, err = execute(cmd, verbose) | 348 status, out, err = execute(cmd, verbose) |
349 if status != 0: | 349 if status != 0: |
350 printLine("%sERROR%s converting [%d]" % (RED_COLOR, NO_COLOR, test + 1)) | 350 printLine("%sERROR%s converting [%d]" % (RED_COLOR, NO_COLOR, test + 1)) |
351 print out | 351 print out |
352 print err | 352 print err |
353 return status | 353 return status |
354 | 354 |
355 status = browserRun( | 355 status = browserRun( |
(...skipping 23 matching lines...) Expand all Loading... |
379 def shouldRunTest(test, prefixes): | 379 def shouldRunTest(test, prefixes): |
380 if len(prefixes) == 0: | 380 if len(prefixes) == 0: |
381 return True | 381 return True |
382 for a in prefixes: | 382 for a in prefixes: |
383 if INPUTS[test].startswith(a): | 383 if INPUTS[test].startswith(a): |
384 return True | 384 return True |
385 return False | 385 return False |
386 | 386 |
387 | 387 |
388 def main(): | 388 def main(): |
389 os.chdir(CLIENT_PATH) | |
390 parser = Flags() | 389 parser = Flags() |
391 options, args = parser.parse_args() | 390 options, args = parser.parse_args() |
392 verbose = options.verbose | 391 verbose = options.verbose |
393 keep_temporary_files = options.keep_temporary_files | 392 keep_temporary_files = options.keep_temporary_files |
394 | 393 |
395 createInputFiles() | 394 createInputFiles() |
396 for test in range(len(INPUTS)): | 395 for test in range(len(INPUTS)): |
397 if shouldRunTest(test, args): | 396 if shouldRunTest(test, args): |
398 if 'chromium' in options.target: | 397 if 'chromium' in options.target: |
399 if runTest(test, 'chromium', verbose, keep_temporary_files) != 0: | 398 if runTest(test, 'chromium', verbose, keep_temporary_files) != 0: |
400 if not keep_temporary_files: | 399 if not keep_temporary_files: |
401 deleteInputFiles() | 400 deleteInputFiles() |
402 return 1 | 401 return 1 |
403 if 'dartium' in options.target: | 402 if 'dartium' in options.target: |
404 if runTest(test, 'dartium', verbose, keep_temporary_files) != 0: | 403 if runTest(test, 'dartium', verbose, keep_temporary_files) != 0: |
405 if not keep_temporary_files: | 404 if not keep_temporary_files: |
406 deleteInputFiles() | 405 deleteInputFiles() |
407 return 1 | 406 return 1 |
408 | 407 |
409 if not keep_temporary_files: | 408 if not keep_temporary_files: |
410 deleteInputFiles() | 409 deleteInputFiles() |
411 return 0 | 410 return 0 |
412 | 411 |
413 | 412 |
414 if __name__ == '__main__': | 413 if __name__ == '__main__': |
415 sys.exit(main()) | 414 sys.exit(main()) |
OLD | NEW |