Skip to content

Commit

Permalink
cleaned up test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxPolice committed Oct 16, 2005
1 parent 26d96f4 commit 8c9d8dd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions Distribution/Program.hs
Expand Up @@ -69,6 +69,7 @@ defaultProgramConfiguration :: ProgramConfiguration
defaultProgramConfiguration = progListToFM
[ haddockProgram
, pfesetupProgram]
-- FIXME: Add ranlib!
-- haddock is currently the only one that really works.
{- [ ghcProgram
, ghcPkgProgram
Expand Down
2 changes: 1 addition & 1 deletion Distribution/Setup.hs
Expand Up @@ -135,7 +135,7 @@ data ConfigFlags = ConfigFlags {
emptyConfigFlags :: ConfigFlags
emptyConfigFlags = ConfigFlags {
configPrograms = defaultProgramConfiguration,
configHcFlavor = Nothing,
configHcFlavor = defaultCompilerFlavor,
configHcPath = Nothing,
configHcPkg = Nothing,
-- configHaddock = EmptyLocation,
Expand Down
4 changes: 2 additions & 2 deletions Distribution/Simple/Install.hs
Expand Up @@ -144,8 +144,8 @@ installLibGHC verbose hasProf hasGHCi pref buildPref pd@PackageDescription{libra
-- don't worry too much about it.
mRanlibLoc <- findExecutable "ranlib"
case mRanlibLoc of
Just ranLibLoc -> do rawSystemVerbose verbose "ranlib" [libTargetLoc]
ifProf $ rawSystemVerbose verbose "ranlib" [profLibTargetLoc]
Just ranLibLoc -> do rawSystemVerbose verbose ranLibLoc [libTargetLoc]
ifProf $ rawSystemVerbose verbose ranLibLoc [profLibTargetLoc]
return ()
Nothing -> do mArLoc <- findExecutable "ar"
case mArLoc of
Expand Down
2 changes: 1 addition & 1 deletion tests/ModuleTest.hs
Expand Up @@ -185,7 +185,7 @@ tests currDir comp compConf = [
doesFileExist ",tmp/bin/testB" >>=
assertBool "testB not produced"
assertCmd' compCmd "sdist" "setup sdist returned error code"
doesFileExist "dist/test-1.0.tgz" >>=
doesFileExist "dist/test-1.0.tar.gz" >>=
assertBool "sdist did not put the expected file in place"
doesFileExist "dist/src" >>=
assertEqual "dist/src exists" False
Expand Down
2 changes: 1 addition & 1 deletion tests/depOnLib/test.cabal
Expand Up @@ -9,5 +9,5 @@ exposed-modules: A

Executable: mainForA
Other-Modules: Main, A
hs-source-dir: mains
hs-source-dirs: mains, libs
Main-is: Main.hs
21 changes: 11 additions & 10 deletions tests/withHooks/Setup.lhs
Expand Up @@ -6,6 +6,7 @@
> import Distribution.PackageDescription (PackageDescription,
> readPackageDescription, readHookedBuildInfo)
> import Distribution.Simple.Configure(LocalBuildInfo(..))
> import Distribution.Setup(CopyFlags, CopyDest(..))
> import Distribution.Compat.Directory (copyFile)
> import Distribution.Compat.FilePath(joinPaths)
> import Distribution.Simple.Utils (defaultHookedPackageDesc)
Expand Down Expand Up @@ -36,18 +37,18 @@
> writeFile outFile ("-- this file has been preprocessed as a test\n\n" ++ stuff)
> return ExitSuccess

> testing :: Args -> Bool -> a -> IO ExitCode
> testing [] _ _ = return ExitSuccess
> testing a@(h:_) _ _ = do putStrLn $ "testing: " ++ (show a)
> if h == "--pass"
> then return ExitSuccess
> else return (ExitFailure 1)
> testing :: Args -> Bool -> a -> b -> IO ExitCode
> testing [] _ _ _ = return ExitSuccess
> testing a@(h:_) _ _ _ = do putStrLn $ "testing: " ++ (show a)
> if h == "--pass"
> then return ExitSuccess
> else return (ExitFailure 1)

> myCopyHook :: PackageDescription
> -> LocalBuildInfo
> -> (Maybe FilePath,Int) -- ^install-prefix, verbose
> -> CopyFlags -- ^install-prefix, verbose
> -> IO ()
> myCopyHook a b c@((Just p), _) = do
> myCopyHook a b c@((CopyPrefix p), _) = do
> createDirectoryIfMissing True p
> copyFile (foldl1 joinPaths ["dist", "build", "withHooks", "withHooks"])
> (p `joinPaths` "withHooks")
Expand All @@ -60,8 +61,8 @@ Override "gc" to test the overriding mechanism.
> main = defaultMainWithHooks defaultUserHooks
> {preConf=myPreConf,
> runTests=testing,
> postConf=(\_ _ _-> return ExitSuccess),
> postConf=(\_ _ _ _ -> return ExitSuccess),
> hookedPreProcessors= [("testSuffix", ppTestHandler), ("gc", ppTestHandler)],
> postClean=(\_ _ _ -> removeFile "Setup.buildinfo" >> return ExitSuccess),
> postClean=(\_ _ _ _ -> removeFile "Setup.buildinfo" >> return ExitSuccess),
> copyHook=myCopyHook
> }

0 comments on commit 8c9d8dd

Please sign in to comment.