| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 // TODO(ager): Get rid of this version of test.dart when we don't have | 6 // TODO(ager): Get rid of this version of test.dart when we don't have |
| 7 // to worry about the special runtime checkout anymore. | 7 // to worry about the special runtime checkout anymore. |
| 8 // This file is identical to test.dart with test suites in the | 8 // This file is identical to test.dart with test suites in the |
| 9 // directories samples, client, compiler, and utils removed. | 9 // directories samples, client, compiler, and utils removed. |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 if (configurations == null) return; | 43 if (configurations == null) return; |
| 44 | 44 |
| 45 // Extract global options from first configuration. | 45 // Extract global options from first configuration. |
| 46 var firstConf = configurations[0]; | 46 var firstConf = configurations[0]; |
| 47 Map<String, RegExp> selectors = firstConf['selectors']; | 47 Map<String, RegExp> selectors = firstConf['selectors']; |
| 48 var maxProcesses = firstConf['tasks']; | 48 var maxProcesses = firstConf['tasks']; |
| 49 var progressIndicator = firstConf['progress']; | 49 var progressIndicator = firstConf['progress']; |
| 50 var verbose = firstConf['verbose']; | 50 var verbose = firstConf['verbose']; |
| 51 var printTiming = firstConf['time']; | 51 var printTiming = firstConf['time']; |
| 52 var listTests = firstConf['list']; | 52 var listTests = firstConf['list']; |
| 53 var useContentSecurityPolicy = firstConf['csp']; | |
| 54 | 53 |
| 55 if (!firstConf['append_logs']) { | 54 if (!firstConf['append_logs']) { |
| 56 var file = new File(TestUtils.flakyFileName()); | 55 var file = new File(TestUtils.flakyFileName()); |
| 57 if (file.existsSync()) { | 56 if (file.existsSync()) { |
| 58 file.deleteSync(); | 57 file.deleteSync(); |
| 59 } | 58 } |
| 60 } | 59 } |
| 61 // Print the configurations being run by this execution of | 60 // Print the configurations being run by this execution of |
| 62 // test.dart. However, don't do it if the silent progress indicator | 61 // test.dart. However, don't do it if the silent progress indicator |
| 63 // is used. This is only needed because of the junit tests. | 62 // is used. This is only needed because of the junit tests. |
| 64 if (progressIndicator != 'silent') { | 63 if (progressIndicator != 'silent') { |
| 65 List output_words = configurations.length > 1 ? | 64 List output_words = configurations.length > 1 ? |
| 66 ['Test configurations:'] : ['Test configuration:']; | 65 ['Test configurations:'] : ['Test configuration:']; |
| 67 for (Map conf in configurations) { | 66 for (Map conf in configurations) { |
| 68 List settings = ['compiler', 'runtime', 'mode', 'arch'] | 67 List settings = ['compiler', 'runtime', 'mode', 'arch'] |
| 69 .mappedBy((name) => conf[name]).toList(); | 68 .mappedBy((name) => conf[name]).toList(); |
| 70 if (conf['checked']) settings.add('checked'); | 69 if (conf['checked']) settings.add('checked'); |
| 71 output_words.add(settings.join('_')); | 70 output_words.add(settings.join('_')); |
| 72 } | 71 } |
| 73 print(output_words.join(' ')); | 72 print(output_words.join(' ')); |
| 74 } | 73 } |
| 75 | 74 |
| 76 var runningBrowserTests = configurations.any((config) { | |
| 77 return TestUtils.isBrowserRuntime(config['runtime']); | |
| 78 }); | |
| 79 | |
| 80 var testSuites = new List<TestSuite>(); | 75 var testSuites = new List<TestSuite>(); |
| 81 for (var conf in configurations) { | 76 for (var conf in configurations) { |
| 82 if (!listTests && runningBrowserTests) { | |
| 83 // Start global http servers that serve the entire dart repo. | |
| 84 // The http server is available on window.location.port, and a second | |
| 85 // server for cross-domain tests can be found by calling | |
| 86 // getCrossOriginPortNumber(). | |
| 87 var servers = new TestingServers(new Path(TestUtils.buildDir(conf)), | |
| 88 useContentSecurityPolicy); | |
| 89 servers.startServers('127.0.0.1'); | |
| 90 conf['_servers_'] = servers; | |
| 91 } | |
| 92 | |
| 93 if (selectors.containsKey('co19')) { | 77 if (selectors.containsKey('co19')) { |
| 94 testSuites.add(new Co19TestSuite(conf)); | 78 testSuites.add(new Co19TestSuite(conf)); |
| 95 } | 79 } |
| 96 | 80 |
| 97 if (conf['runtime'] == 'vm' && selectors.containsKey('vm')) { | 81 if (conf['runtime'] == 'vm' && selectors.containsKey('vm')) { |
| 98 // vm tests contain both cc tests (added here) and dart tests (added in | 82 // vm tests contain both cc tests (added here) and dart tests (added in |
| 99 // [TEST_SUITE_DIRECTORIES]). | 83 // [TEST_SUITE_DIRECTORIES]). |
| 100 testSuites.add(new VMTestSuite(conf)); | 84 testSuites.add(new VMTestSuite(conf)); |
| 101 } | 85 } |
| 102 | 86 |
| 103 for (final testSuiteDir in TEST_SUITE_DIRECTORIES) { | 87 for (final testSuiteDir in TEST_SUITE_DIRECTORIES) { |
| 104 final name = testSuiteDir.filename; | 88 final name = testSuiteDir.filename; |
| 105 if (selectors.containsKey(name)) { | 89 if (selectors.containsKey(name)) { |
| 106 testSuites.add(new StandardTestSuite.forDirectory(conf, testSuiteDir)); | 90 testSuites.add(new StandardTestSuite.forDirectory(conf, testSuiteDir)); |
| 107 } | 91 } |
| 108 } | 92 } |
| 109 } | 93 } |
| 110 | 94 |
| 111 void allTestsFinished() { | 95 void allTestsFinished() { |
| 112 for (var conf in configurations) { | |
| 113 if (conf.containsKey('_servers_')) { | |
| 114 conf['_servers_'].stopServers(); | |
| 115 } | |
| 116 } | |
| 117 DebugLogger.close(); | 96 DebugLogger.close(); |
| 118 } | 97 } |
| 119 | 98 |
| 120 var maxBrowserProcesses = maxProcesses; | 99 var maxBrowserProcesses = maxProcesses; |
| 121 | 100 |
| 122 // Start process queue. | 101 // Start process queue. |
| 123 new ProcessQueue( | 102 new ProcessQueue( |
| 124 maxProcesses, | 103 maxProcesses, |
| 125 maxBrowserProcesses, | 104 maxBrowserProcesses, |
| 126 progressIndicator, | 105 progressIndicator, |
| 127 startTime, | 106 startTime, |
| 128 printTiming, | 107 printTiming, |
| 129 testSuites, | 108 testSuites, |
| 130 allTestsFinished, | 109 allTestsFinished, |
| 131 verbose, | 110 verbose, |
| 132 listTests); | 111 listTests); |
| 133 } | 112 } |
| OLD | NEW |