Enable and fix posix006
authorIan Lynagh <igloo@earth.li>
Sun, 20 Nov 2011 13:37:17 +0000 (13:37 +0000)
committerIan Lynagh <igloo@earth.li>
Sun, 20 Nov 2011 13:37:17 +0000 (13:37 +0000)
testsuite/tests/lib/libposix/all.T
testsuite/tests/lib/libposix/posix006.hs
testsuite/tests/lib/libposix/posix006.stdout

index 7cd243c..334d4f2 100644 (file)
@@ -2,3 +2,4 @@ test('posix002', reqlib('unix'), compile_and_run, [''])
 test('posix003', normal,         compile_and_run, [''])
 test('posix004', reqlib('unix'), compile_and_run, [''])
 test('posix005', [reqlib('unix'), expect_broken(5648)], compile_and_run, [''])
+test('posix006', reqlib('unix'), compile_and_run, [''])
index eb6451d..dfe3f1d 100644 (file)
@@ -1,14 +1,16 @@
-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'
+import System.Posix.Time
+import System.Posix.Unistd
+
+main = do start <- epochTime
+          sleep 5
+          finish <- epochTime
+          let slept = finish - start
+          if slept >= 5 && slept <= 6
+              then putStrLn "OK"
+              else do putStr "Started: "
+                      print start
+                      putStr "Finished: "
+                      print finish
+                      putStr "Slept: "
+                      print slept