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

Side by Side Diff: tests/compiler/dart2js/dart2js_batch_test.dart

Issue 2243073002: Fix batch test as well. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix batch test Created 4 years, 4 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 | « no previous file | tests/compiler/dart2js/launch_helper.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 import 'package:async_helper/async_helper.dart'; 10 import 'package:async_helper/async_helper.dart';
11 import 'package:expect/expect.dart'; 11 import 'package:expect/expect.dart';
12 12
13 import 'launch_helper.dart' show dart2JsCommand;
14
13 var tmpDir; 15 var tmpDir;
14 16
15 copyDirectory(Directory sourceDir, Directory destinationDir) { 17 copyDirectory(Directory sourceDir, Directory destinationDir) {
16 sourceDir.listSync().forEach((FileSystemEntity element) { 18 sourceDir.listSync().forEach((FileSystemEntity element) {
17 String newPath = path.join(destinationDir.path, 19 String newPath = path.join(destinationDir.path,
18 path.basename(element.path)); 20 path.basename(element.path));
19 if (element is File) { 21 if (element is File) {
20 element.copySync(newPath); 22 element.copySync(newPath);
21 } else if (element is Directory) { 23 } else if (element is Directory) {
22 Directory newDestinationDir = new Directory(newPath); 24 Directory newDestinationDir = new Directory(newPath);
(...skipping 21 matching lines...) Expand all
44 copyDirectory(sunflowerDir, tmpDir); 46 copyDirectory(sunflowerDir, tmpDir);
45 }); 47 });
46 } 48 }
47 49
48 void cleanUp() { 50 void cleanUp() {
49 print("Deleting '${tmpDir.path}'."); 51 print("Deleting '${tmpDir.path}'.");
50 tmpDir.deleteSync(recursive: true); 52 tmpDir.deleteSync(recursive: true);
51 } 53 }
52 54
53 Future launchDart2Js(_) { 55 Future launchDart2Js(_) {
54 String ext = Platform.isWindows ? '.bat' : ''; 56 return Process.start(
55 String command = 57 // Use an absolute path because we are changing the cwd below.
56 path.normalize(path.join(path.fromUri(Platform.script), 58 path.fromUri(Uri.base.resolve(Platform.executable)),
57 '../../../../sdk/bin/dart2js${ext}')); 59 dart2JsCommand(['--batch']),
58 print("Running '$command --batch' from '${tmpDir}'."); 60 workingDirectory: tmpDir.path);
59 return Process.start(command, ['--batch'], workingDirectory: tmpDir.path);
60 } 61 }
61 62
62 Future runTests(Process process) { 63 Future runTests(Process process) {
63 String inFile = path.join(tmpDir.path, 'web/sunflower.dart'); 64 String inFile = path.join(tmpDir.path, 'web/sunflower.dart');
64 String outFile = path.join(tmpDir.path, 'out.js'); 65 String outFile = path.join(tmpDir.path, 'out.js');
65 String outFile2 = path.join(tmpDir.path, 'out2.js'); 66 String outFile2 = path.join(tmpDir.path, 'out2.js');
66 67
67 process.stdin.writeln('--out="$outFile" "$inFile"'); 68 process.stdin.writeln('--out="$outFile" "$inFile"');
68 process.stdin.writeln('--out="$outFile2" "$inFile"'); 69 process.stdin.writeln('--out="$outFile2" "$inFile"');
69 process.stdin.writeln('too many arguments'); 70 process.stdin.writeln('too many arguments');
(...skipping 17 matching lines...) Expand all
87 88
88 void main() { 89 void main() {
89 var tmpDir; 90 var tmpDir;
90 asyncTest(() { 91 asyncTest(() {
91 return setup() 92 return setup()
92 .then(launchDart2Js) 93 .then(launchDart2Js)
93 .then(runTests) 94 .then(runTests)
94 .whenComplete(cleanUp); 95 .whenComplete(cleanUp);
95 }); 96 });
96 } 97 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/launch_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698