diff --git a/dev/run_tests b/dev/run_tests new file mode 100755 index 0000000000..9c5f729538 --- /dev/null +++ b/dev/run_tests @@ -0,0 +1,43 @@ +#!/usr/bin/env python +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys +import subprocess +import argparse + +FLUTTER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +FLUTTER = os.path.join(FLUTTER_ROOT, 'bin', 'flutter') + +UNIT_DIR = os.path.join(FLUTTER_ROOT, 'packages', 'unit') +TESTS_DIR = os.path.join(UNIT_DIR, 'test') +DEFAULT_ENGINE_DIR = os.path.abspath(os.path.join(FLUTTER_ROOT, '..', 'engine', 'src')) + +def main(): + parser = argparse.ArgumentParser(description='Runs Flutter unit tests') + parser.add_argument('--engine-dir', default=DEFAULT_ENGINE_DIR) + parser.add_argument('--config', default='Debug') + parser.add_argument('--debug', dest='config', action='store_const', const='Debug') + parser.add_argument('--release', dest='config', action='store_const', const='Release') + args, remaining = parser.parse_known_args() + + build_dir = os.path.join(os.path.abspath(args.engine_dir), 'out', args.config) + + if not remaining: + for root, dirs, files in os.walk(TESTS_DIR): + remaining.extend(os.path.join(root, f) + for f in files if f.endswith("_test.dart")) + + if os.environ['TERM'] == 'dumb': + remaining = [ '--no-color' ] + remaining + + return subprocess.call([ + FLUTTER, + 'test', + '--build-dir=%s' % build_dir + ] + remaining, cwd=UNIT_DIR) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/dev/update_packages.py b/dev/update_packages.py index 6900fca0de..41938591d8 100755 --- a/dev/update_packages.py +++ b/dev/update_packages.py @@ -6,6 +6,8 @@ import os import subprocess +FLUTTER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + def update(directory): packages = sorted(os.listdir(directory)) for package in packages: @@ -14,6 +16,5 @@ def update(directory): print 'Updating', package, '...' subprocess.check_call(['pub', 'get'], cwd=package_dir) -FLUTTER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) update(os.path.join(FLUTTER_ROOT, 'packages')) update(os.path.join(FLUTTER_ROOT, 'examples')) diff --git a/packages/flutter/bin/flutter.dart b/packages/flutter/bin/flutter.dart deleted file mode 100644 index 99338de253..0000000000 --- a/packages/flutter/bin/flutter.dart +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:sky_tools/executable.dart' as executable; - -main(List args) => executable.main(args); diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart index 3d70ec38eb..ac10a12b09 100644 --- a/packages/flutter_tools/lib/src/commands/test.dart +++ b/packages/flutter_tools/lib/src/commands/test.dart @@ -19,7 +19,7 @@ class TestCommand extends FlutterCommand { final String description = 'Runs Flutter unit tests for the current project (requires a local build of the engine).'; TestCommand() { - argParser.addOption('build-dir', defaultsTo: '../../../engine/src/out/Debug'); + argParser.addOption('build-dir', help: 'The directory in which to find a prebuilt engine'); } String get _shellPath { diff --git a/packages/unit/pubspec.yaml b/packages/unit/pubspec.yaml index 38eb810752..e0856f5e56 100644 --- a/packages/unit/pubspec.yaml +++ b/packages/unit/pubspec.yaml @@ -6,3 +6,5 @@ dependencies: path: ../flx flutter: path: ../flutter + sky_tools: + path: ../flutter_tools