From b6b7b6a9a91d50b0f84f216eaf2dd19279ee08cf Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 20 May 2008 16:30:12 +0000 Subject: Add a test for #2038 (resourceLimit) --- tests/all.T | 1 + tests/resourceLimit.hs | 16 ++++++++++++++++ tests/resourceLimit.stdout | 2 ++ 3 files changed, 19 insertions(+) create mode 100644 tests/resourceLimit.hs create mode 100644 tests/resourceLimit.stdout (limited to 'tests') diff --git a/tests/all.T b/tests/all.T index a80efc6..8647812 100644 --- a/tests/all.T +++ b/tests/all.T @@ -11,6 +11,7 @@ test('forkprocess01', compose(only_compiler_types(['ghc']), compose(expect_fail_for(['threaded2']), conf)), compile_and_run, ['-package unix']) test('user001', conf, compile_and_run, ['-package unix']) +test('resourceLimit', conf, compile_and_run, ['-package unix']) if config.platform == 'i386-unknown-freebsd': conf = expect_fail diff --git a/tests/resourceLimit.hs b/tests/resourceLimit.hs new file mode 100644 index 0000000..05e35af --- /dev/null +++ b/tests/resourceLimit.hs @@ -0,0 +1,16 @@ + +-- #2038 + +import System.Posix.Resource + +main :: IO () +main = do + let soft = ResourceLimit 5 + hard = ResourceLimit 10 + setResourceLimit ResourceCPUTime (ResourceLimits soft hard) + r <- getResourceLimit ResourceCPUTime + let (ResourceLimit s) = softLimit r + let (ResourceLimit h) = hardLimit r + putStrLn $ show s + putStrLn $ show h + diff --git a/tests/resourceLimit.stdout b/tests/resourceLimit.stdout new file mode 100644 index 0000000..c3ec801 --- /dev/null +++ b/tests/resourceLimit.stdout @@ -0,0 +1,2 @@ +5 +10 -- cgit v1.2.3