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

Side by Side Diff: tests/dartino_tests/snapshot_stacktrace_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/dartino_tests/sentence_tests.dart ('k') | tests/dartino_tests/test_suite_consumer.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 Stream, 7 Stream,
8 StreamController; 8 StreamController;
9 9
10 import 'dart:io' show 10 import 'dart:io' show
11 Directory, 11 Directory,
12 File, 12 File,
13 Process, 13 Process,
14 ProcessResult; 14 ProcessResult;
15 15
16 import 'dart:convert' show 16 import 'dart:convert' show
17 UTF8; 17 UTF8;
18 18
19 import 'package:expect/expect.dart' show 19 import 'package:expect/expect.dart' show
20 Expect; 20 Expect;
21 21
22 import '../fletchc/run.dart' show 22 import '../dartino_compiler/run.dart' show
23 export; 23 export;
24 24
25 import 'package:fletchc/program_info.dart' as program_info; 25 import 'package:dartino_compiler/program_info.dart' as program_info;
26 26
27 import 'utils.dart' show 27 import 'utils.dart' show
28 withTempDirectory; 28 withTempDirectory;
29 29
30 const String buildDirectory = 30 const String buildDirectory =
31 const String.fromEnvironment('test.dart.build-dir'); 31 const String.fromEnvironment('test.dart.build-dir');
32 32
33 const String buildArch = 33 const String buildArch =
34 const String.fromEnvironment('test.dart.build-arch'); 34 const String.fromEnvironment('test.dart.build-arch');
35 35
36 const String buildSystem = 36 const String buildSystem =
37 const String.fromEnvironment('test.dart.build-system'); 37 const String.fromEnvironment('test.dart.build-system');
38 38
39 final String fletchVM = '$buildDirectory/fletch-vm'; 39 final String dartinoVM = '$buildDirectory/dartino-vm';
40 40
41 typedef Future NoArgFuture(); 41 typedef Future NoArgFuture();
42 42
43 Future<Map<String, NoArgFuture>> listTests( 43 Future<Map<String, NoArgFuture>> listTests(
44 [bool write_golden_files = false]) async { 44 [bool write_golden_files = false]) async {
45 var tests = <String, NoArgFuture>{ 45 var tests = <String, NoArgFuture>{
46 'snapshot_stacktrace_tests/uncaught_exception': 46 'snapshot_stacktrace_tests/uncaught_exception':
47 () => runTest('uncaught_exception', write_golden_files), 47 () => runTest('uncaught_exception', write_golden_files),
48 'snapshot_stacktrace_tests/nsm_exception': 48 'snapshot_stacktrace_tests/nsm_exception':
49 () => runTest('nsm_exception', write_golden_files), 49 () => runTest('nsm_exception', write_golden_files),
(...skipping 10 matching lines...) Expand all
60 60
61 Future runTest(String testName, bool write_golden_files) { 61 Future runTest(String testName, bool write_golden_files) {
62 return withTempDirectory((Directory temp) async { 62 return withTempDirectory((Directory temp) async {
63 String snapshotFilename = '${temp.absolute.path}/test.snapshot'; 63 String snapshotFilename = '${temp.absolute.path}/test.snapshot';
64 64
65 // Part 1: Generate snapshot. 65 // Part 1: Generate snapshot.
66 await export( 66 await export(
67 testFilename(testName), snapshotFilename, binaryProgramInfo: true); 67 testFilename(testName), snapshotFilename, binaryProgramInfo: true);
68 68
69 // Part 2: Run VM. 69 // Part 2: Run VM.
70 ProcessResult result = await Process.run(fletchVM, [snapshotFilename]); 70 ProcessResult result = await Process.run(dartinoVM, [snapshotFilename]);
71 String expectationContent = 71 String expectationContent =
72 await new File(testExpectationFilename(testName)).readAsString(); 72 await new File(testExpectationFilename(testName)).readAsString();
73 73
74 // Part 3: Transform stdout via stack trace decoder. 74 // Part 3: Transform stdout via stack trace decoder.
75 var stdin = new Stream.fromIterable([UTF8.encode(result.stdout)]); 75 var stdin = new Stream.fromIterable([UTF8.encode(result.stdout)]);
76 var stdout = new StreamController(); 76 var stdout = new StreamController();
77 Future<List> stdoutBytes = 77 Future<List> stdoutBytes =
78 stdout.stream.fold([], (buffer, data) => buffer..addAll(data)); 78 stdout.stream.fold([], (buffer, data) => buffer..addAll(data));
79 var arguments = [ 79 var arguments = [
80 buildArch.toLowerCase() == 'x64' ? '64' : '32', 80 buildArch.toLowerCase() == 'x64' ? '64' : '32',
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 String testDirectory([String generated = '']) 120 String testDirectory([String generated = ''])
121 => 'tests/snapshot_stacktrace_tests$generated'; 121 => 'tests/snapshot_stacktrace_tests$generated';
122 122
123 main() async { 123 main() async {
124 var tests = await listTests(true); 124 var tests = await listTests(true);
125 for (var name in tests.keys) { 125 for (var name in tests.keys) {
126 await tests[name](); 126 await tests[name]();
127 } 127 }
128 } 128 }
OLDNEW
« no previous file with comments | « tests/dartino_tests/sentence_tests.dart ('k') | tests/dartino_tests/test_suite_consumer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698