aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/processGroup002.hs
diff options
context:
space:
mode:
authorGravatar Favonia <favonia@gmail.com>2011-05-11 22:35:53 -0400
committerGravatar Simon Marlow <marlowsd@gmail.com>2011-05-23 10:36:46 +0100
commit6f88d3dd6e107c996b701b7f4fccaef171440722 (patch)
tree6831a3a737a9d1a98f722bf4e2c0dc1b8e080760 /tests/processGroup002.hs
parentff80c44c25ab6233fdd0180275c9981400007c1c (diff)
Test cases for the new process group API.
Diffstat (limited to 'tests/processGroup002.hs')
-rw-r--r--tests/processGroup002.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/processGroup002.hs b/tests/processGroup002.hs
new file mode 100644
index 0000000..c93a416
--- /dev/null
+++ b/tests/processGroup002.hs
@@ -0,0 +1,21 @@
+import System.Posix.Process
+
+main = do
+ pid <- getProcessID
+ ppid <- getParentProcessID
+ ppgid <- getProcessGroupIDOf ppid
+ -- join the parent process
+ putStr "Testing joinProcessGroup: "
+ joinProcessGroup ppgid
+ pgid1 <- getProcessGroupID
+ print $ ppgid == pgid1
+ -- be a leader
+ putStr "Testing createProcessGroupFor: "
+ createProcessGroupFor pid
+ pgid2 <- getProcessGroupID
+ print $ pid == fromIntegral pgid2
+ -- and join the parent again
+ putStr "Testing setProcessGroupIDOf: "
+ setProcessGroupIDOf pid ppgid
+ pgid3 <- getProcessGroupID
+ print $ ppgid == pgid3