@@ -25,12 +25,12 @@ runTestSuites root ii = do
2525 let testdir = "runtests"
2626 rm_r testdir
2727 createDirectory testdir
28− allPass <- foldM (runTestSuite root testdir) True $ filter hasTestSuites $ Map.toList $ iiPackages ii
28+ allPass <- foldM (runTestSuite root testdir hasTestSuites) True $ Map.toList $ iiPackages ii
2929 unless allPass $ error $ "There were failures, please see the logs in " ++ testdir
3030 where
3131 PackageDB pdb = iiPackageDB ii
3232
33− hasTestSuites (name, _) = maybe defaultHasTestSuites piHasTests $ Map.lookup name pdb
33+ hasTestSuites name = maybe defaultHasTestSuites piHasTests $ Map.lookup name pdb
3434
3535-- | Separate for the PATH environment variable
3636pathSep :: Char
@@ -48,8 +48,13 @@ data TestException = TestException
4848 deriving (Show, Typeable)
4949instance Exception TestException
5050
51−runTestSuite :: FilePath -> FilePath -> Bool -> (PackageName, (Version, Maintainer)) -> IO Bool
52−runTestSuite root testdir prevPassed (packageName, (version, Maintainer maintainer)) = do
51+runTestSuite :: FilePath
52+ -> FilePath
53+ -> (PackageName -> Bool) -- ^ do we have any test suites?
54+ -> Bool
55+ -> (PackageName, (Version, Maintainer))
56+ -> IO Bool
57+runTestSuite root testdir hasTestSuites prevPassed (packageName, (version, Maintainer maintainer)) = do
5358 -- Set up a new environment that includes the sandboxed bin folder in PATH.
5459 env' <- getEnvironment
5560 let menv = Just $ map (fixEnv $ binDir root) env'
@@ -62,8 +67,9 @@ runTestSuite root testdir prevPassed (packageName, (version, Maintainer maintain
6267 passed <- handle (\TestException -> return False) $ do
6368 getHandle WriteMode $ run "cabal" ["unpack", package] testdir
6469 getHandle AppendMode $ run "cabal" (addCabalArgs root ["configure", "--enable-tests"]) dir
65− getHandle AppendMode $ run "cabal" ["build"] dir
66− getHandle AppendMode $ run "cabal" ["test"] dir
70+ when (hasTestSuites packageName) $ do
71+ getHandle AppendMode $ run "cabal" ["build"] dir
72+ getHandle AppendMode $ run "cabal" ["test"] dir
6773 getHandle AppendMode $ run "cabal" ["haddock"] dir
6874 return True
6975 let expectedFailure = packageName `Set.member` expectedFailures