OLD | NEW |
1 // Copyright (c) 2016, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import '../fletchc/run.dart' show | 8 import '../dartino_compiler/run.dart' show |
9 export; | 9 export; |
10 import 'dart:convert' show | 10 import 'dart:convert' show |
11 LineSplitter, | 11 LineSplitter, |
12 UTF8, | 12 UTF8, |
13 Utf8Decoder; | 13 Utf8Decoder; |
14 | 14 |
15 main() async { | 15 main() async { |
16 await testServerClient(); | 16 await testServerClient(); |
17 } | 17 } |
18 | 18 |
19 typedef Future NoArgFuture(); | 19 typedef Future NoArgFuture(); |
20 | 20 |
21 const String fletchVmExecutable = const String.fromEnvironment('fletch-vm'); | 21 const String dartinoVmExecutable = const String.fromEnvironment('dartino-vm'); |
22 const String testsDir = const String.fromEnvironment('tests-dir'); | 22 const String testsDir = const String.fromEnvironment('tests-dir'); |
23 const String buildDirectory = | 23 const String buildDirectory = |
24 const String.fromEnvironment('test.dart.build-dir'); | 24 const String.fromEnvironment('test.dart.build-dir'); |
25 | 25 |
26 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 26 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
27 | 27 |
28 const String certPath = 'third_party/dart/tests/standalone/io/certificates'; | 28 const String certPath = 'third_party/dart/tests/standalone/io/certificates'; |
29 | 29 |
30 SecurityContext createContext() { | 30 SecurityContext createContext() { |
31 var testDirUri = new Uri.file(testsDir); | 31 var testDirUri = new Uri.file(testsDir); |
(...skipping 17 matching lines...) Expand all Loading... |
49 var testDirUri = new Uri.file(testsDir); | 49 var testDirUri = new Uri.file(testsDir); |
50 var client = testDirUri.resolve('mbedtls_tests/ssl_client.dart'); | 50 var client = testDirUri.resolve('mbedtls_tests/ssl_client.dart'); |
51 var tempTest = '$buildDirectory/tests'; | 51 var tempTest = '$buildDirectory/tests'; |
52 await new Directory(tempTest).create(recursive: true); | 52 await new Directory(tempTest).create(recursive: true); |
53 var snapshot = '$tempTest/ssl_client.snapshot'; | 53 var snapshot = '$tempTest/ssl_client.snapshot'; |
54 var environment = { | 54 var environment = { |
55 'SERVER_PORT': '${server.port}' | 55 'SERVER_PORT': '${server.port}' |
56 }; | 56 }; |
57 await export(client.toFilePath(), snapshot, constants:environment); | 57 await export(client.toFilePath(), snapshot, constants:environment); |
58 | 58 |
59 var process = await Process.start(fletchVmExecutable, [snapshot]); | 59 var process = await Process.start(dartinoVmExecutable, [snapshot]); |
60 // We print this, in the normal case there is no output, but in case of error | 60 // We print this, in the normal case there is no output, but in case of error |
61 // we actually want it all. | 61 // we actually want it all. |
62 var stdoutFuture = process.stdout.transform(UTF8.decoder) | 62 var stdoutFuture = process.stdout.transform(UTF8.decoder) |
63 .transform(new LineSplitter()) | 63 .transform(new LineSplitter()) |
64 .listen((s) => print('fletch-vm(stdout): $s')).asFuture(); | 64 .listen((s) => print('dartino-vm(stdout): $s')).asFuture(); |
65 var stderrFuture = process.stderr.transform(UTF8.decoder) | 65 var stderrFuture = process.stderr.transform(UTF8.decoder) |
66 .transform(new LineSplitter()) | 66 .transform(new LineSplitter()) |
67 .listen((s) => print('fletch-vm(stderr): $s')).asFuture(); | 67 .listen((s) => print('dartino-vm(stderr): $s')).asFuture(); |
68 var result = await process.exitCode; | 68 var result = await process.exitCode; |
69 await server.close(); | 69 await server.close(); |
70 await stdoutFuture; | 70 await stdoutFuture; |
71 await stderrFuture; | 71 await stderrFuture; |
72 Expect.equals(result, 0); | 72 Expect.equals(result, 0); |
73 | 73 |
74 } | 74 } |
OLD | NEW |