| 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 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 const int NUM_SERVERS = 10; | 10 const int NUM_SERVERS = 10; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 }); | 43 }); |
| 44 }); | 44 }); |
| 45 return server; | 45 return server; |
| 46 }); | 46 }); |
| 47 } | 47 } |
| 48 | 48 |
| 49 Future runClientProcess(int port) { | 49 Future runClientProcess(int port) { |
| 50 return Process.run(Platform.executable, | 50 return Process.run(Platform.executable, |
| 51 []..addAll(Platform.executableArguments) | 51 []..addAll(Platform.executableArguments) |
| 52 ..add(Platform.script.toFilePath()) | 52 ..add(Platform.script) |
| 53 ..add('--client') | 53 ..add('--client') |
| 54 ..add(port.toString())).then((ProcessResult result) { | 54 ..add(port.toString())).then((ProcessResult result) { |
| 55 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) { | 55 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) { |
| 56 print("Client failed, exit code ${result.exitCode}"); | 56 print("Client failed, exit code ${result.exitCode}"); |
| 57 print(" stdout:"); | 57 print(" stdout:"); |
| 58 print(result.stdout); | 58 print(result.stdout); |
| 59 print(" stderr:"); | 59 print(" stderr:"); |
| 60 print(result.stderr); | 60 print(result.stderr); |
| 61 Expect.fail('Client subprocess exit code: ${result.exitCode}'); | 61 Expect.fail('Client subprocess exit code: ${result.exitCode}'); |
| 62 } | 62 } |
| 63 }); | 63 }); |
| 64 } | 64 } |
| 65 | 65 |
| 66 runClient(int port) { | 66 runClient(int port) { |
| 67 RawSocket.connect(InternetAddress.LOOPBACK_IP_V4, port).then((connection) { | 67 RawSocket.connect(InternetAddress.LOOPBACK_IP_V4, port).then((connection) { |
| 68 connection.listen((_) { }, onDone: () => print('SUCCESS')); | 68 connection.listen((_) { }, onDone: () => print('SUCCESS')); |
| 69 connection.shutdown(SocketDirection.SEND); | 69 connection.shutdown(SocketDirection.SEND); |
| 70 }); | 70 }); |
| 71 } | 71 } |
| OLD | NEW |