diff --git a/sky/packages/sky/pubspec.yaml b/sky/packages/sky/pubspec.yaml index 5121d49b5e5..bb3f75f4540 100644 --- a/sky/packages/sky/pubspec.yaml +++ b/sky/packages/sky/pubspec.yaml @@ -11,7 +11,7 @@ dependencies: newton: ^0.1.2 sky_engine: ^0.0.12 sky_services: ^0.0.12 - sky_tools: ^0.0.9 + sky_tools: ^0.0.10 vector_math: ^1.4.3 environment: sdk: '>=1.8.0 <2.0.0' diff --git a/sky/tools/run_tests b/sky/tools/run_tests new file mode 100755 index 00000000000..c9170a7246f --- /dev/null +++ b/sky/tools/run_tests @@ -0,0 +1,44 @@ +#!/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 + +SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) +SKY_ROOT = os.path.dirname(SKY_TOOLS_DIR) +SRC_ROOT = os.path.dirname(SKY_ROOT) + +DART_SDK = os.path.join(SRC_ROOT, 'third_party', 'dart-sdk', 'dart-sdk', 'bin') +PUB = os.path.join(DART_SDK, 'pub') +PUB_CACHE = os.path.join(SRC_ROOT, 'dart-pub-cache') + +UNIT_DIR = os.path.join(SRC_ROOT, 'sky', 'unit') + +def main(): + parser = argparse.ArgumentParser(description='Runs Sky tests') + 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 = parser.parse_args() + + build_dir = os.path.join(SRC_ROOT, 'out', args.config) + + sky_shell = None + if sys.platform == 'linux2': + sky_shell = os.path.join(build_dir, 'sky_shell') + elif sys.platform == 'darwin': + sky_shell = os.path.join(build_dir, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell') + + env = os.environ.copy() + env['PUB_CACHE'] = PUB_CACHE + env['SKY_SHELL'] = sky_shell + return subprocess.call([ + PUB, 'run', 'sky_tools:sky_test', + ], cwd=UNIT_DIR, env=env) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/sky/unit/.gitignore b/sky/unit/.gitignore new file mode 100644 index 00000000000..47c1956b86f --- /dev/null +++ b/sky/unit/.gitignore @@ -0,0 +1,3 @@ +.pub +packages +pubspec.lock diff --git a/sky/unit/pubspec.yaml b/sky/unit/pubspec.yaml new file mode 100644 index 00000000000..145524f3a9f --- /dev/null +++ b/sky/unit/pubspec.yaml @@ -0,0 +1,10 @@ +name: sky_unit_tests +dependencies: + sky: any + sky_tools: any + test: any +dependency_overrides: + material_design_icons: + path: ../packages/material_design_icons + sky: + path: ../packages/sky diff --git a/sky/unit/test/harness/trivial_test.dart b/sky/unit/test/harness/trivial_test.dart new file mode 100644 index 00000000000..bbca5f2afea --- /dev/null +++ b/sky/unit/test/harness/trivial_test.dart @@ -0,0 +1,7 @@ +import 'package:test/test.dart'; + +void main() { + test("should pass", () { + expect(1 + 1, equals(2)); + }); +} diff --git a/travis/build.sh b/travis/build.sh index 2c26a863bab..8c1d20bd015 100755 --- a/travis/build.sh +++ b/travis/build.sh @@ -4,3 +4,4 @@ set -ex ./sky/tools/gn --release ninja -j 4 -C out/Release ./sky/tools/skyanalyzer --congratulate examples/stocks/lib/main.dart +./sky/tools/run_tests --release