Typo
[packages/base.git] / tests / IO / openFile008.hs
1 import System.IO
2 import System.Cmd
3 import System.FilePath
4 import Text.Printf
5 import System.Directory
6 import Control.Monad
7
8 testdir = "openFile008_testdir"
9
10 -- Test repeated opening/closing of 1000 files. This is useful for guaging
11 -- the performance of open/close and file locking.
12 main = do
13 system ("rm -rf " ++ testdir)
14 createDirectory testdir
15 let filenames = [testdir </> printf "file%03d" (n::Int) | n <- [1..1000]]
16
17 forM_ [1..50] $ \_ -> do
18 hs <- mapM (\f -> openFile f WriteMode) filenames
19 mapM_ hClose hs
20
21 mapM_ removeFile filenames
22 removeDirectory testdir