From: simonmar Date: Tue, 1 May 2001 11:46:56 +0000 (+0000) Subject: [project @ 2001-05-01 11:46:56 by simonmar] X-Git-Tag: Approximately_9120_patches~2041 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=8af61567ad78f4903a4debd94830d4a02ed3e04b;p=ghc-hetmet.git [project @ 2001-05-01 11:46:56 by simonmar] Start a new directory for networking tests, and add a simple test which starts two threads which communicate via a socket. The socket subdirectory already contains some tests, but they're about 6 years old and don't appear to be designed to run without user intervention. --- diff --git a/ghc/tests/lib/Makefile b/ghc/tests/lib/Makefile index 080bedf..f273ff4 100644 --- a/ghc/tests/lib/Makefile +++ b/ghc/tests/lib/Makefile @@ -1,10 +1,10 @@ #----------------------------------------------------------------------------- -# $Id: Makefile,v 1.4 1998/09/20 15:33:58 simonm Exp $ +# $Id: Makefile,v 1.5 2001/05/01 11:46:56 simonmar Exp $ TOP = .. include $(TOP)/mk/boilerplate.mk -SUBDIRS = should_run +SUBDIRS = should_run net # posix009 hangs on Linux, disabled for now --SDM # posix diff --git a/ghc/tests/lib/net/Makefile b/ghc/tests/lib/net/Makefile new file mode 100644 index 0000000..455110d --- /dev/null +++ b/ghc/tests/lib/net/Makefile @@ -0,0 +1,12 @@ +# ----------------------------------------------------------------------------- +# $Id: Makefile,v 1.1 2001/05/01 11:46:56 simonmar Exp $ + +TOP = ../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/should_run.mk + +SRC_HC_OPTS += -dcore-lint -package net -fglasgow-exts + +.PRECIOUS: %.o %.bin + +include $(TOP)/mk/target.mk diff --git a/ghc/tests/lib/net/net001.hs b/ghc/tests/lib/net/net001.hs new file mode 100644 index 0000000..e5621c3 --- /dev/null +++ b/ghc/tests/lib/net/net001.hs @@ -0,0 +1,20 @@ +module Main where + +import Socket +import Concurrent +import IO + +main = do + forkIO server + yield + h <- connectTo "localhost" (PortNumber 22222) + l <- hGetLine h + hClose h + print l + where + server = do + s <- listenOn (PortNumber 22222) + (h, host, port) <- accept s + hPutStrLn h "hello" + hClose h + diff --git a/ghc/tests/lib/net/net001.stdout b/ghc/tests/lib/net/net001.stdout new file mode 100644 index 0000000..3580093 --- /dev/null +++ b/ghc/tests/lib/net/net001.stdout @@ -0,0 +1 @@ +"hello"