Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/94a96070f6eecc91d5ad7066904aa752b660a0e5

>---------------------------------------------------------------

commit 94a96070f6eecc91d5ad7066904aa752b660a0e5
Author: Ian Lynagh <[email protected]>
Date:   Sun Nov 20 13:37:17 2011 +0000

    Enable and fix posix006

>---------------------------------------------------------------

 tests/lib/libposix/all.T           |    1 +
 tests/lib/libposix/posix006.hs     |   28 +++++++++++++++-------------
 tests/lib/libposix/posix006.stdout |    7 +------
 3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/tests/lib/libposix/all.T b/tests/lib/libposix/all.T
index 7cd243c..334d4f2 100644
--- a/tests/lib/libposix/all.T
+++ b/tests/lib/libposix/all.T
@@ -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, [''])
diff --git a/tests/lib/libposix/posix006.hs b/tests/lib/libposix/posix006.hs
index eb6451d..dfe3f1d 100644
--- a/tests/lib/libposix/posix006.hs
+++ b/tests/lib/libposix/posix006.hs
@@ -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
diff --git a/tests/lib/libposix/posix006.stdout 
b/tests/lib/libposix/posix006.stdout
index d66a4ff..d86bac9 100644
--- a/tests/lib/libposix/posix006.stdout
+++ b/tests/lib/libposix/posix006.stdout
@@ -1,6 +1 @@
-Started: 902585354
-
-Slept: 5
-
-Finished: 902585359
-
+OK



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to