diff --git a/pkg/compiler/testing.json b/pkg/compiler/testing.json index 31caf626d30..f173447eca1 100644 --- a/pkg/compiler/testing.json +++ b/pkg/compiler/testing.json @@ -10,15 +10,13 @@ "uris": [ ".", - "../../tests/compiler/dart2js/", - "../../tests/utils/" + "../../tests/compiler/dart2js/" ], "exclude": [ "^tests/compiler/dart2js/data/.*", "^tests/compiler/dart2js/path with spaces/.*", - "^tests/compiler/dart2js/sourcemaps/data/.*", - "^tests/utils/dummy\\.dart" + "^tests/compiler/dart2js/sourcemaps/data/.*" ] } } diff --git a/tests/_chrome/_chrome.status b/tests/_chrome/_chrome.status deleted file mode 100644 index 077c8b2f095..00000000000 --- a/tests/_chrome/_chrome.status +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -[ $runtime == vm ] -# Not supported on the VM -*: Skip - -[ $compiler == none] -# Not supported on Dartium right now -*: Skip diff --git a/tests/_chrome/sample_test.dart b/tests/_chrome/sample_test.dart deleted file mode 100644 index 91423fd38d5..00000000000 --- a/tests/_chrome/sample_test.dart +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library sample_test; - -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; -import 'dart:_chrome' as _chrome; - -main() { - useHtmlConfiguration(); - test('access', () { - var window = _chrome.app.window; - expect(window is _chrome.WindowModule, true); - }); - - test('fails from browser', () { - // APIs should not work in standard browser apps. - expect(() { - _chrome.app.window.create('IntentionallyMissingFile.html'); - }, throws); - }); -} diff --git a/tests/benchmark_smoke/benchmark_base.dart b/tests/benchmark_smoke/benchmark_base.dart deleted file mode 100644 index f999cd83a99..00000000000 --- a/tests/benchmark_smoke/benchmark_base.dart +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -part of benchmark_lib; - -/** Accessors for our Singleton variables. */ -BenchmarkSuite get BENCHMARK_SUITE { - if (BenchmarkSuite._ONLY == null) { - BenchmarkSuite._ONLY = new BenchmarkSuite._internal(); - } - return BenchmarkSuite._ONLY; -} - -BenchmarkView get BENCHMARK_VIEW { - if (BenchmarkView._ONLY == null) { - BenchmarkView._ONLY = new BenchmarkView._internal(); - } - return BenchmarkView._ONLY; -} - -/** The superclass from which all benchmarks inherit from. */ -class BenchmarkBase { - /** Benchmark name. */ - final String name; - - const BenchmarkBase(String name) : this.name = name; - - /** - * The benchmark code. - * This function is not used, if both [warmup] and [exercise] are overwritten. - */ - void run() {} - - /** Runs a short version of the benchmark. By default invokes [run] once. */ - void warmup() { - run(); - } - - /** Exercises the benchmark. By default invokes [run] 10 times. */ - void exercise() { - for (int i = 0; i < 10; i++) { - run(); - } - } - - /** Not measured setup code executed prior to the benchmark runs. */ - void setup() {} - - /** Not measures teardown code executed after the benchmark runs. */ - void teardown() {} - - /** - * Measures the score for this benchmark by executing it repeately until - * time minimum has been reached. - */ - static double measureFor(Function f, int timeMinimum) { - int time = 0; - int iter = 0; - Stopwatch watch = new Stopwatch(); - watch.start(); - int elapsed = 0; - while (elapsed < timeMinimum || iter < 32) { - f(); - elapsed = watch.elapsedMilliseconds; - iter++; - } - return (1000.0 * iter) / elapsed; - } - - /** - * Measures the score for the benchmark and returns it. - * We measure iterations / sec (so bigger = better!). - */ - double measure() { - setup(); - // Warmup for at least 1000ms. Discard result. - measureFor(() { - this.warmup(); - }, 1000); - // Run the benchmark for at least 1000ms. - double result = measureFor(() { - this.exercise(); - }, 1000); - teardown(); - return result; - } - - void report() { - num score = measure(); - Map normalizingDict = {'Smoketest': 100}; - score = score / normalizingDict[name]; - BENCHMARK_SUITE.updateIndividualScore(name, score); - } -} - -/** The controller class that runs all of the benchmarks. */ -class BenchmarkSuite { - /** The set of benchmarks that have yet to run. */ - List benchmarks; - - /** - * The set of scores from the benchmarks that have already run. (Used for - * calculating the Geometric mean). - */ - List scores; - - /** The total number of benchmarks we will be running. */ - int totalBenchmarks; - - /** Singleton pattern: There's only one BenchmarkSuite. */ - static BenchmarkSuite _ONLY = null; - - BenchmarkSuite._internal() { - scores = []; - benchmarks = [() => Smoketest.main()]; - totalBenchmarks = benchmarks.length; - } - - /** Run all of the benchmarks that we have in our benchmarks list. */ - runBenchmarks() { - runBenchmarksHelper(benchmarks); - } - - /** - * Run the remaining benchmarks in our list. We chain the calls providing - * little breaks for the main page to gain control, so we don't force the - * entire page to hang the whole time. - */ - runBenchmarksHelper(List remainingBenchmarks) { - // Remove the last benchmark, and run it. - var benchmark = remainingBenchmarks.removeLast(); - benchmark(); - if (remainingBenchmarks.length > 0) { - /* Provide small breaks between each benchmark, so that the browser - doesn't get unhappy about long running scripts, and so the user - can regain control of the UI to kill the page as needed. */ - new Timer(const Duration(milliseconds: 25), - () => runBenchmarksHelper(remainingBenchmarks)); - } else if (remainingBenchmarks.length == 0) { - // We've run all of the benchmarks. Update the page with the score. - BENCHMARK_VIEW.setScore(geometricMean(scores)); - } - } - - /** Store the results of a single benchmark run. */ - updateIndividualScore(String name, num score) { - scores.add(score); - BENCHMARK_VIEW.incrementProgress(name, score, totalBenchmarks); - } - - /** Computes the geometric mean of a set of numbers. */ - geometricMean(numbers) { - num log = 0; - for (num n in numbers) { - log += Math.log(n); - } - return Math.pow(Math.E, log / numbers.length); - } -} - -/** Controls how results are displayed to the user, by updating the HTML. */ -class BenchmarkView { - /** The number of benchmarks that have finished executing. */ - int numCompleted = 0; - - /** Singleton pattern: There's only one BenchmarkSuite. */ - static BenchmarkView _ONLY = null; - - BenchmarkView._internal(); - - /** Update the page HTML to show the calculated score. */ - setScore(num score) { - String newScore = formatScore(score * 100.0); - Element body = document.queryAll("body")[0]; - body.nodes - .add(new Element.html("

