summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/libposix
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/lib/libposix
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/lib/libposix')
-rw-r--r--testsuite/tests/lib/libposix/Makefile3
-rw-r--r--testsuite/tests/lib/libposix/posix001.hs24
-rw-r--r--testsuite/tests/lib/libposix/posix001.stdout4
-rw-r--r--testsuite/tests/lib/libposix/posix002.hs4
-rw-r--r--testsuite/tests/lib/libposix/posix002.stdout2
-rw-r--r--testsuite/tests/lib/libposix/posix003.hs6
-rw-r--r--testsuite/tests/lib/libposix/posix003.stdout0
-rw-r--r--testsuite/tests/lib/libposix/posix004.hs58
-rw-r--r--testsuite/tests/lib/libposix/posix004.stdout1
-rw-r--r--testsuite/tests/lib/libposix/posix005.hs25
-rw-r--r--testsuite/tests/lib/libposix/posix005.stdout7
-rw-r--r--testsuite/tests/lib/libposix/posix006.hs14
-rw-r--r--testsuite/tests/lib/libposix/posix006.stdout6
-rw-r--r--testsuite/tests/lib/libposix/posix007.hs34
-rw-r--r--testsuite/tests/lib/libposix/posix007.stdout2
-rw-r--r--testsuite/tests/lib/libposix/posix008.hs12
-rw-r--r--testsuite/tests/lib/libposix/posix008.stdout3
-rw-r--r--testsuite/tests/lib/libposix/posix009.hs15
-rw-r--r--testsuite/tests/lib/libposix/posix009.stdout0
-rw-r--r--testsuite/tests/lib/libposix/posix010.hs24
-rw-r--r--testsuite/tests/lib/libposix/posix010.stdout4
-rw-r--r--testsuite/tests/lib/libposix/posix011.hs22
-rw-r--r--testsuite/tests/lib/libposix/posix011.stdout4
-rw-r--r--testsuite/tests/lib/libposix/posix012.hs59
-rw-r--r--testsuite/tests/lib/libposix/posix012.stdout0
-rw-r--r--testsuite/tests/lib/libposix/posix013.hs21
-rw-r--r--testsuite/tests/lib/libposix/posix014.hs19
27 files changed, 373 insertions, 0 deletions
diff --git a/testsuite/tests/lib/libposix/Makefile b/testsuite/tests/lib/libposix/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/lib/libposix/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/lib/libposix/posix001.hs b/testsuite/tests/lib/libposix/posix001.hs
new file mode 100644
index 0000000000..ed20df7939
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix001.hs
@@ -0,0 +1,24 @@
+module Main(main) where
+
+import Posix
+
+main :: IO ()
+main = do
+ ppid <- getParentProcessID
+ pid <- getProcessID
+ putStr "Parent Process ID: "
+ print ppid
+ putStr "Process ID: "
+ print pid
+ putStr "forking ps ux"
+ print ppid
+ child <- forkProcess
+ case child of
+ Nothing -> executeFile "ps" True ["ux" ++ show ppid] Nothing
+ Just x -> doParent x pid
+
+doParent cpid pid = do
+ getProcessStatus True False cpid
+ putStr "\nChild finished. Now exec'ing ps ux\n"
+ print pid
+ executeFile "ps" True ["ux" ++ show pid] Nothing
diff --git a/testsuite/tests/lib/libposix/posix001.stdout b/testsuite/tests/lib/libposix/posix001.stdout
new file mode 100644
index 0000000000..c9cd245bbe
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix001.stdout
@@ -0,0 +1,4 @@
+USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
+sof 30160 0.0 0.2 1244 648 p0 S 15:09 0:00 /bin/sh -c ./posix001
+USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
+sof 30161 0.0 0.1 892 336 p0 R 15:09 0:00 ps ux30161
diff --git a/testsuite/tests/lib/libposix/posix002.hs b/testsuite/tests/lib/libposix/posix002.hs
new file mode 100644
index 0000000000..8d01e8b69f
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix002.hs
@@ -0,0 +1,4 @@
+import Posix
+
+main =
+ executeFile "printenv" True [] (Just [("ONE","1"),("TWO","2")])
diff --git a/testsuite/tests/lib/libposix/posix002.stdout b/testsuite/tests/lib/libposix/posix002.stdout
new file mode 100644
index 0000000000..5e17a60f42
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix002.stdout
@@ -0,0 +1,2 @@
+ONE=1
+TWO=2
diff --git a/testsuite/tests/lib/libposix/posix003.hs b/testsuite/tests/lib/libposix/posix003.hs
new file mode 100644
index 0000000000..dbea5e1d9b
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix003.hs
@@ -0,0 +1,6 @@
+import IO
+import Posix
+
+main =
+ openFile "po003.out" WriteMode >>= \ h ->
+ runProcess "pwd" [] Nothing (Just "/usr/tmp") Nothing (Just h) Nothing
diff --git a/testsuite/tests/lib/libposix/posix003.stdout b/testsuite/tests/lib/libposix/posix003.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix003.stdout
diff --git a/testsuite/tests/lib/libposix/posix004.hs b/testsuite/tests/lib/libposix/posix004.hs
new file mode 100644
index 0000000000..2423f3f77a
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix004.hs
@@ -0,0 +1,58 @@
+import Posix
+import System(ExitCode(..), exitWith)
+
+main =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> raiseSignal floatingPointException
+ _ -> doParent
+
+doParent =
+ getAnyProcessStatus True False >>= \ (Just (pid, tc)) ->
+ case tc of
+ Terminated sig | sig == floatingPointException -> forkChild2
+ _ -> fail (userError "unexpected termination cause")
+
+forkChild2 =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> exitImmediately (ExitFailure 42)
+ _ -> doParent2
+
+doParent2 =
+ getAnyProcessStatus True False >>= \ (Just (pid, tc)) ->
+ case tc of
+ Exited (ExitFailure 42) -> forkChild3
+ _ -> fail (userError "unexpected termination cause (2)")
+
+forkChild3 =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> exitImmediately (ExitSuccess)
+ _ -> doParent3
+
+doParent3 =
+ getAnyProcessStatus True False >>= \ (Just (pid, tc)) ->
+ case tc of
+ Exited ExitSuccess -> forkChild4
+ _ -> fail (userError "unexpected termination cause (3)")
+
+forkChild4 =
+ forkProcess >>= \ maybe_pid ->
+ case maybe_pid of
+ Nothing -> raiseSignal softwareStop
+ _ -> doParent4
+
+doParent4 =
+ getAnyProcessStatus True True >>= \ (Just (pid, tc)) ->
+ case tc of
+ Stopped sig | sig == softwareStop -> enoughAlready pid
+ _ -> fail (userError "unexpected termination cause (4)")
+
+enoughAlready pid =
+ signalProcess killProcess pid >>
+ getAnyProcessStatus True True >>= \ (Just (pid, tc)) ->
+ case tc of
+ Terminated sig | sig == killProcess -> putStr "I'm happy.\n"
+ _ -> fail (userError "unexpected termination cause (5)")
+
diff --git a/testsuite/tests/lib/libposix/posix004.stdout b/testsuite/tests/lib/libposix/posix004.stdout
new file mode 100644
index 0000000000..8ed7ee54d5
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix004.stdout
@@ -0,0 +1 @@
+I'm happy.
diff --git a/testsuite/tests/lib/libposix/posix005.hs b/testsuite/tests/lib/libposix/posix005.hs
new file mode 100644
index 0000000000..a53182971a
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix005.hs
@@ -0,0 +1,25 @@
+import Posix
+import IO
+main =
+ hSetBuffering stdout NoBuffering >>
+ getEnvVar "TERM" >>= \ term ->
+ putStrLn term >>
+ setEnvironment [("one","1"),("two","2")] >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvVar "foo" "bar" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvVar "foo" "baz" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvVar "fu" "bar" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ removeEnvVar "foo" >>
+ getEnvironment >>= \ env ->
+ print env >>
+ setEnvironment [] >>
+ getEnvironment >>= \ env ->
+ print env
+
diff --git a/testsuite/tests/lib/libposix/posix005.stdout b/testsuite/tests/lib/libposix/posix005.stdout
new file mode 100644
index 0000000000..9896f43da7
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix005.stdout
@@ -0,0 +1,7 @@
+emacs
+[("one","1"),("two","2")]
+[("one","1"),("two","2"),("foo","bar")]
+[("one","1"),("two","2"),("foo","baz")]
+[("one","1"),("two","2"),("foo","baz"),("fu","bar")]
+[("one","1"),("two","2"),("fu","bar")]
+[]
diff --git a/testsuite/tests/lib/libposix/posix006.hs b/testsuite/tests/lib/libposix/posix006.hs
new file mode 100644
index 0000000000..eb6451dd73
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix006.hs
@@ -0,0 +1,14 @@
+import Posix
+
+main =
+ epochTime >>= \ start ->
+ sleep 5 >>
+ let timeleft = 0 in
+ epochTime >>= \ finish ->
+ putStr "Started: " >>
+ print start >>
+ putStr "\nSlept: " >>
+ print (5 - timeleft) >>
+ putStr "\nFinished: " >>
+ print finish >>
+ putChar '\n'
diff --git a/testsuite/tests/lib/libposix/posix006.stdout b/testsuite/tests/lib/libposix/posix006.stdout
new file mode 100644
index 0000000000..d66a4ff4ab
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix006.stdout
@@ -0,0 +1,6 @@
+Started: 902585354
+
+Slept: 5
+
+Finished: 902585359
+
diff --git a/testsuite/tests/lib/libposix/posix007.hs b/testsuite/tests/lib/libposix/posix007.hs
new file mode 100644
index 0000000000..2e62820511
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix007.hs
@@ -0,0 +1,34 @@
+import Posix
+
+-- This test is an example of where something more sophisticated than runstdtest
+-- is required, as its interactive.
+
+main = do
+ installHandler keyboardSignal (Catch doCtrlC) Nothing
+ ta <- getTerminalAttributes stdInput
+ case (controlChar ta Interrupt) of
+ Nothing -> fixMe ta
+ Just x -> continue x
+
+fixMe ta = do
+ putStr "Oops...no interrupt character?\nI can fix that...\n"
+ setTerminalAttributes stdInput (withCC ta (Interrupt, '\ETX')) Immediately
+ ta <- getTerminalAttributes stdInput
+ case (controlChar ta Interrupt) of
+ Nothing -> putStr "...Then again, maybe I can't\n"
+ Just x -> continue x
+
+continue x =
+ putStr "Press '"
+ putStr (ccStr x)
+ putStr "'.\n"
+ awaitSignal Nothing
+ putStr "How did I get here?\n"
+
+doCtrlC =
+ putStr "Caught an interrupt.\n"
+
+ccStr '\DEL' = "^?"
+ccStr x
+ | x >= ' ' = [x]
+ | otherwise = ['^', (toEnum (fromEnum x + fromEnum '@'))]
diff --git a/testsuite/tests/lib/libposix/posix007.stdout b/testsuite/tests/lib/libposix/posix007.stdout
new file mode 100644
index 0000000000..a69478b004
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix007.stdout
@@ -0,0 +1,2 @@
+Press '^C'.
+Caught an interrupt.
diff --git a/testsuite/tests/lib/libposix/posix008.hs b/testsuite/tests/lib/libposix/posix008.hs
new file mode 100644
index 0000000000..249e58eedc
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix008.hs
@@ -0,0 +1,12 @@
+import Posix
+
+main =
+ installHandler realTimeAlarm (Catch alarmclock) Nothing >>
+ putStr "Scheduling an alarm in 5 seconds...\n" >>
+ scheduleAlarm 5 >>
+ putStr "Sleeping one minute.\n" >>
+ sleep 60 >>
+ putStr "How did I get here?\n"
+
+alarmclock =
+ putStr "The alarm went off.\n"
diff --git a/testsuite/tests/lib/libposix/posix008.stdout b/testsuite/tests/lib/libposix/posix008.stdout
new file mode 100644
index 0000000000..582d22b225
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix008.stdout
@@ -0,0 +1,3 @@
+Scheduling an alarm in 5 seconds...
+Sleeping one minute.
+The alarm went off.
diff --git a/testsuite/tests/lib/libposix/posix009.hs b/testsuite/tests/lib/libposix/posix009.hs
new file mode 100644
index 0000000000..1f230f648c
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix009.hs
@@ -0,0 +1,15 @@
+import Posix
+
+main =
+ putStr "Blocking real time alarms.\n" >>
+ blockSignals (addSignal realTimeAlarm emptySignalSet) >>
+ putStr "Scheduling an alarm in 2 seconds...\n" >>
+ scheduleAlarm 2 >>
+ putStr "Sleeping 5 seconds.\n" >>
+ sleep 5 >>
+ putStrLn "Woken up" >>
+ getPendingSignals >>= \ ints ->
+ putStr "Checking pending interrupts for RealTimeAlarm\n" >>
+ print (inSignalSet realTimeAlarm ints) >>
+ putChar '\n'
+
diff --git a/testsuite/tests/lib/libposix/posix009.stdout b/testsuite/tests/lib/libposix/posix009.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix009.stdout
diff --git a/testsuite/tests/lib/libposix/posix010.hs b/testsuite/tests/lib/libposix/posix010.hs
new file mode 100644
index 0000000000..83d5f27ee0
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix010.hs
@@ -0,0 +1,24 @@
+import Posix
+
+main =
+ getUserEntryForName "sof" >>= \ sof ->
+ getUserEntryForName "partain" >>= \ partain ->
+ putStr (ue2String sof) >>
+ putChar '\n' >>
+ putStr (ue2String partain) >>
+ putChar '\n' >>
+ getUserEntryForID (userID sof) >>= \ muid ->
+ getUserEntryForID (userID partain) >>= \ puid ->
+ putStr (ue2String muid) >>
+ putChar '\n' >>
+ putStr (ue2String puid) >>
+ putChar '\n'
+
+ue2String ue =
+ name ++ (':' : (show uid) ++ (':' : (show gid) ++ (':' : home ++ (':' : shell))))
+ where
+ name = userName ue
+ uid = userID ue
+ gid = userGroupID ue
+ home = homeDirectory ue
+ shell = userShell ue
diff --git a/testsuite/tests/lib/libposix/posix010.stdout b/testsuite/tests/lib/libposix/posix010.stdout
new file mode 100644
index 0000000000..ec1d729853
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix010.stdout
@@ -0,0 +1,4 @@
+mattson:104:401:/users/fp/mattson:/bin/csh
+partain:184:401:/users/fp/partain:/usr/local/bin/tcsh
+mattson:104:401:/users/fp/mattson:/bin/csh
+partain:184:401:/users/fp/partain:/usr/local/bin/tcsh
diff --git a/testsuite/tests/lib/libposix/posix011.hs b/testsuite/tests/lib/libposix/posix011.hs
new file mode 100644
index 0000000000..f8baf1cbc2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix011.hs
@@ -0,0 +1,22 @@
+import Posix
+
+main =
+ getGroupEntryForName "grasp" >>= \ grasp ->
+ getGroupEntryForName "staff" >>= \ staff ->
+ putStr (ge2String grasp) >>
+ putChar '\n' >>
+ putStr (ge2String staff) >>
+ putChar '\n' >>
+ getGroupEntryForID (groupID grasp) >>= \ guid ->
+ getGroupEntryForID (groupID staff) >>= \ suid ->
+ putStr (ge2String guid) >>
+ putChar '\n' >>
+ putStr (ge2String suid) >>
+ putChar '\n'
+
+ge2String ge =
+ name ++ (':' : (show gid) ++ (':' : members))
+ where
+ name = groupName ge
+ gid = groupID ge
+ members = foldr (\x y -> x ++ (',' : y)) "" (groupMembers ge)
diff --git a/testsuite/tests/lib/libposix/posix011.stdout b/testsuite/tests/lib/libposix/posix011.stdout
new file mode 100644
index 0000000000..11b5df4f1b
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix011.stdout
@@ -0,0 +1,4 @@
+grasp:401:andre,andy,ap,areid,cvh,dm,dnt,gnik,grasp,hwloidl,jan,johan,jonathan,jtod,kh,laszlo,mattson,partain,sansom,satnam,sewardj,sharpkm,simonm,simonpj,sof,trinder,wadler,
+staff:9:aileen,alexa,ali,alison,andy,anne,ansftp,aran,arthur,audit,bill,botech,bw,carol,carron,cathy,conftp,cs2head,cvh,dam,darryn,daw,dcg,debbie,del,deptlib,dkm,dlg,dm,dnt,ellen,f131mgr,fabio,fairouz,faxback,fido,finance,fiona,footsie,george,gilbert,gilles,gsm,handbook,harrismi,helen,hme,hmg,huw,iain,id,igr,iii,imis-doc,imm,inei,infoman,ingres,inventdb,irfest,isabel,jacksonn,jacqui,james,janice,jej,jim,jl,jmm,johnson,jon,jstack,jtod,jwp,keith,kempj,kh,kieran,kimb,kirsten,kmssys,laurent,lewis,lisa,lizbeth,logiej,love,lyons,maclib,macneisd,margaret,mark,mary,mattson,meurig,mjj,mmi,monica,mossin,mpa,muffy,nk,norman,partain,pd,pdg,pete,pp,ps,quintin,rab,ray,rdm,reh,replib,rff,rffingres,rich,rios,rjw,rn,ron,ruffin,rwi,sanderso,sandy,sansom,satnam,sheila,sid,simonm,simonpj,slurry,softlib,stephen,steve,stevem,stuart,support,susan,tania,tech,teresa,tfm,tommyk,tracy,trinder,types,typesftp,wadler,wf,xadmin,
+grasp:401:andre,andy,ap,areid,cvh,dm,dnt,gnik,grasp,hwloidl,jan,johan,jonathan,jtod,kh,laszlo,mattson,partain,sansom,satnam,sewardj,sharpkm,simonm,simonpj,sof,trinder,wadler,
+staff:9:aileen,alexa,ali,alison,andy,anne,ansftp,aran,arthur,audit,bill,botech,bw,carol,carron,cathy,conftp,cs2head,cvh,dam,darryn,daw,dcg,debbie,del,deptlib,dkm,dlg,dm,dnt,ellen,f131mgr,fabio,fairouz,faxback,fido,finance,fiona,footsie,george,gilbert,gilles,gsm,handbook,harrismi,helen,hme,hmg,huw,iain,id,igr,iii,imis-doc,imm,inei,infoman,ingres,inventdb,irfest,isabel,jacksonn,jacqui,james,janice,jej,jim,jl,jmm,johnson,jon,jstack,jtod,jwp,keith,kempj,kh,kieran,kimb,kirsten,kmssys,laurent,lewis,lisa,lizbeth,logiej,love,lyons,maclib,macneisd,margaret,mark,mary,mattson,meurig,mjj,mmi,monica,mossin,mpa,muffy,nk,norman,partain,pd,pdg,pete,pp,ps,quintin,rab,ray,rdm,reh,replib,rff,rffingres,rich,rios,rjw,rn,ron,ruffin,rwi,sanderso,sandy,sansom,satnam,sheila,sid,simonm,simonpj,slurry,softlib,stephen,steve,stevem,stuart,support,susan,tania,tech,teresa,tfm,tommyk,tracy,trinder,types,typesftp,wadler,wf,xadmin,
diff --git a/testsuite/tests/lib/libposix/posix012.hs b/testsuite/tests/lib/libposix/posix012.hs
new file mode 100644
index 0000000000..87f002a6cd
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix012.hs
@@ -0,0 +1,59 @@
+import Posix
+import IO -- 1.3
+
+main =
+ createFile "po012.out" stdFileMode >>= \ fd ->
+ installHandler processStatusChanged (Catch (reap1 fd)) Nothing >>
+ ls >>
+ awaitSignal Nothing
+
+ls =
+ runProcess "ls" ["-l"] Nothing Nothing Nothing Nothing Nothing
+
+reap1 fd =
+ hPutStrLn stderr "Reaper1" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap2 fd)) Nothing >>
+ fdWrite fd (take 666 (repeat 'x')) >>
+ ls >>
+ awaitSignal Nothing
+
+reap2 fd =
+ hPutStrLn stderr "Reaper2" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap3 fd)) Nothing >>
+ setFileMode "po012.out"
+ (foldr1 unionFileModes [ownerReadMode,ownerWriteMode,groupReadMode,otherReadMode]) >>
+ ls >>
+ awaitSignal Nothing
+
+reap3 fd =
+ hPutStrLn stderr "Reaper3" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap4 fd)) Nothing >>
+ setFileTimes "po012.out" 0 0 >>
+ ls >>
+ awaitSignal Nothing
+
+reap4 fd =
+ hPutStrLn stderr "Reaper4" >>
+ getAnyProcessStatus True False >>
+ installHandler processStatusChanged (Catch (reap5 fd)) Nothing >>
+ --removeLink "po012.out" >>
+ ls >>
+ awaitSignal Nothing
+
+reap5 fd =
+ hPutStrLn stderr "Reaper5" >>
+ getAnyProcessStatus True False >>
+ fdSeek fd SeekFromEnd 0 >>= \ bytes ->
+ if bytes == 666 then
+ fdSeek fd AbsoluteSeek 0 >>
+ hPutStrLn stderr "Reaper5" >>
+ fdRead fd 666 >>= \ (str, _) ->
+ if str == (take 666 (repeat 'x')) then
+ putStr "Okay\n"
+ else
+ putStr "Read failed\n"
+ else
+ putStr "Seek returned wrong size\n"
diff --git a/testsuite/tests/lib/libposix/posix012.stdout b/testsuite/tests/lib/libposix/posix012.stdout
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix012.stdout
diff --git a/testsuite/tests/lib/libposix/posix013.hs b/testsuite/tests/lib/libposix/posix013.hs
new file mode 100644
index 0000000000..b78930b44e
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix013.hs
@@ -0,0 +1,21 @@
+--!! Querying for system information.
+module Main(main) where
+
+import Posix
+
+main = do
+ sid <- getSystemID
+ let
+ info =
+ [ "Node Name: " , nodeName sid
+ , "OS: " , systemName sid
+ , "Arch: " , machine sid
+ , "Version: " , version sid
+ , "Release: " , release sid
+ ]
+ putStrLn2 info
+
+putStrLn2 :: [String] -> IO ()
+putStrLn2 [] = return ()
+putStrLn2 [x] = putStrLn x
+putStrLn2 (x1:x2:xs) = putStrLn (x1++x2) >> putStrLn2 xs
diff --git a/testsuite/tests/lib/libposix/posix014.hs b/testsuite/tests/lib/libposix/posix014.hs
new file mode 100644
index 0000000000..bb3518c440
--- /dev/null
+++ b/testsuite/tests/lib/libposix/posix014.hs
@@ -0,0 +1,19 @@
+--!! Basic pipe usage
+module Main(main) where
+
+import Posix
+
+main = do
+ str <- getEffectiveUserName
+ putStrLn str
+ (rd, wd) <- createPipe
+ n <- forkProcess
+ case n of
+ Nothing -> do
+ (str,_) <- fdRead rd 32
+ -- avoid them zombies
+ putStrLn str
+ Just pid -> do
+ fdWrite wd "Hi, there - forked child calling"
+-- getProcessStatus False True pid
+ return ()