summaryrefslogtreecommitdiff
path: root/configure.hs
diff options
context:
space:
mode:
Diffstat (limited to 'configure.hs')
-rw-r--r--configure.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/configure.hs b/configure.hs
index fa07be3ab..56daf583a 100644
--- a/configure.hs
+++ b/configure.hs
@@ -1,5 +1,4 @@
-{- Checks system configuration and generates SysConfig.hs.
- -}
+{- Checks system configuration and generates SysConfig.hs. -}
import System.IO
import System.Cmd
@@ -12,8 +11,9 @@ data Config = Config String Bool
tests :: [TestDesc]
tests = [
- TestDesc "cp -a" "cp_a" cp_a
- , TestDesc "cp --reflink" "cp_reflink" cp_reflink
+ TestDesc "cp -a" "cp_a" $ testCp "-a"
+ , TestDesc "cp -p" "cp_p" $ testCp "-p"
+ , TestDesc "cp --reflink=auto" "cp_reflink_auto" $ testCp "--reflink=auto"
]
tmpDir :: String
@@ -25,11 +25,9 @@ testFile = tmpDir ++ "/testfile"
quiet :: String -> String
quiet s = s ++ " 2>/dev/null"
-cp_a :: Test
-cp_a = testCmd $ quiet $ "cp -a " ++ testFile ++ " " ++ testFile ++ ".new"
-
-cp_reflink :: Test
-cp_reflink = testCmd $ quiet $ "cp --reflink=auto " ++ testFile ++ " " ++ testFile ++ ".new"
+testCp :: String -> Test
+testCp option = testCmd $ quiet $ "cp " ++ option ++ " " ++ testFile ++
+ " " ++ testFile ++ ".new"
testCmd :: String -> Test
testCmd c = do
@@ -51,6 +49,7 @@ writeSysConfig config = do
header = [
"{- Automatically generated by configure. -}"
, "module SysConfig where"
+ , ""
]
footer = []
vars [] = []
@@ -58,6 +57,7 @@ writeSysConfig config = do
showvar (Config name val) = [
name ++ " :: Bool"
, name ++ " = " ++ show val
+ , ""
]
runTests :: [TestDesc] -> IO [Config]