Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 9036009: Add client/tests/client web tests to the test.dart test script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_progress.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("test_suite"); 5 #library("test_suite");
6 6
7 #import("status_file_parser.dart"); 7 #import("status_file_parser.dart");
8 #import("test_runner.dart"); 8 #import("test_runner.dart");
9 #import("multitest.dart"); 9 #import("multitest.dart");
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 filename.substring(middle + 1, filename.length - 5); 237 filename.substring(middle + 1, filename.length - 5);
238 } else { 238 } else {
239 // This case is hit by the dartc client compilation 239 // This case is hit by the dartc client compilation
240 // tests. These tests are pretty broken compared to the 240 // tests. These tests are pretty broken compared to the
241 // rest. They use the .dart suffix in the status files. They 241 // rest. They use the .dart suffix in the status files. They
242 // find tests in weird ways (testing that they contain "#"). 242 // find tests in weird ways (testing that they contain "#").
243 // They need to be redone. 243 // They need to be redone.
244 start = filename.indexOf(directoryPath); 244 start = filename.indexOf(directoryPath);
245 testName = filename.substring(start + directoryPath.length + 1, 245 testName = filename.substring(start + directoryPath.length + 1,
246 filename.length); 246 filename.length);
247 if (configuration['component'] != 'dartc') {
248 if (testName.endsWith('.dart')) {
249 testName = testName.substring(0, testName.length - 5);
250 }
251 }
247 } 252 }
248 Set<String> expectations = testExpectations.expectations(testName); 253 Set<String> expectations = testExpectations.expectations(testName);
249 if (configuration["report"]) { 254 if (configuration["report"]) {
250 // Tests with multiple VMOptions are counted more than once. 255 // Tests with multiple VMOptions are counted more than once.
251 for (var dummy in optionsFromFile["vmOptions"]) { 256 for (var dummy in optionsFromFile["vmOptions"]) {
252 SummaryReport.add(expectations); 257 SummaryReport.add(expectations);
253 } 258 }
254 } 259 }
255 if (expectations.contains(SKIP)) return; 260 if (expectations.contains(SKIP)) return;
256 261
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 bool isNegative) { 339 bool isNegative) {
335 if (optionsFromFile['isMultitest']) return; 340 if (optionsFromFile['isMultitest']) return;
336 bool isWebTest = optionsFromFile['containsDomImport']; 341 bool isWebTest = optionsFromFile['containsDomImport'];
337 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition']; 342 bool isLibraryDefinition = optionsFromFile['isLibraryDefinition'];
338 if (!isLibraryDefinition && optionsFromFile['containsSourceOrImport']) { 343 if (!isLibraryDefinition && optionsFromFile['containsSourceOrImport']) {
339 print('Warning for $filename: Browser tests require #library ' + 344 print('Warning for $filename: Browser tests require #library ' +
340 'in any file that uses #import or #source'); 345 'in any file that uses #import or #source');
341 } 346 }
342 347
343 String tempDirTemplate = '${TestUtils.buildDir(configuration)}/tmp'; 348 String tempDirTemplate = '${TestUtils.buildDir(configuration)}/tmp';
344 if (isWebTest) tempDirTemplate = 'client/' + tempDirTemplate; 349 // if (isWebTest) tempDirTemplate = 'client/' + tempDirTemplate;
345 Directory tempDir = new Directory(tempDirTemplate); 350 Directory tempDir = new Directory(tempDirTemplate);
346 // TODO(whesse): When implementing client web tests, 351 // TODO(whesse): When implementing client web tests,
347 // create directory in the client case, if it doesn't exist. 352 // create directory in the client case, if it doesn't exist.
348 tempDir.createTempSync(); 353 tempDir.createTempSync();
349 354
350 String dartTestFilename = new File(filename).fullPathSync(); 355 String dartTestFilename = new File(filename).fullPathSync();
351 String dartWrapperFilename = '${tempDir.path}/test.dart'; 356 String dartWrapperFilename;
352 if (!isWebTest) { 357 String scriptPath;
358 if (isWebTest) {
359 scriptPath = 'file://$dartTestFilename';
360 } else {
361 dartWrapperFilename = '${tempDir.path}/test.dart';
362 scriptPath = '../../../$dartWrapperFilename';
353 // test.dart will import the dart test directly, if it is a library, 363 // test.dart will import the dart test directly, if it is a library,
354 // or indirectly through test_as_library.dart, if it is not. 364 // or indirectly through test_as_library.dart, if it is not.
355 String dartLibraryFilename; 365 String dartLibraryFilename;
356 if (isLibraryDefinition) { 366 if (isLibraryDefinition) {
357 dartLibraryFilename = dartTestFilename; 367 dartLibraryFilename = dartTestFilename;
358 } else { 368 } else {
359 dartLibraryFilename = 'test_as_library.dart'; 369 dartLibraryFilename = 'test_as_library.dart';
360 File file = new File('${tempDir.path}/$dartLibraryFilename'); 370 File file = new File('${tempDir.path}/$dartLibraryFilename');
361 RandomAccessFile dartLibrary = file.openSync(writable: true); 371 RandomAccessFile dartLibrary = file.openSync(writable: true);
362 dartLibrary.writeStringSync(WrapDartTestInLibrary(dartTestFilename)); 372 dartLibrary.writeStringSync(WrapDartTestInLibrary(dartTestFilename));
363 dartLibrary.closeSync(); 373 dartLibrary.closeSync();
364 } 374 }
365 375
Bill Hesse 2011/12/23 15:05:25 Eliminate stray whitespace.
366 File file = new File(dartWrapperFilename); 376 File file = new File(dartWrapperFilename);
367 RandomAccessFile dartWrapper = file.openSync(writable: true); 377 RandomAccessFile dartWrapper = file.openSync(writable: true);
368 dartWrapper.writeStringSync(DartTestWrapper( 378 dartWrapper.writeStringSync(DartTestWrapper(
369 'dart:dom', 379 'dart:dom',
370 '../../../tests/isolate/src/TestFramework.dart', 380 '../../../tests/isolate/src/TestFramework.dart',
371 dartLibraryFilename)); 381 dartLibraryFilename));
372 dartWrapper.closeSync(); 382 dartWrapper.closeSync();
373 } else {
374 return; // TODO(whesse): Implement client web tests on dartium.
375 } 383 }
376 // Create the HTML file for the test. 384 // Create the HTML file for the test.
377 File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}'); 385 File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}');
378 RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true); 386 RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true);
379 htmlTest.writeStringSync(GetHtmlContents( 387 htmlTest.writeStringSync(GetHtmlContents(
380 filename, 388 filename,
381 '../../../client/testing/unittest/test_controller.js', 389 '../../../client/testing/unittest/test_controller.js',
382 scriptType, 390 scriptType,
383 '../../../$dartWrapperFilename')); 391 scriptPath));
384 htmlTest.closeSync(); 392 htmlTest.closeSync();
385 393
386 for (var vmOptions in optionsFromFile["vmOptions"]) { 394 for (var vmOptions in optionsFromFile["vmOptions"]) {
387 var drtFlags = ['-no-timeout']; 395 var drtFlags = ['--no-timeout'];
388 var dartFlags = ['--enable_asserts', '--enable_type_checks']; 396 var dartFlags = ['--enable_asserts', '--enable_type_checks'];
389 dartFlags.addAll(vmOptions); 397 dartFlags.addAll(vmOptions);
390 drtFlags.add('--dart-flags=${Strings.join(dartFlags, " ")}'); 398 drtFlags.add('--dart-flags=${Strings.join(dartFlags, " ")}');
391 var args = drtFlags; 399 var args = drtFlags;
392 args.add(htmlTestBase.fullPathSync()); 400 args.add(htmlTestBase.fullPathSync());
393 401
394 // Create BrowserTestCase and queue it. 402 // Create BrowserTestCase and queue it.
395 var testCase = new BrowserTestCase( 403 var testCase = new BrowserTestCase(
396 testName, 404 testName,
397 null, 405 null,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 String testRelativeDirFlattened; 438 String testRelativeDirFlattened;
431 439
432 int start = testRelativePath.lastIndexOf('src' + pathSeparator); 440 int start = testRelativePath.lastIndexOf('src' + pathSeparator);
433 if (start != -1) { 441 if (start != -1) {
434 Expect.isTrue(testRelativePath.endsWith('.dart')); 442 Expect.isTrue(testRelativePath.endsWith('.dart'));
435 testNameBase = 443 testNameBase =
436 testRelativePath.substring(start + 4, testRelativePath.length - 5); 444 testRelativePath.substring(start + 4, testRelativePath.length - 5);
437 testRelativeDir = testRelativePath.substring(0, start - 1); 445 testRelativeDir = testRelativePath.substring(0, start - 1);
438 testRelativeDirFlattened = testRelativeDir.replaceAll(pathSeparator, '_'); 446 testRelativeDirFlattened = testRelativeDir.replaceAll(pathSeparator, '_');
439 } else { 447 } else {
440 Expect.fail('Web tests not imlemented yet'); 448 Expect.isTrue(testRelativePath.endsWith('_tests.dart'));
449 start = testRelativePath.lastIndexOf(pathSeparator);
450 testNameBase =
451 testRelativePath.substring(start + 1, testRelativePath.length - 11);
441 } 452 }
442 453
443 if (!new Directory('$dartDir/$buildDir/generated_tests').existsSync()) { 454 if (!new Directory('$dartDir/$buildDir/generated_tests').existsSync()) {
444 new Directory('$dartDir/$buildDir/generated_tests').createSync(); 455 new Directory('$dartDir/$buildDir/generated_tests').createSync();
445 } 456 }
446 if (!new Directory(outputDirBase).existsSync()) { 457 if (!new Directory(outputDirBase).existsSync()) {
447 new Directory(outputDirBase).createSync(); 458 new Directory(outputDirBase).createSync();
448 } 459 }
449 Directory tempDir = new Directory( 460 Directory tempDir = new Directory(
450 '$outputDirBase/${testRelativeDirFlattened}_$testNameBase'); 461 '$outputDirBase/${testRelativeDirFlattened}_$testNameBase');
(...skipping 24 matching lines...) Expand all
475 } 486 }
476 487
477 File file = new File(dartWrapperFilename); 488 File file = new File(dartWrapperFilename);
478 RandomAccessFile dartWrapper = file.openSync(writable: true); 489 RandomAccessFile dartWrapper = file.openSync(writable: true);
479 dartWrapper.writeStringSync(DartTestWrapper( 490 dartWrapper.writeStringSync(DartTestWrapper(
480 domLibraryImport, 491 domLibraryImport,
481 '$dartDir/tests/isolate/src/TestFramework.dart', 492 '$dartDir/tests/isolate/src/TestFramework.dart',
482 dartLibraryFilename)); 493 dartLibraryFilename));
483 dartWrapper.closeSync(); 494 dartWrapper.closeSync();
484 } else { 495 } else {
485 return; // TODO(whesse): Implement client web tests on dartium. 496 dartWrapperFilename = testPath;
Bill Hesse 2011/12/23 15:05:25 Rename to dartScript?
497 // return; // TODO(whesse): Implement client web tests on dartium.
Bill Hesse 2011/12/23 15:05:25 Delete this comment.
486 } 498 }
487 // Create the HTML file for the test. 499 // Create the HTML file for the test.
488 File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}'); 500 File htmlTestBase = new File('${tempDir.path}/${getHtmlName(filename)}');
489 RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true); 501 RandomAccessFile htmlTest = htmlTestBase.openSync(writable: true);
490 htmlTest.writeStringSync(GetHtmlContents( 502 htmlTest.writeStringSync(GetHtmlContents(
491 filename, 503 filename,
492 '$dartDir/client/testing/unittest/test_controller.js', 504 '$dartDir/client/testing/unittest/test_controller.js',
493 scriptType, 505 scriptType,
494 compiledDartWrapperFilename)); 506 compiledDartWrapperFilename));
495 htmlTest.closeSync(); 507 htmlTest.closeSync();
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 * $noCrash tests are expected to be flaky but not crash 919 * $noCrash tests are expected to be flaky but not crash
908 * $pass tests are expected to pass 920 * $pass tests are expected to pass
909 * $failOk tests are expected to fail that we won't fix 921 * $failOk tests are expected to fail that we won't fix
910 * $fail tests are expected to fail that we should fix 922 * $fail tests are expected to fail that we should fix
911 * $crash tests are expected to crash that we should fix 923 * $crash tests are expected to crash that we should fix
912 * $timeout tests are allowed to timeout\ 924 * $timeout tests are allowed to timeout\
913 """; 925 """;
914 print(report); 926 print(report);
915 } 927 }
916 } 928 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_progress.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698