OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // IF YOU BREAK THIS TEST YOU PROBABLY HAVE TO FIX GOLEM AS WELL! | 5 // IF YOU BREAK THIS TEST YOU PROBABLY HAVE TO FIX GOLEM AS WELL! |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'dart:io' show | 10 import 'dart:io' show |
11 Directory, | 11 Directory, |
12 Platform, | 12 Platform, |
13 Process, | 13 Process, |
14 ProcessResult; | 14 ProcessResult; |
15 | 15 |
16 import 'package:expect/expect.dart' show | 16 import 'package:expect/expect.dart' show |
17 Expect; | 17 Expect; |
18 | 18 |
19 import 'package:fletchc/src/guess_configuration.dart' show | 19 import 'package:dartino_compiler/src/guess_configuration.dart' show |
20 executable; | 20 executable; |
21 | 21 |
22 Future<Null> main() async { | 22 Future<Null> main() async { |
23 print('*' * 80); | 23 print('*' * 80); |
24 print('If this test fails with a load error, you probably have to update'); | 24 print('If this test fails with a load error, you probably have to update'); |
25 print(' tools/benchmarking_files'); | 25 print(' tools/benchmarking_files'); |
26 print('*' * 80); | 26 print('*' * 80); |
27 | 27 |
28 // Locate the files that are needed. | 28 // Locate the files that are needed. |
29 Uri benchmarkingFiles = executable.resolve('../../tools/benchmarking_files'); | 29 Uri benchmarkingFiles = executable.resolve('../../tools/benchmarking_files'); |
30 Directory tempDir = Directory.systemTemp.createTempSync('golem_tests'); | 30 Directory tempDir = Directory.systemTemp.createTempSync('golem_tests'); |
31 Uri tarFile = tempDir.uri.resolve('golem.tar.gz'); | 31 Uri tarFile = tempDir.uri.resolve('golem.tar.gz'); |
32 String buildDir = const String.fromEnvironment('test.dart.build-dir'); | 32 String buildDir = const String.fromEnvironment('test.dart.build-dir'); |
33 bool asanBuild = const bool.fromEnvironment('test.dart.build-asan'); | 33 bool asanBuild = const bool.fromEnvironment('test.dart.build-asan'); |
34 | 34 |
35 List<String> tarArguments = [ | 35 List<String> tarArguments = [ |
36 'hczf', | 36 'hczf', |
37 tarFile.toFilePath(), | 37 tarFile.toFilePath(), |
38 '-T', | 38 '-T', |
39 benchmarkingFiles.toFilePath(), | 39 benchmarkingFiles.toFilePath(), |
40 '$buildDir/fletch-vm', | 40 '$buildDir/dartino-vm', |
41 '$buildDir/dart', | 41 '$buildDir/dart', |
42 '$buildDir/natives.json']; | 42 '$buildDir/natives.json']; |
43 | 43 |
44 // Mac ASan builds need the clang asan runtime library in the bundle. | 44 // Mac ASan builds need the clang asan runtime library in the bundle. |
45 if (Platform.isMacOS && asanBuild) { | 45 if (Platform.isMacOS && asanBuild) { |
46 tarArguments.add('$buildDir/libclang_rt.asan_osx_dynamic.dylib'); | 46 tarArguments.add('$buildDir/libclang_rt.asan_osx_dynamic.dylib'); |
47 } | 47 } |
48 | 48 |
49 try { | 49 try { |
50 // Package up the files similar to what Golem does. | 50 // Package up the files similar to what Golem does. |
(...skipping 19 matching lines...) Expand all Loading... |
70 'tarball extraction failed:\n\n' | 70 'tarball extraction failed:\n\n' |
71 'stdout:\n${untarResult.stdout}\n' | 71 'stdout:\n${untarResult.stdout}\n' |
72 'stderr:\n${untarResult.stderr}'); | 72 'stderr:\n${untarResult.stderr}'); |
73 | 73 |
74 // Build the snapshot in the temporary directory. Use the dart | 74 // Build the snapshot in the temporary directory. Use the dart |
75 // binary in the archive to test that everything needed is in | 75 // binary in the archive to test that everything needed is in |
76 // there. | 76 // there. |
77 ProcessResult snapshotResult = Process.runSync( | 77 ProcessResult snapshotResult = Process.runSync( |
78 '$buildDir/dart', | 78 '$buildDir/dart', |
79 ['-Dsnapshot=out.snapshot', | 79 ['-Dsnapshot=out.snapshot', |
80 'tests/fletchc/run.dart', | 80 'tests/dartino_compiler/run.dart', |
81 'benchmarks/DeltaBlue.dart'], | 81 'benchmarks/DeltaBlue.dart'], |
82 workingDirectory: tempDir.path, | 82 workingDirectory: tempDir.path, |
83 runInShell: true); | 83 runInShell: true); |
84 Expect.equals(0, | 84 Expect.equals(0, |
85 snapshotResult.exitCode, | 85 snapshotResult.exitCode, |
86 'snapshot creation failed:\n\n' | 86 'snapshot creation failed:\n\n' |
87 'stdout:\n${snapshotResult.stdout}\n' | 87 'stdout:\n${snapshotResult.stdout}\n' |
88 'stderr:\n${snapshotResult.stderr}'); | 88 'stderr:\n${snapshotResult.stderr}'); |
89 | 89 |
90 // Run the snapshot in the temporary directory.Use the fletch-vm | 90 // Run the snapshot in the temporary directory.Use the dartino-vm |
91 // binary in the archive to test that everything needed is in | 91 // binary in the archive to test that everything needed is in |
92 // there. | 92 // there. |
93 ProcessResult runResult = Process.runSync( | 93 ProcessResult runResult = Process.runSync( |
94 '$buildDir/fletch-vm', | 94 '$buildDir/dartino-vm', |
95 ['out.snapshot'], | 95 ['out.snapshot'], |
96 workingDirectory: tempDir.path, | 96 workingDirectory: tempDir.path, |
97 runInShell: true); | 97 runInShell: true); |
98 Expect.equals(0, | 98 Expect.equals(0, |
99 runResult.exitCode, | 99 runResult.exitCode, |
100 'benchmark run failed:\n\n' | 100 'benchmark run failed:\n\n' |
101 'stdout:\n${runResult.stdout}\n' | 101 'stdout:\n${runResult.stdout}\n' |
102 'stderr:\n${runResult.stderr}'); | 102 'stderr:\n${runResult.stderr}'); |
103 Expect.isTrue(runResult.stdout.contains('DeltaBlue(RunTime):')); | 103 Expect.isTrue(runResult.stdout.contains('DeltaBlue(RunTime):')); |
104 } finally { | 104 } finally { |
105 tempDir.deleteSync(recursive: true); | 105 tempDir.deleteSync(recursive: true); |
106 } | 106 } |
107 } | 107 } |
OLD | NEW |