[commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Add support for providing optional arguments for test runner. (ee55e47)
git at git.haskell.org
git at git.haskell.org
Mon Nov 20 20:52:59 UTC 2017
- Previous message: [commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Fix bug with test runner not producing any output files. (c96ac67)
- Next message: [commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Add support for executing Haddock process in test runner. (1377659)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Repository : ssh://git@git.haskell.org/haddock
On branches: 2.17.3.1-spanfix,alexbiehl-patch-1,ghc-8.0,ghc-8.0-facebook,ghc-head,ghc-head1,haddock-quick,headdock-library-1.4.5,ie_avails,issue-303,issue-475,master,pr-filter-maps,pr/cabal-desc,travis,v2.17,v2.17.3,v2.18,wip-located-module-as,wip/D2418,wip/T11080-open-data-kinds,wip/T11430,wip/T12105,wip/T12105-2,wip/T12942,wip/T13163,wip/T3384,wip/embelleshed-rdr,wip/new-tree-one-param,wip/rae,wip/remove-frames,wip/remove-frames1,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13
Link : http://git.haskell.org/haddock.git/commitdiff/ee55e4775739a7c42f19223435ef6ea2ad0bcff0
>---------------------------------------------------------------
commit ee55e4775739a7c42f19223435ef6ea2ad0bcff0
Author: Ćukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date: Sat Aug 1 18:10:15 2015 +0200
Add support for providing optional arguments for test runner.
>---------------------------------------------------------------
ee55e4775739a7c42f19223435ef6ea2ad0bcff0
html-test/run.hs | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 62 insertions(+), 7 deletions(-)
diff --git a/html-test/run.hs b/html-test/run.hs
index 99ca1ec..be31aee 100755
--- a/html-test/run.hs
+++ b/html-test/run.hs
@@ -1,9 +1,16 @@
#!/usr/bin/env runhaskell
{-# LANGUAGE CPP #-}
+{-# LANGUAGE RecordWildCards #-}
+import Control.Monad
+
+import Data.Maybe
+
+import System.Console.GetOpt
import System.Directory
import System.Environment
+import System.Exit
import System.FilePath
@@ -17,22 +24,70 @@ refDir = baseDir </> "ref"
outDir = baseDir </> "out"
+data Config = Config
+ { cfgHaddockPath :: FilePath
+ , cfgFiles :: [FilePath]
+ }
+
+
main :: IO ()
main = do
- files <- processArgs =<< getArgs
- putStrLn $ "Files to test: " ++ show files
+ Config { .. } <- parseArgs =<< getArgs
+ putStrLn $ "Files to test: " ++ show cfgFiles
+
+
+parseArgs :: [String] -> IO Config
+parseArgs args = do
+ let (flags, files, errors) = getOpt Permute options args
+
+ when (not $ null errors) $ do
+ mapM_ putStrLn errors
+ exitFailure
+
+ when (FlagHelp `elem` flags) $ do
+ putStrLn $ usageInfo "" options
+ exitSuccess
+
+ cfgFiles <- processFileArgs files
+ let cfgHaddockPath = haddockPath flags
+ return $ Config { .. }
-processArgs :: [String] -> IO [FilePath]
-processArgs [] = filter isSourceFile <$> getDirectoryContents srcDir
-processArgs args = pure $ map processArg args
+processFileArgs :: [String] -> IO [FilePath]
+processFileArgs [] = filter isSourceFile <$> getDirectoryContents srcDir
+processFileArgs args = pure $ map processFileArg args
-processArg :: String -> FilePath
-processArg arg
+processFileArg :: String -> FilePath
+processFileArg arg
| isSourceFile arg = arg
| otherwise = srcDir </> arg <.> "hs"
isSourceFile :: FilePath -> Bool
isSourceFile path = takeExtension path `elem` [".hs", ".lhs"]
+
+
+data Flag
+ = FlagHaddockPath FilePath
+ | FlagHelp
+ deriving Eq
+
+
+options :: [OptDescr Flag]
+options =
+ [ Option [] ["haddock-path"] (ReqArg FlagHaddockPath "FILE")
+ "path to Haddock executable to exectue tests with"
+ , Option ['h'] ["help"] (NoArg FlagHelp)
+ "display this help end exit"
+ ]
+
+
+haddockPath :: [Flag] -> FilePath
+haddockPath flags = case mlast [ path | FlagHaddockPath path <- flags ] of
+ Just path -> path
+ Nothing -> rootDir </> "dist" </> "build" </> "haddock" </> "haddock"
+
+
+mlast :: [a] -> Maybe a
+mlast = listToMaybe . reverse
- Previous message: [commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Fix bug with test runner not producing any output files. (c96ac67)
- Next message: [commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13: Add support for executing Haddock process in test runner. (1377659)
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ghc-commits
mailing list