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

Side by Side Diff: runtime/tests/dart/src/ProcessStdoutTest.dart

Issue 8226016: Add the ability to run tests with several sets of VM flags (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments from ngeoffray@ Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « runtime/tests/dart/src/ProcessStderrTest.dart ('k') | tools/testing/architecture.py » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Process test program to test process communication. 5 // Process test program to test process communication.
6 //
7 // VMOptions=
8 // VMOptions=--short_socket_read
9 // VMOptions=--short_socket_write
10 // VMOptions=--short_socket_read --short_socket_write
6 11
7 class ProcessStdoutTest { 12 class ProcessStdoutTest {
8 13
9 static void testExit() { 14 static void testExit() {
10 Process process = new Process("out/Debug_ia32//process_test", 15 Process process = new Process("out/Debug_ia32//process_test",
11 const ["0", "1", "99", "0"]); 16 const ["0", "1", "99", "0"]);
12 final int BUFFERSIZE = 10; 17 final int BUFFERSIZE = 10;
13 final int STARTCHAR = 65; 18 final int STARTCHAR = 65;
14 List<int> buffer = new List<int>(BUFFERSIZE); 19 List<int> buffer = new List<int>(BUFFERSIZE);
15 for (int i = 0; (i < BUFFERSIZE - 1); i++) { 20 for (int i = 0; (i < BUFFERSIZE - 1); i++) {
16 buffer[i] = STARTCHAR + i; 21 buffer[i] = STARTCHAR + i;
17 } 22 }
18 buffer[BUFFERSIZE - 1] = 10; 23 buffer[BUFFERSIZE - 1] = 10;
19 24
20 SocketInputStream input = process.stdoutStream; 25 SocketInputStream input = process.stdoutStream;
21 SocketOutputStream output = process.stdinStream; 26 SocketOutputStream output = process.stdinStream;
22 27
23 process.start(); 28 process.start();
24 29
25 List<int> readBuffer = new List<int>(BUFFERSIZE); 30 List<int> readBuffer = new List<int>(BUFFERSIZE);
26 31
27 void dataWritten() { 32 void dataWritten() {
28 print("data written");
29 void readData() { 33 void readData() {
30 print("data read");
31 for (int i = 0; i < BUFFERSIZE; i++) { 34 for (int i = 0; i < BUFFERSIZE; i++) {
32 Expect.equals(buffer[i], readBuffer[i]); 35 Expect.equals(buffer[i], readBuffer[i]);
33 } 36 }
34 process.close(); 37 process.close();
35 } 38 }
36 39
37 bool read = input.read(readBuffer, 0, BUFFERSIZE, readData); 40 bool read = input.read(readBuffer, 0, BUFFERSIZE, readData);
38 if (read) { 41 if (read) {
39 readData(); 42 readData();
40 } 43 }
41 } 44 }
42 bool written = output.write(buffer, 0, BUFFERSIZE, dataWritten); 45 bool written = output.write(buffer, 0, BUFFERSIZE, dataWritten);
43 if (written) { 46 if (written) {
44 dataWritten(); 47 dataWritten();
45 } 48 }
46 } 49 }
47 50
48 static void testMain() { 51 static void testMain() {
49 testExit(); 52 testExit();
50 } 53 }
51 } 54 }
52 55
53 main() { 56 main() {
54 ProcessStdoutTest.testMain(); 57 ProcessStdoutTest.testMain();
55 } 58 }
OLDNEW
« no previous file with comments | « runtime/tests/dart/src/ProcessStderrTest.dart ('k') | tools/testing/architecture.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698