From ea46dc63cede4d2ef3b507af713054656e804eb3 Mon Sep 17 00:00:00 2001 From: "asgerf@google.com" Date: Tue, 13 Jan 2015 12:50:37 +0000 Subject: [PATCH] Split js_backend_cps_ir tests into multiple test units. When testing everything from a single entry point, the time budget does not increase as we add more test cases. So that approach did not scale. BUG= Review URL: https://codereview.chromium.org//810183003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42804 260f80e4-7a28-3924-810f-c04153c831b5 --- ...ps_ir_test.dart => js_backend_cps_ir.dart} | 19 ++----------------- ...dart => js_backend_cps_ir_basic_test.dart} | 8 +++++++- ...t => js_backend_cps_ir_closures_test.dart} | 9 +++++++-- ... js_backend_cps_ir_control_flow_test.dart} | 7 ++++++- ... js_backend_cps_ir_interceptors_test.dart} | 8 +++++++- ...t => js_backend_cps_ir_literals_test.dart} | 7 ++++++- ... => js_backend_cps_ir_operators_test.dart} | 7 ++++++- 7 files changed, 41 insertions(+), 24 deletions(-) rename tests/compiler/dart2js/{js_backend_cps_ir_test.dart => js_backend_cps_ir.dart} (75%) rename tests/compiler/dart2js/{js_backend_cps_ir_basic.dart => js_backend_cps_ir_basic_test.dart} (94%) rename tests/compiler/dart2js/{js_backend_cps_ir_closures.dart => js_backend_cps_ir_closures_test.dart} (94%) rename tests/compiler/dart2js/{js_backend_cps_ir_control_flow.dart => js_backend_cps_ir_control_flow_test.dart} (95%) rename tests/compiler/dart2js/{js_backend_cps_ir_interceptors.dart => js_backend_cps_ir_interceptors_test.dart} (83%) rename tests/compiler/dart2js/{js_backend_cps_ir_literals.dart => js_backend_cps_ir_literals_test.dart} (88%) rename tests/compiler/dart2js/{js_backend_cps_ir_operators.dart => js_backend_cps_ir_operators_test.dart} (91%) diff --git a/tests/compiler/dart2js/js_backend_cps_ir_test.dart b/tests/compiler/dart2js/js_backend_cps_ir.dart similarity index 75% rename from tests/compiler/dart2js/js_backend_cps_ir_test.dart rename to tests/compiler/dart2js/js_backend_cps_ir.dart index 4acdd28c74a..34ccdfe98e1 100644 --- a/tests/compiler/dart2js/js_backend_cps_ir_test.dart +++ b/tests/compiler/dart2js/js_backend_cps_ir.dart @@ -1,7 +1,6 @@ // Copyright (c) 2014, 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. -// VMOptions=-DUSE_CPS_IR=true // Test that the CPS IR code generator compiles programs and produces the // the expected output. @@ -14,23 +13,8 @@ import 'memory_compiler.dart'; import 'package:compiler/src/js/js.dart' as js; import 'package:compiler/src/common.dart' show Element; -import 'js_backend_cps_ir_basic.dart' as basic; -import 'js_backend_cps_ir_literals.dart' as literals; -import 'js_backend_cps_ir_operators.dart' as operators; -import 'js_backend_cps_ir_control_flow.dart' as control_flow; -import 'js_backend_cps_ir_interceptors.dart' as interceptors; -import 'js_backend_cps_ir_closures.dart' as closures; - const String TEST_MAIN_FILE = 'test.dart'; -List tests = [] - ..addAll(basic.tests) - ..addAll(literals.tests) - ..addAll(control_flow.tests) - ..addAll(operators.tests) - ..addAll(interceptors.tests) - ..addAll(closures.tests); - class TestEntry { final String source; final String expectation; @@ -47,7 +31,8 @@ String getCodeForMain(Compiler compiler) { return js.prettyPrint(ast, compiler).getText(); } -main() { + +runTests(List tests) { Expect.isTrue(const bool.fromEnvironment("USE_CPS_IR")); for (TestEntry test in tests) { diff --git a/tests/compiler/dart2js/js_backend_cps_ir_basic.dart b/tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart similarity index 94% rename from tests/compiler/dart2js/js_backend_cps_ir_basic.dart rename to tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart index d10d2c2365a..cde5ccc0470 100644 --- a/tests/compiler/dart2js/js_backend_cps_ir_basic.dart +++ b/tests/compiler/dart2js/js_backend_cps_ir_basic_test.dart @@ -1,12 +1,13 @@ // Copyright (c) 2014, 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. +// VMOptions=-DUSE_CPS_IR=true // Tests for basic functionality. library basic_tests; -import 'js_backend_cps_ir_test.dart'; +import 'js_backend_cps_ir.dart'; const List tests = const [ const TestEntry(""" @@ -101,3 +102,8 @@ function() { return null; }"""), ]; + + +void main() { + runTests(tests); +} diff --git a/tests/compiler/dart2js/js_backend_cps_ir_closures.dart b/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart similarity index 94% rename from tests/compiler/dart2js/js_backend_cps_ir_closures.dart rename to tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart index 2e18e304acc..125bf2b7c0f 100644 --- a/tests/compiler/dart2js/js_backend_cps_ir_closures.dart +++ b/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart @@ -1,12 +1,13 @@ // Copyright (c) 2014, 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. +// VMOptions=-DUSE_CPS_IR=true -// Tests of interceptors. +// Tests of closures. library closures_test; -import 'js_backend_cps_ir_test.dart'; +import 'js_backend_cps_ir.dart'; const List tests = const [ const TestEntry(""" @@ -123,3 +124,7 @@ function() { } }"""), ]; + +void main() { + runTests(tests); +} diff --git a/tests/compiler/dart2js/js_backend_cps_ir_control_flow.dart b/tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart similarity index 95% rename from tests/compiler/dart2js/js_backend_cps_ir_control_flow.dart rename to tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart index 2695588a825..9f82e28ac05 100644 --- a/tests/compiler/dart2js/js_backend_cps_ir_control_flow.dart +++ b/tests/compiler/dart2js/js_backend_cps_ir_control_flow_test.dart @@ -1,12 +1,13 @@ // Copyright (c) 2014, 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. +// VMOptions=-DUSE_CPS_IR=true // Tests of control flow statements. library control_flow_tests; -import 'js_backend_cps_ir_test.dart'; +import 'js_backend_cps_ir.dart'; const List tests = const [ const TestEntry(""" @@ -138,3 +139,7 @@ function() { return null; }"""), ]; + +void main() { + runTests(tests); +} diff --git a/tests/compiler/dart2js/js_backend_cps_ir_interceptors.dart b/tests/compiler/dart2js/js_backend_cps_ir_interceptors_test.dart similarity index 83% rename from tests/compiler/dart2js/js_backend_cps_ir_interceptors.dart rename to tests/compiler/dart2js/js_backend_cps_ir_interceptors_test.dart index 6640b9a65c9..ef56ac0342b 100644 --- a/tests/compiler/dart2js/js_backend_cps_ir_interceptors.dart +++ b/tests/compiler/dart2js/js_backend_cps_ir_interceptors_test.dart @@ -1,12 +1,13 @@ // Copyright (c) 2014, 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. +// VMOptions=-DUSE_CPS_IR=true // Tests of interceptors. library interceptors_tests; -import 'js_backend_cps_ir_test.dart'; +import 'js_backend_cps_ir.dart'; const List tests = const [ const TestEntry(""" @@ -25,3 +26,8 @@ function() { return null; }"""), ]; + + +void main() { + runTests(tests); +} diff --git a/tests/compiler/dart2js/js_backend_cps_ir_literals.dart b/tests/compiler/dart2js/js_backend_cps_ir_literals_test.dart similarity index 88% rename from tests/compiler/dart2js/js_backend_cps_ir_literals.dart rename to tests/compiler/dart2js/js_backend_cps_ir_literals_test.dart index 02cfefe755d..ea90c77696a 100644 --- a/tests/compiler/dart2js/js_backend_cps_ir_literals.dart +++ b/tests/compiler/dart2js/js_backend_cps_ir_literals_test.dart @@ -1,12 +1,13 @@ // Copyright (c) 2014, 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. +// VMOptions=-DUSE_CPS_IR=true // Tests of literals. library literals_tests; -import 'js_backend_cps_ir_test.dart'; +import 'js_backend_cps_ir.dart'; const List tests = const [ const TestEntry(""" @@ -32,3 +33,7 @@ function() { return null; }"""), ]; + +void main() { + runTests(tests); +} diff --git a/tests/compiler/dart2js/js_backend_cps_ir_operators.dart b/tests/compiler/dart2js/js_backend_cps_ir_operators_test.dart similarity index 91% rename from tests/compiler/dart2js/js_backend_cps_ir_operators.dart rename to tests/compiler/dart2js/js_backend_cps_ir_operators_test.dart index 781dde16334..18aa0c52aa3 100644 --- a/tests/compiler/dart2js/js_backend_cps_ir_operators.dart +++ b/tests/compiler/dart2js/js_backend_cps_ir_operators_test.dart @@ -1,12 +1,13 @@ // Copyright (c) 2014, 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. +// VMOptions=-DUSE_CPS_IR=true // Tests of operators. library operators_tests; -import 'js_backend_cps_ir_test.dart'; +import 'js_backend_cps_ir.dart'; const List tests = const [ const TestEntry("main() { return true ? 42 : 'foo'; }"), @@ -43,3 +44,7 @@ main() { print(foo || foo); }""", return null; }"""), ]; + +void main() { + runTests(tests); +}