| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 // IF YOU BREAK THIS TEST YOU PROBABLY HAVE TO FIX GOLEM AS WELL! | |
| 6 | |
| 7 import 'dart:async' show | |
| 8 Future; | |
| 9 | |
| 10 import 'dart:io' show | |
| 11 Directory, | |
| 12 Platform, | |
| 13 Process, | |
| 14 ProcessResult; | |
| 15 | |
| 16 import 'package:expect/expect.dart' show | |
| 17 Expect; | |
| 18 | |
| 19 import 'package:fletchc/src/guess_configuration.dart' show | |
| 20 executable; | |
| 21 | |
| 22 Future<Null> main() async { | |
| 23 // Locate the files that are needed. | |
| 24 Uri benchmarkingFiles = executable.resolve('../../tools/benchmarking_files'); | |
| 25 Directory tempDir = Directory.systemTemp.createTempSync('golem_tests'); | |
| 26 Uri tarFile = tempDir.uri.resolve('golem.tar.gz'); | |
| 27 String buildDir = const String.fromEnvironment('test.dart.build-dir'); | |
| 28 | |
| 29 try { | |
| 30 // Package up the files similar to what Golem does. | |
| 31 ProcessResult tarResult = Process.runSync( | |
| 32 'tar', | |
| 33 ['hczf', | |
| 34 tarFile.toFilePath(), | |
| 35 '-T', | |
| 36 benchmarkingFiles.toFilePath(), | |
| 37 '$buildDir/fletch-vm', | |
| 38 '$buildDir/dart', | |
| 39 '$buildDir/natives.json', | |
| 40 '--exclude', | |
| 41 '.svn'], | |
| 42 workingDirectory: executable.resolve('../..').toFilePath(), | |
| 43 runInShell: true); | |
| 44 Expect.equals(0, tarResult.exitCode, 'tarball creation failed'); | |
| 45 | |
| 46 // Unpack the bundle in the temporary directory. | |
| 47 ProcessResult untarResult = Process.runSync( | |
| 48 'tar', | |
| 49 ['xvzf', 'golem.tar.gz'], | |
| 50 workingDirectory: tempDir.path, | |
| 51 runInShell: true); | |
| 52 Expect.equals(0, untarResult.exitCode, 'tarball extraction failed'); | |
| 53 | |
| 54 // Build the snapshot in the temporary directory. Use the dart | |
| 55 // binary in the archive to test that everything needed is in | |
| 56 // there. | |
| 57 ProcessResult snapshotResult = Process.runSync( | |
| 58 '$buildDir/dart', | |
| 59 ['-Dsnapshot=out.snapshot', | |
| 60 'tests/fletchc/run.dart', | |
| 61 'benchmarks/DeltaBlue.dart'], | |
| 62 workingDirectory: tempDir.path, | |
| 63 runInShell: true); | |
| 64 Expect.equals(0, snapshotResult.exitCode); | |
| 65 | |
| 66 // Run the snapshot in the temporary directory.Use the fletch-vm | |
| 67 // binary in the archive to test that everything needed is in | |
| 68 // there. | |
| 69 ProcessResult runResult = Process.runSync( | |
| 70 '$buildDir/fletch-vm', | |
| 71 ['out.snapshot'], | |
| 72 workingDirectory: tempDir.path, | |
| 73 runInShell: true); | |
| 74 Expect.equals(0, snapshotResult.exitCode); | |
| 75 Expect.isTrue(runResult.stdout.contains('DeltaBlue(RunTime):')); | |
| 76 } finally { | |
| 77 tempDir.deleteSync(recursive: true); | |
| 78 } | |
| 79 } | |
| OLD | NEW |