| 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 /** | 6 /** |
| 7 * This file is the entrypoint of the dart test suite. This suite is used | 7 * This file is the entrypoint of the dart test suite. This suite is used |
| 8 * to test: | 8 * to test: |
| 9 * | 9 * |
| 10 * 1. the dart vm | 10 * 1. the dart vm |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ['Test configurations:'] : ['Test configuration:']; | 102 ['Test configurations:'] : ['Test configuration:']; |
| 103 for (Map conf in configurations) { | 103 for (Map conf in configurations) { |
| 104 List settings = ['compiler', 'runtime', 'mode', 'arch'] | 104 List settings = ['compiler', 'runtime', 'mode', 'arch'] |
| 105 .mappedBy((name) => conf[name]).toList(); | 105 .mappedBy((name) => conf[name]).toList(); |
| 106 if (conf['checked']) settings.add('checked'); | 106 if (conf['checked']) settings.add('checked'); |
| 107 output_words.add(settings.join('_')); | 107 output_words.add(settings.join('_')); |
| 108 } | 108 } |
| 109 print(output_words.join(' ')); | 109 print(output_words.join(' ')); |
| 110 } | 110 } |
| 111 | 111 |
| 112 // Start global http servers that serve the entire dart repo. | 112 var runningBrowserTests = configurations.any((config) { |
| 113 // The http server is available on window.location.port, and a second server | 113 return TestUtils.isBrowserRuntime(config['runtime']); |
| 114 // for cross-domain tests can be found by calling getCrossOriginPortNumber(). | 114 }); |
| 115 if (!listTests) { | |
| 116 // Only start the server if we are running browser tests. | |
| 117 var runningBrowserTests = configurations.any((config) { | |
| 118 return TestUtils.isBrowserRuntime(config['runtime']); | |
| 119 }); | |
| 120 if (runningBrowserTests) { | |
| 121 TestingServerRunner.startHttpServer('127.0.0.1'); | |
| 122 // We start two servers so that we can test cross-domain tests. | |
| 123 TestingServerRunner.startHttpServer('127.0.0.1', | |
| 124 allowedPort: TestingServerRunner.serverList[0].port); | |
| 125 } | |
| 126 } | |
| 127 | 115 |
| 128 var testSuites = new List<TestSuite>(); | 116 var testSuites = new List<TestSuite>(); |
| 129 // FIXME(kustermann,ricow): This is broken and should be fixed ASAP. | |
| 130 // Issue: 8366 | |
| 131 TestingServerRunner.setBuildDir(firstConf); | |
| 132 TestingServerRunner.setPackageRootDir(firstConf); | |
| 133 var maxBrowserProcesses = maxProcesses; | 117 var maxBrowserProcesses = maxProcesses; |
| 134 for (var conf in configurations) { | 118 for (var conf in configurations) { |
| 119 if (!listTests && runningBrowserTests) { |
| 120 // Start global http servers that serve the entire dart repo. |
| 121 // The http server is available on window.location.port, and a second |
| 122 // server for cross-domain tests can be found by calling |
| 123 // getCrossOriginPortNumber(). |
| 124 var servers = new TestingServers(new Path(TestUtils.buildDir(conf))); |
| 125 servers.startServers('127.0.0.1'); |
| 126 conf['_servers_'] = servers; |
| 127 } |
| 128 |
| 135 // There should not be more than one InternetExplorerDriver instance | 129 // There should not be more than one InternetExplorerDriver instance |
| 136 // running at a time. For details, see | 130 // running at a time. For details, see |
| 137 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver. | 131 // http://code.google.com/p/selenium/wiki/InternetExplorerDriver. |
| 138 if (conf['runtime'].startsWith('ie')) { | 132 if (conf['runtime'].startsWith('ie')) { |
| 139 maxBrowserProcesses = 1; | 133 maxBrowserProcesses = 1; |
| 140 } | 134 } |
| 135 |
| 141 for (String key in selectors.keys) { | 136 for (String key in selectors.keys) { |
| 142 if (key == 'co19') { | 137 if (key == 'co19') { |
| 143 testSuites.add(new Co19TestSuite(conf)); | 138 testSuites.add(new Co19TestSuite(conf)); |
| 144 } else if (conf['runtime'] == 'vm' && key == 'vm') { | 139 } else if (conf['runtime'] == 'vm' && key == 'vm') { |
| 145 // vm tests contain both cc tests (added here) and dart tests (added in | 140 // vm tests contain both cc tests (added here) and dart tests (added in |
| 146 // [TEST_SUITE_DIRECTORIES]). | 141 // [TEST_SUITE_DIRECTORIES]). |
| 147 testSuites.add(new VMTestSuite(conf)); | 142 testSuites.add(new VMTestSuite(conf)); |
| 148 } else if (conf['compiler'] == 'dartc' && key == 'dartc') { | 143 } else if (conf['compiler'] == 'dartc' && key == 'dartc') { |
| 149 testSuites.add(new SamplesDartcTestSuite(conf)); | 144 testSuites.add(new SamplesDartcTestSuite(conf)); |
| 150 testSuites.add(new JUnitDartcTestSuite(conf)); | 145 testSuites.add(new JUnitDartcTestSuite(conf)); |
| 151 } | 146 } |
| 152 } | 147 } |
| 153 | 148 |
| 154 for (final testSuiteDir in TEST_SUITE_DIRECTORIES) { | 149 for (final testSuiteDir in TEST_SUITE_DIRECTORIES) { |
| 155 final name = testSuiteDir.filename; | 150 final name = testSuiteDir.filename; |
| 156 if (selectors.containsKey(name)) { | 151 if (selectors.containsKey(name)) { |
| 157 testSuites.add( | 152 testSuites.add( |
| 158 new StandardTestSuite.forDirectory(conf, testSuiteDir, | 153 new StandardTestSuite.forDirectory(conf, testSuiteDir)); |
| 159 serverList: TestingServerRunner.serverList)); | |
| 160 } | 154 } |
| 161 } | 155 } |
| 162 } | 156 } |
| 163 | 157 |
| 164 void allTestsFinished() { | 158 void allTestsFinished() { |
| 165 TestingServerRunner.terminateHttpServers(); | 159 for (var conf in configurations) { |
| 160 if (conf.containsKey('_servers_')) { |
| 161 conf['_servers_'].stopServers(); |
| 162 } |
| 163 } |
| 166 DebugLogger.close(); | 164 DebugLogger.close(); |
| 167 } | 165 } |
| 168 | 166 |
| 169 // Start process queue. | 167 // Start process queue. |
| 170 new ProcessQueue(maxProcesses, | 168 new ProcessQueue(maxProcesses, |
| 171 maxBrowserProcesses, | 169 maxBrowserProcesses, |
| 172 progressIndicator, | 170 progressIndicator, |
| 173 startTime, | 171 startTime, |
| 174 printTiming, | 172 printTiming, |
| 175 testSuites, | 173 testSuites, |
| 176 allTestsFinished, | 174 allTestsFinished, |
| 177 verbose, | 175 verbose, |
| 178 listTests); | 176 listTests); |
| 179 } | 177 } |
| OLD | NEW |