Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Unified Diff: dart/tools/testing/drt-trampoline.py

Issue 11414055: Revert "Allow tests to specify a package root." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/testing/drt-trampoline.py
diff --git a/dart/tools/testing/drt-trampoline.py b/dart/tools/testing/drt-trampoline.py
index ac5b23d690af3de4017eebf27fa14da8ecb55ada..fc27a7ded3b80c3dd0677304db7525ca2c9f3a1f 100644
--- a/dart/tools/testing/drt-trampoline.py
+++ b/dart/tools/testing/drt-trampoline.py
@@ -8,70 +8,40 @@
#
# Expected invocation: python drt-trampoline.py <path to DRT> <DRT command line>
-import optparse
import os
import signal
import subprocess
import sys
-def parse_options(argv):
- parser = optparse.OptionParser()
- parser.add_option('--dart-flags',
- metavar='FLAGS',
- dest='dart_flags')
- parser.add_option('--out-expectation',
- metavar='FILE',
- dest='out_expected_file')
- parser.add_option('--package-root',
- metavar='DIRECTORY',
- dest='dart_package_root')
- parser.add_option('--no-timeout',
- action='store_true')
- return parser.parse_args(args=argv)
-
+DART_FLAGS_PREFIX = '--dart-flags='
+OUT_EXPECTATION_PREFIX = '--out-expectation='
def main(argv):
drt_path = argv[1]
- (options, arguments) = parse_options(argv[2:])
+ command_line = argv[2:]
cmd = [drt_path]
env = None
test_file = None
- dart_flags = options.dart_flags
- out_expected_file = options.out_expected_file
- dart_package_root = options.dart_package_root
+ out_expected_file = None
is_png = False
- if dart_flags:
- if not env:
- env = dict(os.environ.items())
- env['DART_FLAGS'] = dart_flags
-
- if dart_package_root:
- if not env:
+ # parse arguments, filtering out flags, and selecting the input test file
+ for arg in command_line:
+ if arg.startswith(DART_FLAGS_PREFIX):
env = dict(os.environ.items())
- absolute_path = os.path.abspath(dart_package_root)
- absolute_path = absolute_path.replace(os.path.sep, '/')
- if not absolute_path.startswith('/'):
- # Happens on Windows for C:\packages
- absolute_path = '/%s' % absolute_path
- env['DART_PACKAGE_ROOT'] = 'file://%s' % absolute_path
-
- if out_expected_file:
- if out_expected_file.endswith('.png'):
- cmd.append('--notree')
- is_png = True
- elif not out_expected_file.endswith('.txt'):
- raise Exception(
- 'Bad file expectation (%s) please specify either a .txt or a .png file'
- % out_expected_file)
-
- if options.no_timeout:
- cmd.append('--no-timeout')
-
- for arg in arguments:
- if '.html' in arg:
+ env['DART_FLAGS'] = arg[len(DART_FLAGS_PREFIX):]
+ elif arg.startswith(OUT_EXPECTATION_PREFIX):
+ out_expected_file = arg[len(OUT_EXPECTATION_PREFIX):]
+ if out_expected_file.endswith('.png'):
+ cmd.append('--notree')
+ is_png = True
+ elif not out_expected_file.endswith('.txt'):
+ raise Exception(
+ 'Bad file expectation (%s), ' % out_expected_file
+ + 'please specify either a .txt or a .png file')
+ elif '.html' in arg:
test_file = arg
else:
cmd.append(arg)
« no previous file with comments | « dart/tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698