Create a standalone test directory and move tests in runtime/tests/dart (mostly) to that directory.

Review URL: http://codereview.chromium.org//8261009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@393 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ngeoffray@google.com
2011-10-13 12:44:29 +00:00
parent 29a8add5a3
commit 76ef8258a4
30 changed files with 60 additions and 76 deletions
+2 -1
View File
@@ -7,7 +7,7 @@ prefix corelib
[ $arch == ia32 || $arch == dartium ]
UnicodeTest: Fail # Bug 5163868
DoubleCompareTest: Fail # Bug 5427703
*DartcTest: Skip
[ $arch == ia32 ]
@@ -17,6 +17,7 @@ ConstListLiteralTest: Fail # Bug 3341367
CoreRuntimeTypesTest: Fail # Bug 5196164
StringTest: Fail # Bug 5196164
DoubleCompareTest: Fail # Bug 5427706
*VMTest: Skip
[ $arch == dartium ]
@@ -3,11 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
//
// Echo server test program to test socket stream read until functionality.
//
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
main() {
EchoServerStreamReadUntilTest.testMain();
@@ -151,16 +146,12 @@ class EchoServer extends Isolate {
for (int i = 0; i < MSGSIZE - 1; i++) {
Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]);
}
void next() {
inputStream.readUntil(PATTERN2, dataReceived);
}
bool done = outputStream.write(buffer, 0, buffer.length, next);
if (done) {
next();
}
outputStream.write(buffer, 0, buffer.length, null);
inputStream.readUntil(PATTERN2, dataReceived);
} else {
Expect.equals(1, buffer.length);
outputStream.write(buffer, 0, buffer.length, null);
inputStream.readUntil(PATTERN2, dataReceived);
}
}
@@ -3,12 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
//
// Echo server test program to test socket streams.
//
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
class EchoServerStreamTest {
@@ -3,11 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
//
// Echo server test program for testing sockets.
//
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
class EchoServerTest {
@@ -39,7 +34,6 @@ class EchoServerGame {
}
void sendData() {
Socket _socket;
void messageHandler() {
@@ -47,16 +41,24 @@ class EchoServerGame {
int bytesRead = 0;
void handleRead() {
bytesRead += _socket.readList(
bufferReceived, bytesRead, MSGSIZE - bytesRead);
if (_socket.available() > 0) {
bytesRead += _socket.readList(
bufferReceived, bytesRead, MSGSIZE - bytesRead);
}
if (bytesRead < MSGSIZE) {
// We check every time the whole buffer to verify data integrity.
/*
* We check every time the whole buffer to verify data integrity.
*/
for (int i = 0; i < bytesRead; i++) {
Expect.equals(FIRSTCHAR + i, bufferReceived[i]);
}
_socket.setDataHandler(handleRead);
} else {
// We check every time the whole buffer to verify data integrity.
}
else {
/*
* We check every time the whole buffer to verify data integrity.
*/
for (int i = 0; i < MSGSIZE; i++) {
Expect.equals(FIRSTCHAR + i, bufferReceived[i]);
}
@@ -128,6 +130,7 @@ class EchoServerGame {
int _port;
ReceivePort _receivePort;
SendPort _sendPort;
Socket _socket;
List<int> _buffer;
int _messages;
}
@@ -149,37 +152,40 @@ class EchoServer extends Isolate {
int bytesRead = 0;
void handleRead() {
int read = _client.readList(buffer, bytesRead, msgSize - bytesRead);
if (read > 0) {
bytesRead += read;
if (bytesRead < msgSize) {
// We check every time the whole buffer to verify data integrity.
for (int i = 0; i < bytesRead; i++) {
Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]);
}
_client.setDataHandler(handleRead);
} else {
// We check every time the whole buffer to verify data integrity.
for (int i = 0; i < msgSize; i++) {
Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]);
}
void writeMessage() {
int bytesWritten = 0;
void handleWrite() {
int written = _client.writeList(
buffer, bytesWritten, msgSize - bytesWritten);
bytesWritten += written;
if (bytesWritten < msgSize) {
_client.setWriteHandler(handleWrite);
}
}
handleWrite();
}
writeMessage();
if (_client.available() > 0) {
bytesRead += _client.readList(buffer, bytesRead, msgSize - bytesRead);
}
if (bytesRead < msgSize) {
/*
* We check every time the whole buffer to verify data integrity.
*/
for (int i = 0; i < bytesRead; i++) {
Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]);
}
_client.setDataHandler(handleRead);
}
else {
/*
* We check every time the whole buffer to verify data integrity.
*/
for (int i = 0; i < msgSize; i++) {
Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]);
}
void writeMessage() {
int bytesWritten = 0;
void handleWrite() {
bytesWritten += _client.writeList(
buffer, bytesWritten, msgSize - bytesWritten);
if (bytesWritten < msgSize) {
_client.setWriteHandler(handleWrite);
}
}
handleWrite();
}
writeMessage();
}
}
@@ -13,10 +13,10 @@ callback(List<int> buffer) {
// Helper method to be able to run the test from the runtime
// directory, or the top directory.
String getFilename(String path) =>
FileUtil.fileExists(path) ? path : 'runtime/' + path;
FileUtil.fileExists(path) ? path : '../' + path;
main() {
String fName = getFilename("tests/dart/src/readuntil_test.dat");
String fName = getFilename("tests/standalone/src/readuntil_test.dat");
// File contains "Hello Dart, wassup!"
File file = new File(fName, false);
FileInputStream x = new FileInputStream(file);
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Stress test isolate generation.
// DartOptions=-- runtime/tests/dart/src/EchoServerTest.dart runtime/tests/dart/src/ManyEchoServerTest.dart -- ManyEchoServerTest.testMain
// DartOptions=-- tests/standalone/src/EchoServerTest.dart tests/standalone/src/ManyEchoServerTest.dart -- ManyEchoServerTest.testMain
class ManyEchoServerTest {
static testMain() {
@@ -3,11 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
//
// Process test program to test process communication.
//
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
class ProcessStderrTest {
@@ -37,7 +32,7 @@ class ProcessStderrTest {
process.close();
}
bool read = input.read(readBuffer, 0, BUFFERSIZE, readData);
bool read = input.read(readBuffer, 0, BUFFERSIZE, readData);
if (read) {
readData();
}
@@ -3,11 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
//
// Process test program to test process communication.
//
// VMOptions=
// VMOptions=--short_socket_read
// VMOptions=--short_socket_write
// VMOptions=--short_socket_read --short_socket_write
class ProcessStdoutTest {
@@ -30,7 +25,9 @@ class ProcessStdoutTest {
List<int> readBuffer = new List<int>(BUFFERSIZE);
void dataWritten() {
print("data written");
void readData() {
print("data read");
for (int i = 0; i < BUFFERSIZE; i++) {
Expect.equals(buffer[i], readBuffer[i]);
}
@@ -2,7 +2,7 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
prefix dart
prefix standalone
[ $arch == ia32]
ManyEchoServerTest: Skip # Bug 5103754
+1 -1
View File
@@ -26,7 +26,7 @@ import utils
TIMEOUT_SECS = 60
ARCH_GUESS = utils.GuessArchitecture()
OS_GUESS = utils.GuessOS()
BUILT_IN_TESTS = ['dartc', 'vm', 'dart', 'corelib', 'language', 'co19',
BUILT_IN_TESTS = ['dartc', 'vm', 'standalone', 'corelib', 'language', 'co19',
'samples', 'isolate', 'stub-generator', 'client']
# Patterns for matching test options in .dart files.