Score: $newScore

")); - } - - /** - * Update the page HTML to show how much progress we've made through the - * benchmarks. - */ - incrementProgress(String name, num score, num totalBenchmarks) { - String newScore = formatScore(score * 100.0); - numCompleted++; - // Slightly incorrect (truncating) percentage, but this is just to show - // the user we're making progress. - num percentage = 100 * numCompleted ~/ totalBenchmarks; - } - - /** - * Rounds the score to have at least three significant digits (hopefully) - * helping readability of the scores. - */ - String formatScore(num value) { - if (value > 100) { - return value.toStringAsFixed(0); - } else { - return value.toStringAsFixed(2); - } - } -} diff --git a/tests/benchmark_smoke/benchmark_lib.dart b/tests/benchmark_smoke/benchmark_lib.dart deleted file mode 100644 index a678bd656c3..00000000000 --- a/tests/benchmark_smoke/benchmark_lib.dart +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library benchmark_lib; - -import 'dart:async'; -import 'dart:html'; -import 'dart:math' as Math; - -import 'smoketest_lib.dart'; -part 'benchmark_base.dart'; diff --git a/tests/benchmark_smoke/benchmark_smoke.status b/tests/benchmark_smoke/benchmark_smoke.status deleted file mode 100644 index b00ffe1b042..00000000000 --- a/tests/benchmark_smoke/benchmark_smoke.status +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -[ $runtime == vm || $runtime == dart_precompiled ] -*: Skip - -[ $compiler == dart2js && $runtime == none ] -*: Fail, Pass # TODO(ahe): Triage these tests. - -[ $compiler == dart2analyzer && $builder_tag == strong ] -*: Skip # Issue 28649 diff --git a/tests/benchmark_smoke/benchmark_smoke_test.dart b/tests/benchmark_smoke/benchmark_smoke_test.dart deleted file mode 100644 index 70647c84ea3..00000000000 --- a/tests/benchmark_smoke/benchmark_smoke_test.dart +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library benchmarksmoketest; - -// Tests that benchmark classes used in perf testing are not broken. -import 'benchmark_lib.dart'; -import 'dart:async'; -import 'dart:html'; -import 'package:expect/expect.dart'; -import 'package:unittest/unittest.dart'; -import 'package:unittest/html_config.dart'; - -void main() { - useHtmlConfiguration(); - - test('performanceTesting', () { - Timer.run(BENCHMARK_SUITE.runBenchmarks); - Timer.run(expectAsync(testForCompletion)); - }); -} - -testForCompletion() { - Element element = document.query('#testResultScore'); - RegExp re = new RegExp('Score: [0-9]+'); - print(element.text); - Expect.isTrue(re.hasMatch(element.text)); -} diff --git a/tests/benchmark_smoke/smoketest_lib.dart b/tests/benchmark_smoke/smoketest_lib.dart deleted file mode 100644 index 31ce3114476..00000000000 --- a/tests/benchmark_smoke/smoketest_lib.dart +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library smoketest_lib; - -import 'benchmark_lib.dart'; -import 'dart:html'; - -/** - * This is a sample no-op benchmark to ensure that dart2js has not dramatically - * broken Firefox. - */ -class Smoketest extends BenchmarkBase { - const Smoketest() : super("Smoketest"); - - void run() {} - - static void main() { - new Smoketest().report(); - } - - static void log(String str) { - print(str); - } -} diff --git a/tests/compiler/dart2js/analyze_only_test.dart b/tests/compiler/dart2js/analyze_only_test.dart index 74683ca81e1..f07e5b2fdcd 100644 --- a/tests/compiler/dart2js/analyze_only_test.dart +++ b/tests/compiler/dart2js/analyze_only_test.dart @@ -5,18 +5,19 @@ // Smoke test of the dart2js compiler API. library analyze_only; -import "package:expect/expect.dart"; import 'dart:async'; -import "package:async_helper/async_helper.dart"; -import '../../utils/dummy_compiler_test.dart' as dummy; +import 'package:async_helper/async_helper.dart'; +import 'package:expect/expect.dart'; + import 'package:compiler/compiler_new.dart'; -import 'package:compiler/src/options.dart'; import 'package:compiler/src/commandline_options.dart'; import 'package:compiler/src/diagnostics/messages.dart' show MessageKind, MessageTemplate; import 'package:compiler/src/old_to_new_api.dart'; +import 'package:compiler/src/options.dart'; +import 'dummy_compiler_test.dart' as dummy; import 'output_collector.dart'; runCompiler(String main, List options, diff --git a/tests/utils/dummy_compiler_test.dart b/tests/compiler/dart2js/dummy_compiler_test.dart similarity index 95% rename from tests/utils/dummy_compiler_test.dart rename to tests/compiler/dart2js/dummy_compiler_test.dart index 1252af5e43f..4078f9a673a 100644 --- a/tests/utils/dummy_compiler_test.dart +++ b/tests/compiler/dart2js/dummy_compiler_test.dart @@ -6,11 +6,11 @@ library dummy_compiler; import 'dart:async'; -import "package:async_helper/async_helper.dart"; +import 'package:async_helper/async_helper.dart'; import 'package:compiler/compiler.dart'; -import '../compiler/dart2js/mock_libraries.dart'; +import 'mock_libraries.dart'; String libProvider(Uri uri) { if (uri.path.endsWith(".platform")) { diff --git a/tests/utils/recursive_import_test.dart b/tests/compiler/dart2js/recursive_import_test.dart similarity index 95% rename from tests/utils/recursive_import_test.dart rename to tests/compiler/dart2js/recursive_import_test.dart index 61c1a30248c..d42fccb56b0 100644 --- a/tests/utils/recursive_import_test.dart +++ b/tests/compiler/dart2js/recursive_import_test.dart @@ -4,12 +4,14 @@ // Test of "recursive" imports using the dart2js compiler API. -import "package:expect/expect.dart"; -import "package:async_helper/async_helper.dart"; import 'dart:async'; -import 'dummy_compiler_test.dart'; + +import 'package:expect/expect.dart'; +import 'package:async_helper/async_helper.dart'; import 'package:compiler/compiler.dart'; +import 'dummy_compiler_test.dart'; + const String RECURSIVE_MAIN = """ library fisk; import 'recurse/fisk.dart'; diff --git a/tests/utils/analysis_options.yaml b/tests/utils/analysis_options.yaml deleted file mode 100644 index 73bed39b20e..00000000000 --- a/tests/utils/analysis_options.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -analyzer: - strong-mode: true - - language: - enableSuperMixins: false - - errors: - todo: ignore - - deprecated_member_use: ignore - - exclude: - - dummy.dart diff --git a/tests/utils/dart2js_test.dart b/tests/utils/dart2js_test.dart deleted file mode 100644 index 51c5b12c641..00000000000 --- a/tests/utils/dart2js_test.dart +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// Test to ensure that dart2js is free of warnings. - -// ignore: UNUSED_IMPORT -import 'package:compiler/src/dart2js.dart' as dart2js; - -void main() { - // Do nothing. -} diff --git a/tests/utils/dummy.dart b/tests/utils/dummy.dart deleted file mode 100644 index f7f9c5c0aa2..00000000000 --- a/tests/utils/dummy.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -// A dummy library for testing dartdoc name references. -library dummy; - -topLevelMethod() => null; - -class Class { - Class() => null; - Class.namedConstructor() => null; - method(param) => null; - get getterOnly => null; - get getterAndSetter => null; - set getterAndSetter(val) => null; - set setterOnly(val) => null; -} diff --git a/tests/utils/test_utils.dart b/tests/utils/test_utils.dart deleted file mode 100644 index a786fa28463..00000000000 --- a/tests/utils/test_utils.dart +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library test_utils; - -/** - * Removes eight spaces of leading indentation from a multiline string. - * - * Note that this is very sensitive to how the literals are styled. They should - * be: - * ''' - * Text starts on own line. Lines up with subsequent lines. - * Lines are indented exactly 8 characters from the left margin. - * Close is on the same line.''' - * - * This does nothing if text is only a single line. - */ -// TODO(nweiz): Make this auto-detect the indentation level from the first -// non-whitespace line. -String cleanUpLiteral(String text) { - var lines = text.split('\n'); - if (lines.length <= 1) return text; - - for (var j = 0; j < lines.length; j++) { - if (lines[j].length > 8) { - lines[j] = lines[j].substring(8, lines[j].length); - } else { - lines[j] = ''; - } - } - - return lines.join('\n'); -} - -/** - * Indents each line of [text] so that, when passed to [cleanUpLiteral], it will - * produce output identical to [text]. - * - * This is useful for literals that need to include newlines but can't be - * conveniently represented as multi-line strings. - */ -// TODO(nweiz): Once cleanUpLiteral is fixed, get rid of this. -String indentLiteral(String text) { - var lines = text.split('\n'); - if (lines.length <= 1) return text; - - for (var i = 0; i < lines.length; i++) { - lines[i] = " ${lines[i]}"; - } - - return lines.join("\n"); -} diff --git a/tests/utils/utils.status b/tests/utils/utils.status deleted file mode 100644 index c4bc731e016..00000000000 --- a/tests/utils/utils.status +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file -# for details. All rights reserved. Use of this source code is governed by a -# BSD-style license that can be found in the LICENSE file. - -[ $compiler == dart2js ] -dummy_compiler_test: Slow, Pass - -[ $compiler == dart2js ] -recursive_import_test: Slow, Pass - -[ $compiler == dart2js && $browser ] -*: Skip - -[ ($compiler == none || $compiler == precompiler) && $runtime != vm ] -dart2js_test: SkipByDesign # Uses dart:io. - -[ $compiler == dart2js && $mode == debug ] -dummy_compiler_test: Slow, Pass - -[ $compiler == dart2analyzer && $builder_tag == strong ] -*: Skip # Issue 28649 - -[ $hot_reload || $hot_reload_rollback ] -recursive_import_test: Skip # Running dart2js under frequent reloads is slow. -dummy_compiler_test: Skip # Running dart2js under frequent reloads is slow. - -[ $builder_tag == asan ] -recursive_import_test: Skip # Issue 27441 - -[ ($compiler == dartk || $compiler == dartkp) && $mode == debug ] -dummy_compiler_test: Slow, Pass -recursive_import_test: Slow, Pass diff --git a/utils/tests/testrunner/browser_tests/pubspec.yaml b/utils/tests/testrunner/browser_tests/pubspec.yaml deleted file mode 100755 index baa04d0fe1d..00000000000 --- a/utils/tests/testrunner/browser_tests/pubspec.yaml +++ /dev/null @@ -1,5 +0,0 @@ -name: browser_tests -dependencies: - html: any - unittest: any - diff --git a/utils/tests/testrunner/browser_tests/web/browser_test.dart b/utils/tests/testrunner/browser_tests/web/browser_test.dart deleted file mode 100755 index e32347a7fc0..00000000000 --- a/utils/tests/testrunner/browser_tests/web/browser_test.dart +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library testrunner_test; - -import 'package:unittest/unittest.dart'; - -foo(bool x) => x; - -main() { - group('group1', () { - test('test1', () { - expect(true, isFalse); - }); - }); - group('group2', () { - test('test2', () { - foo(3); - expect(true, isTrue); - }); - }); -} diff --git a/utils/tests/testrunner/browser_tests/web/browser_test.html b/utils/tests/testrunner/browser_tests/web/browser_test.html deleted file mode 100755 index 218f22c995a..00000000000 --- a/utils/tests/testrunner/browser_tests/web/browser_test.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Testdriver tests - - - - - - diff --git a/utils/tests/testrunner/http_client_tests/http_client_test.dart b/utils/tests/testrunner/http_client_tests/http_client_test.dart deleted file mode 100644 index 0015eb43b85..00000000000 --- a/utils/tests/testrunner/http_client_tests/http_client_test.dart +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library testrunner_test; - -import 'dart:async'; -import 'dart:io'; -import 'package:unittest/unittest.dart'; - -main() { - var get = (String what, int code, String text) { - var c = new Completer(); - HttpClient client = new HttpClient(); - client - .getUrl(Uri.parse("http://127.0.0.1:3456/$what")) - .then((HttpClientRequest request) { - // Prepare the request then call close on it to send it. - return request.close(); - }).then((HttpClientResponse response) { - // Process the response. - expect(response.statusCode, code); - var sb = new StringBuffer(); - response.transform(UTF8.decoder).listen((data) { - sb.write(data); - }, onDone: () { - expect(sb.toString(), text); - c.complete(); - }); - }); - return c.future; - }; - test('test1', () { - return get('test.txt', 200, "Hello world!\n"); - }); - test('test2', () { - return get('fail.txt', 404, ""); - }); -} diff --git a/utils/tests/testrunner/layout_tests/pubspec.yaml b/utils/tests/testrunner/layout_tests/pubspec.yaml deleted file mode 100755 index d06c058e31e..00000000000 --- a/utils/tests/testrunner/layout_tests/pubspec.yaml +++ /dev/null @@ -1,5 +0,0 @@ -name: layout_tests -dependencies: - html: any - unittest: any - diff --git a/utils/tests/testrunner/layout_tests/web/layout_test.dart b/utils/tests/testrunner/layout_tests/web/layout_test.dart deleted file mode 100755 index 23931d724fc..00000000000 --- a/utils/tests/testrunner/layout_tests/web/layout_test.dart +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library testrunner_test; - -import 'dart:html'; -import 'package:unittest/unittest.dart'; - -main() { - test("layout", () { - var lbl = new LabelElement(); - lbl.text = 'Hello Dart!'; - document.body.nodes.add(lbl); - }); -} diff --git a/utils/tests/testrunner/layout_tests/web/layout_test.html b/utils/tests/testrunner/layout_tests/web/layout_test.html deleted file mode 100755 index 218f22c995a..00000000000 --- a/utils/tests/testrunner/layout_tests/web/layout_test.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Testdriver tests - - - - - - diff --git a/utils/tests/testrunner/non_browser_tests/non_browser_test.dart b/utils/tests/testrunner/non_browser_tests/non_browser_test.dart deleted file mode 100755 index e32347a7fc0..00000000000 --- a/utils/tests/testrunner/non_browser_tests/non_browser_test.dart +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library testrunner_test; - -import 'package:unittest/unittest.dart'; - -foo(bool x) => x; - -main() { - group('group1', () { - test('test1', () { - expect(true, isFalse); - }); - }); - group('group2', () { - test('test2', () { - foo(3); - expect(true, isTrue); - }); - }); -} diff --git a/utils/tests/testrunner/non_browser_tests/non_browser_toast.dart b/utils/tests/testrunner/non_browser_tests/non_browser_toast.dart deleted file mode 100755 index a7bd7c9cd03..00000000000 --- a/utils/tests/testrunner/non_browser_tests/non_browser_toast.dart +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library testrunner_test; - -import 'package:unittest/unittest.dart'; - -main() { - group('foo', () { - test('bar', () { - expect(true, isTrue); - }); - }); -} diff --git a/utils/tests/testrunner/non_browser_tests/pubspec.yaml b/utils/tests/testrunner/non_browser_tests/pubspec.yaml deleted file mode 100755 index 21f4f000f76..00000000000 --- a/utils/tests/testrunner/non_browser_tests/pubspec.yaml +++ /dev/null @@ -1,4 +0,0 @@ -name: non_browser_tests -dependencies: - unittest: any - diff --git a/utils/tests/testrunner/pubspec.yaml b/utils/tests/testrunner/pubspec.yaml deleted file mode 100755 index 21f4f000f76..00000000000 --- a/utils/tests/testrunner/pubspec.yaml +++ /dev/null @@ -1,4 +0,0 @@ -name: non_browser_tests -dependencies: - unittest: any - diff --git a/utils/tests/testrunner/test.txt b/utils/tests/testrunner/test.txt deleted file mode 100644 index cd0875583aa..00000000000 --- a/utils/tests/testrunner/test.txt +++ /dev/null @@ -1 +0,0 @@ -Hello world! diff --git a/utils/tests/testrunner/testconfig b/utils/tests/testrunner/testconfig deleted file mode 100644 index 08672ffff8a..00000000000 --- a/utils/tests/testrunner/testconfig +++ /dev/null @@ -1 +0,0 @@ ---checked diff --git a/utils/tests/testrunner/testrunner_test.dart b/utils/tests/testrunner/testrunner_test.dart deleted file mode 100755 index 79553222605..00000000000 --- a/utils/tests/testrunner/testrunner_test.dart +++ /dev/null @@ -1,574 +0,0 @@ -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -library testrunner_test; - -import 'dart:async'; -import 'dart:io'; -import 'package:unittest/unittest.dart'; - -var dart; -var debug = false; - -Future runTestrunner( - command, List args, List stdout, List stderr) { - if (debug) { - print("Running $command ${args.join(' ')}"); - } - return Process.run(command, args).then((ProcessResult result) { - var lineEndings = new RegExp("\r\n|\n"); - stdout.addAll(result.stdout.trim().split(lineEndings)); - stderr.addAll(result.stderr.trim().split(lineEndings)); - }).catchError((e) { - stderr.add("Error starting process:"); - stderr.add(" Command: $command"); - stderr.add(" Error: ${e}"); - completer.complete(-1); - }); -} - -// Useful utility for debugging test failures. -void dump(label, list) { - if (!debug) return; - print('\n@=[ $label ]=============================\n'); - for (var i = 0; i < list.length; i++) { - print('@ ${list[i]}\n'); - } - print('------------------------------------------\n'); -} - -int stringCompare(String s1, String s2) => s1.compareTo(s2); - -Future runTest(List args, List expected_stdout, - {List expected_stderr, sort: false}) { - var stdout = new List(); - var stderr = new List(); - for (var i = 0; i < expected_stdout.length; i++) { - expected_stdout[i] = - expected_stdout[i].replaceAll('/', Platform.pathSeparator); - } - if (debug) { - args.insert(1, "--log=stderr"); - } - var rtn = runTestrunner(dart, args, stdout, stderr); - rtn.then((_) { - dump('stderr', stderr); - dump('stdout', stdout); - - if (expected_stderr != null) { - expect(stderr.length, orderedEquals(expected_stderr)); - } - var i, l = 0, matched = 0; - if (sort) { - stdout.sort(stringCompare); - expected_stdout.sort(stringCompare); - } - for (i = 0; i < stdout.length; i++) { - if (!stdout[i].startsWith('@')) { - if (expected_stdout.length <= l) { - fail("Extra text in output: ${stdout[i]}"); - return; - } - var actual = stdout[i].trim(); - if (debug) { - print("Compare <$actual> and <${expected_stdout[l]}>"); - } - if (expected_stdout[l].startsWith('*')) { - expect(actual, endsWith(expected_stdout[l].substring(1))); - } else if (expected_stdout[l].startsWith('?')) { - var pat = expected_stdout[l].substring(1); - if (Platform.operatingSystem == 'windows') { - // The joys of Windows... - pat = pat.replaceAll('\\', '\\\\'); - } - expect(actual, matches(pat)); - } else { - expect(actual, expected_stdout[l]); - } - ++l; - } - } - if (l < expected_stdout.length) { - fail("Only matched $l of ${expected_stdout.length} lines"); - } - }); - return rtn; -} - -// A useful function to quickly disable a group of tests; just -// replace group() with skip_group(). -skip_group(_1, _2) {} - -main() { - dart = Platform.executable; - var idx = dart.indexOf('dart-sdk'); - if (idx < 0) { - print("Please run using the dart executable from the Dart SDK"); - exit(-1); - } - var _ = Platform.pathSeparator; - var testrunner = '../../testrunner/testrunner.dart' - .replaceAll('/', Platform.pathSeparator); - - group("list tests", () { - test('list file', () { - return runTest([testrunner, '--list-files', 'non_browser_tests'], - ['?.*/non_browser_tests/non_browser_test.dart']); - }); - test('list files', () { - return runTest([ - testrunner, - '--recurse', - '--sort', - '--list-files', - '--test-file-pattern=.dart\$' - ], [ - '*browser_tests/web/browser_test.dart', - '*http_client_tests/http_client_test.dart', - '*layout_tests/web/layout_test.dart', - '*non_browser_tests/non_browser_test.dart', - '*non_browser_tests/non_browser_toast.dart', - '*/testrunner_test.dart' - ]); - }); - test('list files', () { - return runTest([ - testrunner, - '--list-files', - '--test-file-pattern=.dart\$', - 'non_browser_tests' - ], [ - '*non_browser_tests/non_browser_test.dart', - '*non_browser_tests/non_browser_toast.dart' - ], sort: true); - }); - test('list groups', () { - return runTest([ - testrunner, - '--list-groups', - 'non_browser_tests' - ], [ - '*non_browser_tests/non_browser_test.dart group1', - '*non_browser_tests/non_browser_test.dart group2' - ]); - }); - test('list tests', () { - return runTest([ - testrunner, - '--list-tests', - 'non_browser_tests' - ], [ - '*non_browser_tests/non_browser_test.dart group1 test1', - '*non_browser_tests/non_browser_test.dart group2 test2' - ]); - }); - }); - - group("vm", () { - test("vm without timing info", () { - return runTest([ - testrunner, - '--recurse', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' - ' Expected: false', - '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' - ]); - }); - - test("vm with timing info", () { - return runTest([ - testrunner, - '--recurse', - '--time', - 'non_browser_tests' - ], [ - '?FAIL [0-9.]+s .*/non_browser_tests/non_browser_test.dart group1' - ' test1 Expected: false', - '?PASS [0-9.]+s .*/non_browser_tests/non_browser_test.dart group2' - ' test2' - ]); - }); - }); - - group("selection", () { - test("--include", () { - return runTest([ - testrunner, - '--recurse', - '--include=group1', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' - 'Expected: false' - ]); - }); - - test("--exclude", () { - return runTest( - [testrunner, '--recurse', '--exclude=group1', 'non_browser_tests'], - ['?PASS .*/non_browser_tests/non_browser_test.dart group2 test2']); - }); - - test("test file pattern", () { - return runTest([ - testrunner, - '--recurse', - '--test-file-pattern=toast', - 'non_browser_tests' - ], [ - '?PASS .*/non_browser_tests/non_browser_toast.dart foo bar' - ]); - }); - }); - - group("stop on failure tests", () { - test("without stop", () { - return runTest([ - testrunner, - '--recurse', - '--sort', - '--tasks=1', - '--test-file-pattern=.dart\$', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' - 'Expected: false', - '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2', - '?PASS .*/non_browser_tests/non_browser_toast.dart foo bar' - ]); - }); - test("with stop", () { - return runTest([ - testrunner, - '--recurse', - '--sort', - '--tasks=1', - '--test-file-pattern=.dart\$', - '--stop-on-failure', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' - 'Expected: false', - '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' - ]); - }); - }); - - group("output control", () { - test("summary test", () { - return runTest([ - testrunner, - '--recurse', - '--summary', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' - 'Expected: false', - '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2', - '', - '?.*/non_browser_tests/non_browser_test.dart: ' - '1 PASSED, 1 FAILED, 0 ERRORS' - ]); - }); - - test('list tests with custom format', () { - return runTest([ - testrunner, - '--list-tests', - '--list-format=""', - 'non_browser_tests' - ], [ - '?.*/non_browser_tests/non_browser_test.dart test1', - '?.*/non_browser_tests/non_browser_test.dart test2' - ]); - }); - - test("custom message formatting", () { - return runTest([ - testrunner, - '--recurse', - '--pass-format=YIPPEE! ', - '--fail-format=EPIC FAIL! ', - 'non_browser_tests' - ], [ - 'EPIC FAIL! group1 test1', - 'YIPPEE! group2 test2' - ]); - }); - }); - - test("checked mode test", () { - return runTest([ - testrunner, - '--recurse', - '--checked', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' - 'Expected: false', - "?FAIL .*/non_browser_tests/non_browser_test.dart group2 test2 " - "Caught type 'int' is not a subtype of type 'bool' of 'x'." - ]); - }); - - group("browser", () { - test("native test", () { - return runTest([ - testrunner, - '--recurse', - '--runtime=drt-dart', - 'browser_tests' - ], [ - '?FAIL .*/browser_tests/web/browser_test.dart group1 test1 ' - 'Expected: false', - '?PASS .*/browser_tests/web/browser_test.dart group2 test2' - ]); - }); - - test("compiled test", () { - return runTest([ - testrunner, - '--recurse', - '--runtime=drt-js', - 'browser_tests' - ], [ - '?FAIL .*/browser_tests/web/browser_test.dart group1 test1 ' - 'Expected: false', - '?PASS .*/browser_tests/web/browser_test.dart group2 test2' - ]); - }); - }); - - group("textual layout tests", () { - group("drt-dart", () { - test("no baseline", () { - var f = new File("layout_tests/web/layout_test/layout.txt"); - if (f.existsSync()) { - f.deleteSync(); - } - return runTest([ - testrunner, - '--runtime=drt-dart', - '--recurse', - '--layout-text', - 'layout_tests' - ], [ - '?FAIL .*/layout_tests/web/layout_test.dart layout ' - 'No expectation file' - ]); - }); - test("create baseline", () { - return runTest([ - testrunner, - '--runtime=drt-dart', - '--recurse', - '--layout-text', - '--regenerate', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - test("test baseline", () { - return runTest([ - testrunner, - '--runtime=drt-dart', - '--recurse', - '--layout-text', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - }); - group("drt-js", () { - test("no baseline", () { - var f = new File("layout_tests/web/layout_test/layout.txt"); - if (f.existsSync()) { - f.deleteSync(); - } - return runTest([ - testrunner, - '--runtime=drt-js', - '--recurse', - '--layout-text', - 'layout_tests' - ], [ - '?FAIL .*/layout_tests/web/layout_test.dart layout ' - 'No expectation file' - ]); - }); - test("create baseline", () { - return runTest([ - testrunner, - '--runtime=drt-js', - '--recurse', - '--layout-text', - '--regenerate', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - test("test baseline", () { - return runTest([ - testrunner, - '--runtime=drt-js', - '--recurse', - '--layout-text', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - }); - }); - - group("pixel layout tests", () { - group("drt-dart", () { - test("no baseline", () { - var f = new File("layout_tests/web/layout_test/layout.png"); - if (f.existsSync()) { - f.deleteSync(); - } - return runTest([ - testrunner, - '--runtime=drt-dart', - '--recurse', - '--layout-pixel', - 'layout_tests' - ], [ - '?FAIL .*/layout_tests/web/layout_test.dart layout ' - 'No expectation file' - ]); - }); - test("create baseline", () { - return runTest([ - testrunner, - '--runtime=drt-dart', - '--recurse', - '--layout-pixel', - '--regenerate', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - test("test baseline", () { - return runTest([ - testrunner, - '--runtime=drt-dart', - '--recurse', - '--layout-pixel', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - // TODO(gram): Should add a test that changes a byte of the - // expectation .png. - }); - group("drt-js", () { - test("no baseline", () { - var f = new File("layout_tests/web/layout_test/layout.png"); - if (f.existsSync()) { - f.deleteSync(); - } - return runTest([ - testrunner, - '--runtime=drt-js', - '--recurse', - '--layout-pixel', - 'layout_tests' - ], [ - '?FAIL .*/layout_tests/web/layout_test.dart layout ' - 'No expectation file' - ]); - }); - test("create baseline", () { - return runTest([ - testrunner, - '--runtime=drt-js', - '--recurse', - '--layout-pixel', - '--regenerate', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - test("test baseline", () { - return runTest([ - testrunner, - '--runtime=drt-js', - '--recurse', - '--layout-pixel', - 'layout_tests' - ], [ - '?PASS .*/layout_tests/web/layout_test.dart layout' - ]); - }); - }); - }); - - group("run in isolate", () { - test("vm", () { - return runTest([ - testrunner, - '--runtime=vm', - '--recurse', - '--isolate', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' - ' Expected: false', - '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' - ]); - }); - test("drt-dart", () { - return runTest([ - testrunner, - '--runtime=drt-dart', - '--recurse', - '--isolate', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1' - ' Expected: false', - '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' - ]); - }); - test("drt-js", () { - return runTest([ - testrunner, - '--runtime=drt-js', - '--recurse', - '--isolate', - 'non_browser_tests' - ], [ - '?FAIL .*/non_browser_tests/non_browser_test.dart group1 test1 ' - 'Expected: false', - '?PASS .*/non_browser_tests/non_browser_test.dart group2 test2' - ]); - }); - }); - - group("embedded server", () { - test("get test", () { - return runTest([ - testrunner, - '--recurse', - '--server', - '--port=3456', - '--root=${Directory.current.path}', - 'http_client_tests' - ], [ - '?PASS .*/http_client_tests/http_client_test.dart test1', - '?PASS .*/http_client_tests/http_client_test.dart test2' - ]); - }); - }); -}