OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'package:path/path.dart'; | 6 import 'package:path/path.dart'; |
7 import "dart:io"; | 7 import "dart:io"; |
8 | 8 |
9 test(int blockCount, | 9 test(int blockCount, |
10 int stdoutBlockSize, | 10 int stdoutBlockSize, |
11 int stderrBlockSize, | 11 int stderrBlockSize, |
12 int exitCode, | 12 int exitCode, |
13 [int nonWindowsExitCode]) { | 13 [int nonWindowsExitCode]) { |
14 // Get the Dart script file that generates output. | 14 // Get the Dart script file that generates output. |
15 var scriptFile = new File(join(dirname(Platform.script), | 15 var scriptFile = new File(Platform.script |
16 "process_sync_script.dart")); | 16 .resolve("process_sync_script.dart") |
| 17 .toFilePath()); |
17 var args = [scriptFile.path, | 18 var args = [scriptFile.path, |
18 blockCount.toString(), | 19 blockCount.toString(), |
19 stdoutBlockSize.toString(), | 20 stdoutBlockSize.toString(), |
20 stderrBlockSize.toString(), | 21 stderrBlockSize.toString(), |
21 exitCode.toString()]; | 22 exitCode.toString()]; |
22 ProcessResult syncResult = Process.runSync(Platform.executable, args); | 23 ProcessResult syncResult = Process.runSync(Platform.executable, args); |
23 Expect.equals(blockCount * stdoutBlockSize, syncResult.stdout.length); | 24 Expect.equals(blockCount * stdoutBlockSize, syncResult.stdout.length); |
24 Expect.equals(blockCount * stderrBlockSize, syncResult.stderr.length); | 25 Expect.equals(blockCount * stderrBlockSize, syncResult.stderr.length); |
25 if (Platform.isWindows) { | 26 if (Platform.isWindows) { |
26 Expect.equals(exitCode, syncResult.exitCode); | 27 Expect.equals(exitCode, syncResult.exitCode); |
(...skipping 25 matching lines...) Expand all Loading... |
52 test(1, kBufferSize, kBufferSize, 0); | 53 test(1, kBufferSize, kBufferSize, 0); |
53 test(1, kBufferSize - 1, kBufferSize - 1, 0); | 54 test(1, kBufferSize - 1, kBufferSize - 1, 0); |
54 test(1, kBufferSize + 1, kBufferSize + 1, 0); | 55 test(1, kBufferSize + 1, kBufferSize + 1, 0); |
55 | 56 |
56 test(10, 10, 10, 1); | 57 test(10, 10, 10, 1); |
57 test(10, 10, 10, 255); | 58 test(10, 10, 10, 255); |
58 test(10, 10, 10, -1, 255); | 59 test(10, 10, 10, -1, 255); |
59 test(10, 10, 10, -255, 1); | 60 test(10, 10, 10, -255, 1); |
60 } | 61 } |
61 | 62 |
OLD | NEW |