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

Side by Side Diff: tests/service_tests/service_tests.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 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
« no previous file with comments | « tests/service_tests/performance/performance_test.cc ('k') | tests/servicec/servicec_tests.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:async' show 5 import 'dart:async' show
6 Future; 6 Future;
7 7
8 import 'dart:convert' show 8 import 'dart:convert' show
9 LineSplitter, 9 LineSplitter,
10 UTF8; 10 UTF8;
11 11
12 import 'dart:io' show 12 import 'dart:io' show
13 Directory, 13 Directory,
14 File, 14 File,
15 FileSystemEntity, 15 FileSystemEntity,
16 Platform, 16 Platform,
17 Process, 17 Process,
18 ProcessResult; 18 ProcessResult;
19 19
20 import 'package:expect/expect.dart' show 20 import 'package:expect/expect.dart' show
21 Expect; 21 Expect;
22 22
23 import 'multiple_services/multiple_services_tests.dart' as multiple; 23 import 'multiple_services/multiple_services_tests.dart' as multiple;
24 import '../../samples/todomvc/todomvc_service_tests.dart' as todomvc; 24 import '../../samples/todomvc/todomvc_service_tests.dart' as todomvc;
25 import '../../samples/simple_todo/simple_todo_service_tests.dart' 25 import '../../samples/simple_todo/simple_todo_service_tests.dart'
26 as simple_todo; 26 as simple_todo;
27 27
28 import '../fletchc/run.dart' show 28 import '../dartino_compiler/run.dart' show
29 export; 29 export;
30 30
31 import 'package:servicec/compiler.dart' as servicec; 31 import 'package:servicec/compiler.dart' as servicec;
32 32
33 List<ServiceTest> SERVICE_TESTS = <ServiceTest>[] 33 List<ServiceTest> SERVICE_TESTS = <ServiceTest>[]
34 ..add(todomvc.serviceTest) 34 ..add(todomvc.serviceTest)
35 ..addAll(simple_todo.serviceTests) 35 ..addAll(simple_todo.serviceTests)
36 ..addAll(multiple.serviceTests) 36 ..addAll(multiple.serviceTests)
37 ..addAll(buildStandardServiceTests( 37 ..addAll(buildStandardServiceTests(
38 'conformance', 38 'conformance',
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 /// Resources directory for servicec. 86 /// Resources directory for servicec.
87 final Uri resourcesDirectory = servicecDirectory.resolve('lib/src/resources'); 87 final Uri resourcesDirectory = servicecDirectory.resolve('lib/src/resources');
88 88
89 /// Temporary directory for test output. 89 /// Temporary directory for test output.
90 const String tempTestOutputDirectory = 90 const String tempTestOutputDirectory =
91 const String.fromEnvironment("test.dart.temp-dir"); 91 const String.fromEnvironment("test.dart.temp-dir");
92 92
93 final String generatedDirectory = '$tempTestOutputDirectory/service_tests'; 93 final String generatedDirectory = '$tempTestOutputDirectory/service_tests';
94 94
95 // TODO(zerny): Provide the below constants via configuration from test.py 95 // TODO(zerny): Provide the below constants via configuration from test.py
96 final String fletchExecutable = '$buildDirectory/fletch'; 96 final String dartinoExecutable = '$buildDirectory/dartino';
97 final String fletchLibrary = '$buildDirectory/libfletch.a'; 97 final String dartinoLibrary = '$buildDirectory/libdartino.a';
98 98
99 /// Location of JDK installation. Empty if no installation was found. 99 /// Location of JDK installation. Empty if no installation was found.
100 const String javaHome = const String.fromEnvironment('java-home'); 100 const String javaHome = const String.fromEnvironment('java-home');
101 101
102 const bool isAsan = buildAsan; 102 const bool isAsan = buildAsan;
103 const bool isClang = buildClang; 103 const bool isClang = buildClang;
104 const bool isGNU = !buildClang; 104 const bool isGNU = !buildClang;
105 const bool isMacOS = buildSystem == 'macos'; 105 const bool isMacOS = buildSystem == 'macos';
106 const bool isLinux = buildSystem == 'linux'; 106 const bool isLinux = buildSystem == 'linux';
107 107
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 String get jarFile => '$outputDirectory/$baseName.jar'; 187 String get jarFile => '$outputDirectory/$baseName.jar';
188 188
189 Future<Null> prepare() async { 189 Future<Null> prepare() async {
190 prepareService(); 190 prepareService();
191 prepareSnapshot(); 191 prepareSnapshot();
192 192
193 // Complete the test here if Java home is not set. 193 // Complete the test here if Java home is not set.
194 if (javaHome.isEmpty) return; 194 if (javaHome.isEmpty) return;
195 195
196 rules.add(new CcRule( 196 rules.add(new CcRule(
197 sharedLibrary: '$outputDirectory/libfletch', 197 sharedLibrary: '$outputDirectory/libdartino',
198 includePaths: [ 198 includePaths: [
199 'include', 199 'include',
200 '$javaHome/include', 200 '$javaHome/include',
201 '$javaHome/include/${isMacOS ? "darwin" : "linux"}', 201 '$javaHome/include/${isMacOS ? "darwin" : "linux"}',
202 outputDirectory, 202 outputDirectory,
203 ], 203 ],
204 sources: [ 204 sources: [
205 '$javaDirectory/jni/fletch_api_wrapper.cc', 205 '$javaDirectory/jni/dartino_api_wrapper.cc',
206 '$javaDirectory/jni/fletch_service_api_wrapper.cc', 206 '$javaDirectory/jni/dartino_service_api_wrapper.cc',
207 '$javaDirectory/jni/${baseName}_service_wrapper.cc', 207 '$javaDirectory/jni/${baseName}_service_wrapper.cc',
208 ]..addAll(ccSources))); 208 ]..addAll(ccSources)));
209 209
210 rules.add(new MakeDirectoryRule(classesDirectory)); 210 rules.add(new MakeDirectoryRule(classesDirectory));
211 211
212 rules.add(new JavacRule( 212 rules.add(new JavacRule(
213 warningAsError: false, 213 warningAsError: false,
214 sources: ['$javaDirectory/fletch'] 214 sources: ['$javaDirectory/dartino']
215 ..addAll(javaSources.map((path) => '$inputDirectory/$path')), 215 ..addAll(javaSources.map((path) => '$inputDirectory/$path')),
216 outputDirectory: classesDirectory)); 216 outputDirectory: classesDirectory));
217 217
218 rules.add(new JarRule( 218 rules.add(new JarRule(
219 jarFile, 219 jarFile,
220 sources: ['.'], 220 sources: ['.'],
221 baseDirectory: classesDirectory)); 221 baseDirectory: classesDirectory));
222 222
223 rules.add(new JavaRule( 223 rules.add(new JavaRule(
224 mainClass, 224 mainClass,
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 javaArguments.add(mainClass); 447 javaArguments.add(mainClass);
448 448
449 if (arguments != null) { 449 if (arguments != null) {
450 javaArguments.addAll(arguments); 450 javaArguments.addAll(arguments);
451 } 451 }
452 452
453 await Rule.runCommand(java, javaArguments, javaEnvironment); 453 await Rule.runCommand(java, javaArguments, javaEnvironment);
454 } 454 }
455 } 455 }
456 456
457 // TODO(zerny): Consider refactoring fletch specifics into a derived class. 457 // TODO(zerny): Consider refactoring dartino specifics into a derived class.
458 // TODO(zerny): Find a way to obtain the fletch build configuration from gyp. 458 // TODO(zerny): Find a way to obtain the dartino build configuration from gyp.
459 class CcRule extends Rule { 459 class CcRule extends Rule {
460 final String language; 460 final String language;
461 final String executable; 461 final String executable;
462 final String sharedLibrary; 462 final String sharedLibrary;
463 final Iterable<String> flags; 463 final Iterable<String> flags;
464 final Iterable<String> sources; 464 final Iterable<String> sources;
465 final Iterable<String> libraries; 465 final Iterable<String> libraries;
466 final Iterable<String> includePaths; 466 final Iterable<String> includePaths;
467 final Iterable<String> libraryPaths; 467 final Iterable<String> libraryPaths;
468 468
(...skipping 18 matching lines...) Expand all
487 String get compiler => 'tools/cxx_wrapper.py'; 487 String get compiler => 'tools/cxx_wrapper.py';
488 488
489 String get output { 489 String get output {
490 if (executable != null) return executable; 490 if (executable != null) return executable;
491 String suffix = isMacOS ? 'jnilib' : 'so'; 491 String suffix = isMacOS ? 'jnilib' : 'so';
492 return '$sharedLibrary.$suffix'; 492 return '$sharedLibrary.$suffix';
493 } 493 }
494 494
495 void addBuildFlags(List<String> arguments) { 495 void addBuildFlags(List<String> arguments) {
496 arguments.add('-std=${language}'); 496 arguments.add('-std=${language}');
497 arguments.add('-DFLETCH_ENABLE_FFI'); 497 arguments.add('-DDARTINO_ENABLE_FFI');
498 arguments.add('-DFLETCH_ENABLE_LIVE_CODING'); 498 arguments.add('-DDARTINO_ENABLE_LIVE_CODING');
499 arguments.add('-DFLETCH_ENABLE_PRINT_INTERCEPTORS'); 499 arguments.add('-DDARTINO_ENABLE_PRINT_INTERCEPTORS');
500 arguments.add('-DFLETCH_ENABLE_NATIVE_PROCESSES'); 500 arguments.add('-DDARTINO_ENABLE_NATIVE_PROCESSES');
501 if (sharedLibrary != null) arguments.add('-shared'); 501 if (sharedLibrary != null) arguments.add('-shared');
502 if (buildArchitecture == 'ia32') { 502 if (buildArchitecture == 'ia32') {
503 arguments.add('-m32'); 503 arguments.add('-m32');
504 arguments.add('-DFLETCH32'); 504 arguments.add('-DDARTINO32');
505 arguments.add('-DFLETCH_TARGET_IA32'); 505 arguments.add('-DDARTINO_TARGET_IA32');
506 } else if (buildArchitecture == 'x64') { 506 } else if (buildArchitecture == 'x64') {
507 arguments.add('-m64'); 507 arguments.add('-m64');
508 arguments.add('-DFLETCH64'); 508 arguments.add('-DDARTINO64');
509 arguments.add('-DFLETCH_TARGET_X64'); 509 arguments.add('-DDARTINO_TARGET_X64');
510 if (sharedLibrary != null) arguments.add('-fPIC'); 510 if (sharedLibrary != null) arguments.add('-fPIC');
511 } else { 511 } else {
512 throw "Unsupported architecture ${buildArchitecture}"; 512 throw "Unsupported architecture ${buildArchitecture}";
513 } 513 }
514 } 514 }
515 515
516 void addHostFlags(List<String> arguments) { 516 void addHostFlags(List<String> arguments) {
517 if (isMacOS) { 517 if (isMacOS) {
518 arguments.add('-DFLETCH_TARGET_OS_MACOS'); 518 arguments.add('-DDARTINO_TARGET_OS_MACOS');
519 arguments.add('-DFLETCH_TARGET_OS_POSIX'); 519 arguments.add('-DDARTINO_TARGET_OS_POSIX');
520 arguments.addAll(['-framework', 'CoreFoundation']); 520 arguments.addAll(['-framework', 'CoreFoundation']);
521 } else if (isLinux) { 521 } else if (isLinux) {
522 arguments.add('-DFLETCH_TARGET_OS_LINUX'); 522 arguments.add('-DDARTINO_TARGET_OS_LINUX');
523 arguments.add('-DFLETCH_TARGET_OS_POSIX'); 523 arguments.add('-DDARTINO_TARGET_OS_POSIX');
524 } else { 524 } else {
525 throw "Unsupported host ${buildSystem}"; 525 throw "Unsupported host ${buildSystem}";
526 } 526 }
527 } 527 }
528 528
529 void addUserFlags(List<String> arguments) { 529 void addUserFlags(List<String> arguments) {
530 arguments.addAll(flags); 530 arguments.addAll(flags);
531 } 531 }
532 532
533 void addIncludePaths(List<String> arguments) { 533 void addIncludePaths(List<String> arguments) {
534 arguments.add('-I.'); 534 arguments.add('-I.');
535 arguments.addAll(includePaths.map((path) => '-I${path}')); 535 arguments.addAll(includePaths.map((path) => '-I${path}'));
536 } 536 }
537 537
538 void addLibraryPaths(List<String> arguments) { 538 void addLibraryPaths(List<String> arguments) {
539 String arch; 539 String arch;
540 if (buildArchitecture == 'ia32') { 540 if (buildArchitecture == 'ia32') {
541 arch = 'x86'; 541 arch = 'x86';
542 } else if (buildArchitecture == 'x64') { 542 } else if (buildArchitecture == 'x64') {
543 arch = 'x64'; 543 arch = 'x64';
544 } else { 544 } else {
545 throw "Unsupported host architecture ${buildArchitecture}"; 545 throw "Unsupported host architecture ${buildArchitecture}";
546 } 546 }
547 if (isMacOS) arguments.add('-Lthird_party/libs/mac/$arch'); 547 if (isMacOS) arguments.add('-Lthird_party/libs/mac/$arch');
548 if (isLinux) arguments.add('-Lthird_party/libs/linux/$arch'); 548 if (isLinux) arguments.add('-Lthird_party/libs/linux/$arch');
549 arguments.addAll(libraryPaths.map((path) => '-L${path}')); 549 arguments.addAll(libraryPaths.map((path) => '-L${path}'));
550 } 550 }
551 551
552 void addLibraries(List<String> arguments) { 552 void addLibraries(List<String> arguments) {
553 arguments.add(fletchLibrary); 553 arguments.add(dartinoLibrary);
554 for (String lib in libraries) { 554 for (String lib in libraries) {
555 arguments.add(lib.endsWith('.a') ? lib : '-l$lib'); 555 arguments.add(lib.endsWith('.a') ? lib : '-l$lib');
556 } 556 }
557 } 557 }
558 558
559 void addHostLibraries(List<String> arguments) { 559 void addHostLibraries(List<String> arguments) {
560 arguments.addAll([ 560 arguments.addAll([
561 '-lpthread', 561 '-lpthread',
562 '-ldl', 562 '-ldl',
563 '-rdynamic', 563 '-rdynamic',
564 ]); 564 ]);
565 } 565 }
566 566
567 void addSources(List<String> arguments) { 567 void addSources(List<String> arguments) {
568 arguments.addAll(sources); 568 arguments.addAll(sources);
569 } 569 }
570 570
571 Future<Null> build() async { 571 Future<Null> build() async {
572 List<String> arguments = <String>[]; 572 List<String> arguments = <String>[];
573 if (isClang) arguments.add('-DFLETCH_CLANG'); 573 if (isClang) arguments.add('-DDARTINO_CLANG');
574 if (isAsan) { 574 if (isAsan) {
575 arguments.add('-DFLETCH_ASAN'); 575 arguments.add('-DDARTINO_ASAN');
576 arguments.add('-L/FLETCH_ASAN'); 576 arguments.add('-L/DARTINO_ASAN');
577 } 577 }
578 addBuildFlags(arguments); 578 addBuildFlags(arguments);
579 addHostFlags(arguments); 579 addHostFlags(arguments);
580 addUserFlags(arguments); 580 addUserFlags(arguments);
581 addIncludePaths(arguments); 581 addIncludePaths(arguments);
582 addLibraryPaths(arguments); 582 addLibraryPaths(arguments);
583 arguments.addAll(['-o', output]); 583 arguments.addAll(['-o', output]);
584 if (isGNU) arguments.add('-Wl,--start-group'); 584 if (isGNU) arguments.add('-Wl,--start-group');
585 addSources(arguments); 585 addSources(arguments);
586 addLibraries(arguments); 586 addLibraries(arguments);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 640
641 typedef Future NoArgFuture(); 641 typedef Future NoArgFuture();
642 642
643 Future<Map<String, NoArgFuture>> listTests() async { 643 Future<Map<String, NoArgFuture>> listTests() async {
644 var tests = <String, NoArgFuture>{}; 644 var tests = <String, NoArgFuture>{};
645 for (ServiceTest test in SERVICE_TESTS) { 645 for (ServiceTest test in SERVICE_TESTS) {
646 tests['service_tests/${test.name}'] = () => test.run(); 646 tests['service_tests/${test.name}'] = () => test.run();
647 } 647 }
648 return tests; 648 return tests;
649 } 649 }
OLDNEW
« no previous file with comments | « tests/service_tests/performance/performance_test.cc ('k') | tests/servicec/servicec_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698