From: sof Date: Sat, 8 Aug 1998 13:43:35 +0000 (+0000) Subject: [project @ 1998-08-08 13:43:18 by sof] X-Git-Tag: Approx_2487_patches~472 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=c4030f9086b8d77bef41e9c7a9fb1be050cabd4e;p=ghc-hetmet.git [project @ 1998-08-08 13:43:18 by sof] Moved out of IO directory --- diff --git a/ghc/tests/io/should_run/net001.hs b/ghc/tests/io/should_run/net001.hs deleted file mode 100644 index 121e51d..0000000 --- a/ghc/tests/io/should_run/net001.hs +++ /dev/null @@ -1,55 +0,0 @@ -{- server - -The purpose of this test driver is to test TCP Stream sockets. -All values have been hard coded since the BSD library is not used to -query the databases for the values. In therory this code is thus not -portable but net007/Main.hs provides a portable version using the BSD -module. - -This creates a stream socket bound to port 5000 and waits for incoming -messages it then reads all available data before closing the -connection to that peer. - -No form of error checking is provided other than that already provided -by module SocketPrim. - - -TESTS: - socket - bindSocket - listen - accept - readSocket - sClose - --} - - -module Main where - -import SocketPrim - - -main = - socket AF_INET Stream 6 >>= \ s -> - bindSocket s (SockAddrInet 5000 iNADDR_ANY) >> - listen s 5 >> - - let - loop = - accept s >>= \ (s',peerAddr) -> - putStr "*** Start of Transfer ***\n" >> - let - read_all = - readSocket s' 4 >>= \ (str, nbytes) -> - if nbytes /= 0 then - putStr str >> - read_all - else - putStr "\n*** End of Transfer ***\n" >> - sClose s' - in - read_all - in - loop - diff --git a/ghc/tests/io/should_run/net001.stdout b/ghc/tests/io/should_run/net001.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net002.hs b/ghc/tests/io/should_run/net002.hs deleted file mode 100644 index 8906023..0000000 --- a/ghc/tests/io/should_run/net002.hs +++ /dev/null @@ -1,42 +0,0 @@ -{- client - -Client side to net001/Main.hs. - -Note that the machine IP numbers have been hard coded into this -program so it is unlikely that you will be able to run this test if -you are not at dcs.gla.ac.uk :-( - -The reason for this is to aviod using the BSD module at this stage of -testing. - - -TESTS: - socket - connect - writeSocket - shutdown - inet_addr --} - - -module Main where - -import SocketPrim - - -starbuck = "130.209.240.81" -- SunOS 4.1.3 1 sun4c -marcus = "130.209.247.2" -- SunOS 4.1.3 6 sun4m -avon = "130.209.247.4" -- OSF1 V2.0 240 alpha -karkar = "130.209.247.3" -- OSF1 V2.0 240 alpha - -message = "Hello World" - - -main = - socket AF_INET Stream 6 >>= \ s -> - connect s (SockAddrInet 5000 (inet_addr avon)) >> - - writeSocket s message >> - shutdown s ShutdownBoth >> - sClose s - diff --git a/ghc/tests/io/should_run/net002.stdout b/ghc/tests/io/should_run/net002.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net003.hs b/ghc/tests/io/should_run/net003.hs deleted file mode 100644 index 85c00e4..0000000 --- a/ghc/tests/io/should_run/net003.hs +++ /dev/null @@ -1,43 +0,0 @@ -{- server - -As for net001 but gets the system to allocate the next free port -number. It also prints out the IP number of the peer. - -TESTS: - getSocketName - inet_ntoa - --} - -module Main where - -import SocketPrim - - -main = - socket AF_INET Stream 6 >>= \ s -> - bindSocket s (SockAddrInet aNY_PORT iNADDR_ANY) >> - getSocketName s >>= \ (SockAddrInet port _) -> - putStr ("Allocated Port Number: " ++ show port ++ "\n") >> - listen s 5 >> - - - let - loop = - accept s >>= \ (s',(SockAddrInet _ haddr)) -> - putStr ("*** Start of Transfer from: " ++ - (inet_ntoa haddr) ++ "***\n") >> - let - read_all = - readSocket s' 4 >>= \ (str, nbytes) -> - if nbytes /= 0 then - putStr str >> - read_all - else - putStr "\n*** End of Transfer ***\n" >> - sClose s' - in - read_all - in - loop - diff --git a/ghc/tests/io/should_run/net003.stdout b/ghc/tests/io/should_run/net003.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net004.hs b/ghc/tests/io/should_run/net004.hs deleted file mode 100644 index c504326..0000000 --- a/ghc/tests/io/should_run/net004.hs +++ /dev/null @@ -1,33 +0,0 @@ -{- client - -As for net002 but reads port number and message as arguments. -It also prints out the IP number of the peer machine. - - - -TESTS: - getPeerName --} - - -module Main(main) where - -import SocketPrim -import System - - -starbuck = "130.209.240.81" -marcus = "130.209.247.2" - - -main = - getArgs >>= \ [port, message] -> - socket AF_INET Stream 6 >>= \ s -> - connect s (SockAddrInet (read port) (inet_addr starbuck)) >> - - getPeerName s >>= \ (SockAddrInet p haddr) -> - putStr ("Connected to : " ++ (inet_ntoa haddr) ++ "\n") >> - writeSocket s message >> - shutdown s ShutdownBoth >> - sClose s - diff --git a/ghc/tests/io/should_run/net004.stdout b/ghc/tests/io/should_run/net004.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net005.hs b/ghc/tests/io/should_run/net005.hs deleted file mode 100644 index ec504aa..0000000 --- a/ghc/tests/io/should_run/net005.hs +++ /dev/null @@ -1,37 +0,0 @@ -{- server - -Server as net001 but for Unix Domain Datagram sockets. - -TESTS: - socket - bindSocket - readSocket - --} - - -module Main where - -import SocketPrim - - -main = - socket AF_UNIX Datagram 0 >>= \ s -> - bindSocket s (SockAddrUnix "sock") >> - - let - loop = - putStr "*** Start of Transfer ***\n" >> - let - read_all = - readSocket s 1024 >>= \ (str, nbytes) -> - if nbytes /= 0 then - putStr str >> - read_all - else - putStr "\n*** End of Transfer ***\n" - in - read_all - in - loop - diff --git a/ghc/tests/io/should_run/net005.stdout b/ghc/tests/io/should_run/net005.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net006.hs b/ghc/tests/io/should_run/net006.hs deleted file mode 100644 index e2ad13a..0000000 --- a/ghc/tests/io/should_run/net006.hs +++ /dev/null @@ -1,27 +0,0 @@ -{- client - -Client side of net005 - -TESTS: - socket - connect - writeSocket - shutdown - sClose --} - - -module Main where - -import SocketPrim - -message = "Hello World" - - -main = - socket AF_UNIX Datagram 0 >>= \ s -> - connect s (SockAddrUnix "sock") >> - - writeSocket s message >> - shutdown s ShutdownBoth >> - sClose s diff --git a/ghc/tests/io/should_run/net006.stdout b/ghc/tests/io/should_run/net006.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net007.hs b/ghc/tests/io/should_run/net007.hs deleted file mode 100644 index fbc9ff0..0000000 --- a/ghc/tests/io/should_run/net007.hs +++ /dev/null @@ -1,44 +0,0 @@ -{- server - -As net003 but uses the BSD module for portability. Also prints the -common name of the host rather than its IP number. - -TESTS: - getProtocolNumber - getSocketName - getHostByAddr - --} - -module Main where - -import BSD -import SocketPrim - -main = - getProtocolNumber "tcp" >>= \ proto -> - socket AF_INET Stream proto >>= \ s -> - bindSocket s (SockAddrInet aNY_PORT iNADDR_ANY) >> - getSocketName s >>= \ (SockAddrInet port _) -> - putStr ("Allocated Port Number: " ++ show port ++ "\n") >> - listen s 5 >> - - - let - loop = - accept s >>= \ (s',(SockAddrInet _ haddr)) -> - getHostByAddr AF_INET haddr >>= \ (HostEntry hname _ _ _) -> - putStr ("*** Start of Transfer from: " ++ hname ++ "***\n") >> - let - read_all = - readSocket s' 4 >>= \ (str, nbytes) -> - if nbytes /= 0 then - putStr str >> - read_all - else - putStr "\n*** End of Transfer ***\n" >> - sClose s' - in - read_all - in - loop diff --git a/ghc/tests/io/should_run/net007.stdout b/ghc/tests/io/should_run/net007.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net008.hs b/ghc/tests/io/should_run/net008.hs deleted file mode 100644 index 2cf1774..0000000 --- a/ghc/tests/io/should_run/net008.hs +++ /dev/null @@ -1,21 +0,0 @@ -module Main where - -import SocketPrim -import BSD -import System - -main = - getArgs >>= \ [host, port, message] -> - getProtocolNumber "tcp" >>= \ proto -> - socket AF_INET Stream proto >>= \ s -> - getHostByName host >>= \ (HostEntry _ _ _ haddrs) -> - connect s (SockAddrInet (read port) - (head haddrs)) >> - - getPeerName s >>= \ (SockAddrInet _ haddr) -> - getHostByAddr AF_INET haddr >>= \ (HostEntry hname _ _ _) -> - putStr ("Connected to : " ++ hname ++ "\n") >> - writeSocket s message >> - shutdown s ShutdownBoth >> - sClose s - diff --git a/ghc/tests/io/should_run/net008.stdout b/ghc/tests/io/should_run/net008.stdout deleted file mode 100644 index e69de29..0000000 diff --git a/ghc/tests/io/should_run/net009.hs b/ghc/tests/io/should_run/net009.hs deleted file mode 100644 index c34334e..0000000 --- a/ghc/tests/io/should_run/net009.hs +++ /dev/null @@ -1,28 +0,0 @@ --- Sigbjorn and I don't understand what this test is meant to do --- It simply hangs on stdin! - -import IO -- 1.3 - -import System(getArgs) - -main = getArgs >>= \ [user,host] -> - let username = (user ++ "@" ++ host) in - openFile username ReadWriteMode >>= \ cd -> - hSetBuffering stdin NoBuffering >> - hSetBuffering stdout NoBuffering >> - hSetBuffering cd NoBuffering >> - hPutStr cd speakString >> - speak cd - -speakString = "Someone wants to speak with you\n" - -speak cd = - (hReady cd >>= \ ready -> - if ready then (hGetChar cd >>= putChar) - else return () >> - - hReady stdin >>= \ ready -> - if ready then (getChar >>= hPutChar cd) - else return ()) >> - - speak cd diff --git a/ghc/tests/io/should_run/net009.stdout b/ghc/tests/io/should_run/net009.stdout deleted file mode 100644 index e69de29..0000000