diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-04-08 07:39:32 -0700 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-04-08 07:39:32 -0700 |
commit | 4f51bd1ccc7cb68822a59ec07946242c1394e8c4 (patch) | |
tree | 7776b8f53dcf663495ccb07cbc3ba7aa8df21362 /main/test/src | |
parent | 1f037aad85f085a2d27abfe22245dfe6c87061ee (diff) | |
download | mill-4f51bd1ccc7cb68822a59ec07946242c1394e8c4.tar.gz mill-4f51bd1ccc7cb68822a59ec07946242c1394e8c4.tar.bz2 mill-4f51bd1ccc7cb68822a59ec07946242c1394e8c4.zip |
explicitly disable clientserver tests on windows
Diffstat (limited to 'main/test/src')
-rw-r--r-- | main/test/src/mill/main/ClientServerTests.scala | 152 |
1 files changed, 77 insertions, 75 deletions
diff --git a/main/test/src/mill/main/ClientServerTests.scala b/main/test/src/mill/main/ClientServerTests.scala index d18c01b2..e0e74fc7 100644 --- a/main/test/src/mill/main/ClientServerTests.scala +++ b/main/test/src/mill/main/ClientServerTests.scala @@ -3,7 +3,7 @@ package mill.main import java.io._ import java.nio.file.Path -import mill.client.Locks +import mill.client.{ClientServer, Locks} import utest._ class EchoServer extends ServerMain[Int]{ def main0(args: Array[String], @@ -39,84 +39,86 @@ object ClientServerTests extends TestSuite{ def tests = Tests{ 'hello - { - val (tmpDir, locks) = init() - - def spawnEchoServer(): Unit = { - new Thread(() => new Server( - tmpDir.toString, - new EchoServer(), - () => (), - 1000, - locks - ).run()).start() - } - + if (!ClientServer.isWindows){ + val (tmpDir, locks) = init() - def runClient(arg: String) = { - val (in, out, err) = initStreams() - Server.lockBlock(locks.clientLock){ - mill.client.Main.run( + def spawnEchoServer(): Unit = { + new Thread(() => new Server( tmpDir.toString, - () => spawnEchoServer(), - locks, - in, - out, - err, - Array(arg) - ) - Thread.sleep(100) - (new String(out.toByteArray), new String(err.toByteArray)) + new EchoServer(), + () => (), + 1000, + locks + ).run()).start() } - } - // Make sure the simple "have the client start a server and - // exchange one message" workflow works from end to end. - - assert( - locks.clientLock.probe(), - locks.serverLock.probe(), - locks.processLock.probe() - ) - - val (out1, err1) = runClient("world") - - assert( - out1 == "helloworld\n", - err1 == "HELLOworld\n" - ) - - // Give a bit of time for the server to release the lock and - // re-acquire it to signal to the client that it's done - Thread.sleep(100) - - assert( - locks.clientLock.probe(), - !locks.serverLock.probe(), - !locks.processLock.probe() - ) - - // A seecond client in sequence connect to the same server - val (out2, err2) = runClient(" WORLD") - - assert( - out2 == "hello WORLD\n", - err2 == "HELLO WORLD\n" - ) - - // Make sure the server times out of not used for a while - Thread.sleep(2000) - assert( - locks.clientLock.probe(), - locks.serverLock.probe(), - locks.processLock.probe() - ) - - // Have a third client spawn/connect-to a new server at the same path - val (out3, err3) = runClient(" World") - assert( - out3 == "hello World\n", - err3 == "HELLO World\n" - ) + + def runClient(arg: String) = { + val (in, out, err) = initStreams() + Server.lockBlock(locks.clientLock){ + mill.client.Main.run( + tmpDir.toString, + () => spawnEchoServer(), + locks, + in, + out, + err, + Array(arg) + ) + Thread.sleep(100) + (new String(out.toByteArray), new String(err.toByteArray)) + } + } + + // Make sure the simple "have the client start a server and + // exchange one message" workflow works from end to end. + + assert( + locks.clientLock.probe(), + locks.serverLock.probe(), + locks.processLock.probe() + ) + + val (out1, err1) = runClient("world") + + assert( + out1 == "helloworld\n", + err1 == "HELLOworld\n" + ) + + // Give a bit of time for the server to release the lock and + // re-acquire it to signal to the client that it's done + Thread.sleep(100) + + assert( + locks.clientLock.probe(), + !locks.serverLock.probe(), + !locks.processLock.probe() + ) + + // A seecond client in sequence connect to the same server + val (out2, err2) = runClient(" WORLD") + + assert( + out2 == "hello WORLD\n", + err2 == "HELLO WORLD\n" + ) + + // Make sure the server times out of not used for a while + Thread.sleep(2000) + assert( + locks.clientLock.probe(), + locks.serverLock.probe(), + locks.processLock.probe() + ) + + // Have a third client spawn/connect-to a new server at the same path + val (out3, err3) = runClient(" World") + assert( + out3 == "hello World\n", + err3 == "HELLO World\n" + ) + } } } } |