From 76ef8258a4e68f8829d91e8cd4fa31571eefa86b Mon Sep 17 00:00:00 2001 From: "ngeoffray@google.com" Date: Thu, 13 Oct 2011 12:44:29 +0000 Subject: [PATCH] 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 --- tests/corelib/corelib.status | 3 +- .../corelib/src/BigIntegerVMTest.dart | 0 .../src/GrowableObjectArray2VMTest.dart | 0 .../src/GrowableObjectArrayVMTest.dart | 0 .../corelib/src/StringBaseVMTest.dart | 0 .../standalone}/src/DirectoryTest.dart | 0 .../src/EchoServerStreamReadUntilTest.dart | 15 +--- .../standalone}/src/EchoServerStreamTest.dart | 6 -- .../standalone}/src/EchoServerTest.dart | 88 ++++++++++--------- .../standalone}/src/FileInputStreamTest.dart | 4 +- .../standalone}/src/FileTest.dart | 0 .../standalone}/src/ManyEchoServerTest.dart | 2 +- .../standalone}/src/MediumIntegerTest.dart | 0 .../standalone}/src/MultipleTimerTest.dart | 0 .../src/ProcessExitNegativeTest.dart | 0 .../standalone}/src/ProcessExitTest.dart | 0 .../standalone}/src/ProcessSegfaultTest.dart | 0 .../src/ProcessStartExceptionTest.dart | 0 .../standalone}/src/ProcessStderrTest.dart | 7 +- .../standalone}/src/ProcessStdoutTest.dart | 7 +- .../standalone}/src/SocketCloseTest.dart | 0 .../standalone}/src/SocketExceptionTest.dart | 0 .../src/SocketManyConnectionsTest.dart | 0 .../standalone}/src/TimerCancelTest.dart | 0 .../standalone}/src/TimerRepeatTest.dart | 0 .../standalone}/src/TimerTest.dart | 0 .../standalone}/src/readuntil_test.dat | 0 .../standalone/standalone.status | 2 +- .../dart => tests/standalone}/testcfg.py | 0 tools/test.py | 2 +- 30 files changed, 60 insertions(+), 76 deletions(-) rename runtime/tests/dart/src/BigIntegerTest.dart => tests/corelib/src/BigIntegerVMTest.dart (100%) rename runtime/tests/dart/src/GrowableObjectArray2Test.dart => tests/corelib/src/GrowableObjectArray2VMTest.dart (100%) rename runtime/tests/dart/src/GrowableObjectArrayTest.dart => tests/corelib/src/GrowableObjectArrayVMTest.dart (100%) rename runtime/tests/dart/src/StringBaseTest.dart => tests/corelib/src/StringBaseVMTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/DirectoryTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/EchoServerStreamReadUntilTest.dart (93%) rename {runtime/tests/dart => tests/standalone}/src/EchoServerStreamTest.dart (96%) rename {runtime/tests/dart => tests/standalone}/src/EchoServerTest.dart (73%) rename {runtime/tests/dart => tests/standalone}/src/FileInputStreamTest.dart (90%) rename {runtime/tests/dart => tests/standalone}/src/FileTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/ManyEchoServerTest.dart (75%) rename {runtime/tests/dart => tests/standalone}/src/MediumIntegerTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/MultipleTimerTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/ProcessExitNegativeTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/ProcessExitTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/ProcessSegfaultTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/ProcessStartExceptionTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/ProcessStderrTest.dart (90%) rename {runtime/tests/dart => tests/standalone}/src/ProcessStdoutTest.dart (91%) rename {runtime/tests/dart => tests/standalone}/src/SocketCloseTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/SocketExceptionTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/SocketManyConnectionsTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/TimerCancelTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/TimerRepeatTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/TimerTest.dart (100%) rename {runtime/tests/dart => tests/standalone}/src/readuntil_test.dat (100%) rename runtime/tests/dart/dart.status => tests/standalone/standalone.status (98%) rename {runtime/tests/dart => tests/standalone}/testcfg.py (100%) diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status index 91081671156..d2aaa1b3d53 100644 --- a/tests/corelib/corelib.status +++ b/tests/corelib/corelib.status @@ -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 ] diff --git a/runtime/tests/dart/src/BigIntegerTest.dart b/tests/corelib/src/BigIntegerVMTest.dart similarity index 100% rename from runtime/tests/dart/src/BigIntegerTest.dart rename to tests/corelib/src/BigIntegerVMTest.dart diff --git a/runtime/tests/dart/src/GrowableObjectArray2Test.dart b/tests/corelib/src/GrowableObjectArray2VMTest.dart similarity index 100% rename from runtime/tests/dart/src/GrowableObjectArray2Test.dart rename to tests/corelib/src/GrowableObjectArray2VMTest.dart diff --git a/runtime/tests/dart/src/GrowableObjectArrayTest.dart b/tests/corelib/src/GrowableObjectArrayVMTest.dart similarity index 100% rename from runtime/tests/dart/src/GrowableObjectArrayTest.dart rename to tests/corelib/src/GrowableObjectArrayVMTest.dart diff --git a/runtime/tests/dart/src/StringBaseTest.dart b/tests/corelib/src/StringBaseVMTest.dart similarity index 100% rename from runtime/tests/dart/src/StringBaseTest.dart rename to tests/corelib/src/StringBaseVMTest.dart diff --git a/runtime/tests/dart/src/DirectoryTest.dart b/tests/standalone/src/DirectoryTest.dart similarity index 100% rename from runtime/tests/dart/src/DirectoryTest.dart rename to tests/standalone/src/DirectoryTest.dart diff --git a/runtime/tests/dart/src/EchoServerStreamReadUntilTest.dart b/tests/standalone/src/EchoServerStreamReadUntilTest.dart similarity index 93% rename from runtime/tests/dart/src/EchoServerStreamReadUntilTest.dart rename to tests/standalone/src/EchoServerStreamReadUntilTest.dart index cca1ed53ea9..e8df2282668 100644 --- a/runtime/tests/dart/src/EchoServerStreamReadUntilTest.dart +++ b/tests/standalone/src/EchoServerStreamReadUntilTest.dart @@ -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); } } diff --git a/runtime/tests/dart/src/EchoServerStreamTest.dart b/tests/standalone/src/EchoServerStreamTest.dart similarity index 96% rename from runtime/tests/dart/src/EchoServerStreamTest.dart rename to tests/standalone/src/EchoServerStreamTest.dart index 51f11ee0741..a0b6355f98e 100644 --- a/runtime/tests/dart/src/EchoServerStreamTest.dart +++ b/tests/standalone/src/EchoServerStreamTest.dart @@ -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 { diff --git a/runtime/tests/dart/src/EchoServerTest.dart b/tests/standalone/src/EchoServerTest.dart similarity index 73% rename from runtime/tests/dart/src/EchoServerTest.dart rename to tests/standalone/src/EchoServerTest.dart index eeae75ef7bb..6e79eb58cea 100644 --- a/runtime/tests/dart/src/EchoServerTest.dart +++ b/tests/standalone/src/EchoServerTest.dart @@ -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 _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(); } } diff --git a/runtime/tests/dart/src/FileInputStreamTest.dart b/tests/standalone/src/FileInputStreamTest.dart similarity index 90% rename from runtime/tests/dart/src/FileInputStreamTest.dart rename to tests/standalone/src/FileInputStreamTest.dart index a710fcf168a..240b24803a5 100644 --- a/runtime/tests/dart/src/FileInputStreamTest.dart +++ b/tests/standalone/src/FileInputStreamTest.dart @@ -13,10 +13,10 @@ callback(List 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); diff --git a/runtime/tests/dart/src/FileTest.dart b/tests/standalone/src/FileTest.dart similarity index 100% rename from runtime/tests/dart/src/FileTest.dart rename to tests/standalone/src/FileTest.dart diff --git a/runtime/tests/dart/src/ManyEchoServerTest.dart b/tests/standalone/src/ManyEchoServerTest.dart similarity index 75% rename from runtime/tests/dart/src/ManyEchoServerTest.dart rename to tests/standalone/src/ManyEchoServerTest.dart index bac5ded4d31..1b152e97e5d 100644 --- a/runtime/tests/dart/src/ManyEchoServerTest.dart +++ b/tests/standalone/src/ManyEchoServerTest.dart @@ -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() { diff --git a/runtime/tests/dart/src/MediumIntegerTest.dart b/tests/standalone/src/MediumIntegerTest.dart similarity index 100% rename from runtime/tests/dart/src/MediumIntegerTest.dart rename to tests/standalone/src/MediumIntegerTest.dart diff --git a/runtime/tests/dart/src/MultipleTimerTest.dart b/tests/standalone/src/MultipleTimerTest.dart similarity index 100% rename from runtime/tests/dart/src/MultipleTimerTest.dart rename to tests/standalone/src/MultipleTimerTest.dart diff --git a/runtime/tests/dart/src/ProcessExitNegativeTest.dart b/tests/standalone/src/ProcessExitNegativeTest.dart similarity index 100% rename from runtime/tests/dart/src/ProcessExitNegativeTest.dart rename to tests/standalone/src/ProcessExitNegativeTest.dart diff --git a/runtime/tests/dart/src/ProcessExitTest.dart b/tests/standalone/src/ProcessExitTest.dart similarity index 100% rename from runtime/tests/dart/src/ProcessExitTest.dart rename to tests/standalone/src/ProcessExitTest.dart diff --git a/runtime/tests/dart/src/ProcessSegfaultTest.dart b/tests/standalone/src/ProcessSegfaultTest.dart similarity index 100% rename from runtime/tests/dart/src/ProcessSegfaultTest.dart rename to tests/standalone/src/ProcessSegfaultTest.dart diff --git a/runtime/tests/dart/src/ProcessStartExceptionTest.dart b/tests/standalone/src/ProcessStartExceptionTest.dart similarity index 100% rename from runtime/tests/dart/src/ProcessStartExceptionTest.dart rename to tests/standalone/src/ProcessStartExceptionTest.dart diff --git a/runtime/tests/dart/src/ProcessStderrTest.dart b/tests/standalone/src/ProcessStderrTest.dart similarity index 90% rename from runtime/tests/dart/src/ProcessStderrTest.dart rename to tests/standalone/src/ProcessStderrTest.dart index 797dc13a4e2..e92ded255b1 100644 --- a/runtime/tests/dart/src/ProcessStderrTest.dart +++ b/tests/standalone/src/ProcessStderrTest.dart @@ -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(); } diff --git a/runtime/tests/dart/src/ProcessStdoutTest.dart b/tests/standalone/src/ProcessStdoutTest.dart similarity index 91% rename from runtime/tests/dart/src/ProcessStdoutTest.dart rename to tests/standalone/src/ProcessStdoutTest.dart index 9ef5e4c83c6..027cc8635ae 100644 --- a/runtime/tests/dart/src/ProcessStdoutTest.dart +++ b/tests/standalone/src/ProcessStdoutTest.dart @@ -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 readBuffer = new List(BUFFERSIZE); void dataWritten() { + print("data written"); void readData() { + print("data read"); for (int i = 0; i < BUFFERSIZE; i++) { Expect.equals(buffer[i], readBuffer[i]); } diff --git a/runtime/tests/dart/src/SocketCloseTest.dart b/tests/standalone/src/SocketCloseTest.dart similarity index 100% rename from runtime/tests/dart/src/SocketCloseTest.dart rename to tests/standalone/src/SocketCloseTest.dart diff --git a/runtime/tests/dart/src/SocketExceptionTest.dart b/tests/standalone/src/SocketExceptionTest.dart similarity index 100% rename from runtime/tests/dart/src/SocketExceptionTest.dart rename to tests/standalone/src/SocketExceptionTest.dart diff --git a/runtime/tests/dart/src/SocketManyConnectionsTest.dart b/tests/standalone/src/SocketManyConnectionsTest.dart similarity index 100% rename from runtime/tests/dart/src/SocketManyConnectionsTest.dart rename to tests/standalone/src/SocketManyConnectionsTest.dart diff --git a/runtime/tests/dart/src/TimerCancelTest.dart b/tests/standalone/src/TimerCancelTest.dart similarity index 100% rename from runtime/tests/dart/src/TimerCancelTest.dart rename to tests/standalone/src/TimerCancelTest.dart diff --git a/runtime/tests/dart/src/TimerRepeatTest.dart b/tests/standalone/src/TimerRepeatTest.dart similarity index 100% rename from runtime/tests/dart/src/TimerRepeatTest.dart rename to tests/standalone/src/TimerRepeatTest.dart diff --git a/runtime/tests/dart/src/TimerTest.dart b/tests/standalone/src/TimerTest.dart similarity index 100% rename from runtime/tests/dart/src/TimerTest.dart rename to tests/standalone/src/TimerTest.dart diff --git a/runtime/tests/dart/src/readuntil_test.dat b/tests/standalone/src/readuntil_test.dat similarity index 100% rename from runtime/tests/dart/src/readuntil_test.dat rename to tests/standalone/src/readuntil_test.dat diff --git a/runtime/tests/dart/dart.status b/tests/standalone/standalone.status similarity index 98% rename from runtime/tests/dart/dart.status rename to tests/standalone/standalone.status index 3e3efc3aebb..b813dc24650 100644 --- a/runtime/tests/dart/dart.status +++ b/tests/standalone/standalone.status @@ -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 diff --git a/runtime/tests/dart/testcfg.py b/tests/standalone/testcfg.py similarity index 100% rename from runtime/tests/dart/testcfg.py rename to tests/standalone/testcfg.py diff --git a/tools/test.py b/tools/test.py index 3d8a44408c1..e3896d3f3ea 100755 --- a/tools/test.py +++ b/tools/test.py @@ -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.