Commit 1850acee authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Reenable warnings on package-tests.


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 75bfe09c
......@@ -329,6 +329,6 @@ test-suite package-tests
old-time
if !os(windows)
build-depends: unix
ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-incomplete-patterns -rtsopts
ghc-options: -Wall -rtsopts
default-extensions: CPP
default-language: Haskell98
......@@ -10,7 +10,7 @@ import Distribution.PackageDescription
suite :: TestM ()
suite = do
assertOutputDoesNotContain "unknown section type"
=<< cabal "configure" []
=<< cabal' "configure" []
dist_dir <- distDir
lbi <- liftIO $ getPersistBuildConfig dist_dir
let anticipatedBenchmark = emptyBenchmark
......
......@@ -18,12 +18,15 @@ module PackageTests.PackageTester
-- * Running cabal commands
, cabal
, cabal'
, cabal_build
, cabal_install
, ghcPkg
, ghcPkg'
, compileSetup
, run
, runExe
, runExe'
, rawRun
, rawCompileSetup
, withPackage
......@@ -104,8 +107,7 @@ runTestM suite name subname m = do
testPackageDb = False,
testEnvironment = []
}
runReaderT (cleanup >> m) (suite, test)
return ()
void (runReaderT (cleanup >> m) (suite, test))
where
-- TODO: option not to clean up dist dirs; this should be
-- harmless!
......@@ -245,8 +247,11 @@ sharedDBPath = do
------------------------------------------------------------------------
-- * Running cabal
cabal :: String -> [String] -> TestM Result
cabal cmd extraArgs0 = do
cabal :: String -> [String] -> TestM ()
cabal cmd extraArgs0 = void (cabal' cmd extraArgs0)
cabal' :: String -> [String] -> TestM Result
cabal' cmd extraArgs0 = do
(suite, test) <- ask
prefix_dir <- prefixDir
when ((cmd == "register" || cmd == "copy") && not (testPackageDb test)) $
......@@ -378,8 +383,11 @@ ghcPackageDBParams ghc_version dbs
------------------------------------------------------------------------
-- * Running ghc-pkg
ghcPkg :: String -> [String] -> TestM Result
ghcPkg cmd args = do
ghcPkg :: String -> [String] -> TestM ()
ghcPkg cmd args = void (ghcPkg' cmd args)
ghcPkg' :: String -> [String] -> TestM Result
ghcPkg' cmd args = do
db_path <- sharedDBPath
(config, test) <- ask
unless (testPackageDb test) $
......@@ -404,9 +412,13 @@ ghcPkgPackageDBParams version dbs = concatMap convert dbs where
------------------------------------------------------------------------
-- * Running other things
-- | Running an executable that was produced by cabal.
runExe :: String -> [String] -> TestM Result
runExe exe_name args = do
-- | Run an executable that was produced by cabal. The @exe_name@
-- is precisely the name of the executable section in the file.
runExe :: String -> [String] -> TestM ()
runExe exe_name args = void (runExe' exe_name args)
runExe' :: String -> [String] -> TestM Result
runExe' exe_name args = do
dist_dir <- distDir
let exe = dist_dir </> "build" </> exe_name </> exe_name
run Nothing exe args
......@@ -433,7 +445,7 @@ rawRun verbosity mb_cwd path envOverrides args = do
pid <- runProcess path' args mb_cwd menv Nothing (Just writeh) (Just writeh)
out <- hGetContents readh
E.evaluate (length out) -- force the output
void $ E.evaluate (length out) -- force the output
hClose readh
-- wait for the program to terminate
......
......@@ -10,7 +10,7 @@ import Distribution.PackageDescription
suite :: TestM ()
suite = do
assertOutputDoesNotContain "unknown section type"
=<< cabal "configure" []
=<< cabal' "configure" []
dist_dir <- distDir
lbi <- liftIO $ getPersistBuildConfig dist_dir
let anticipatedTestSuite = emptyTestSuite
......
......@@ -85,7 +85,7 @@ tests config =
-- Test attempt to have executable depend on internal
-- library, but cabal-version is too old.
, tc "BuildDeps/InternalLibrary0" $ do
r <- shouldFail $ cabal "configure" []
r <- shouldFail $ cabal' "configure" []
-- Should tell you how to enable the desired behavior
let sb = "library which is defined within the same package."
assertOutputContains sb r
......@@ -115,7 +115,7 @@ tests config =
-- dep does not leak into the library.
, tc "BuildDeps/TargetSpecificDeps1" $ do
cabal "configure" []
r <- shouldFail $ cabal "build" []
r <- shouldFail $ cabal' "build" []
assertBool "error should be in MyLibrary.hs" $
resultOutput r =~ "^MyLibrary.hs:"
assertBool "error should be \"Could not find module `System.Time\"" $
......@@ -130,7 +130,7 @@ tests config =
-- dep does not leak into the executable.
, tc "BuildDeps/TargetSpecificDeps3" $ do
cabal "configure" []
r <- shouldFail $ cabal "build" []
r <- shouldFail $ cabal' "build" []
assertBool "error should be in lemon.hs" $
resultOutput r =~ "^lemon.hs:"
assertBool "error should be \"Could not find module `System.Time\"" $
......@@ -193,9 +193,9 @@ tests config =
withPackage "P2" $ cabal "configure" []
withPackage "P1" $ cabal "build" []
withPackage "P1" $ cabal "build" [] -- rebuild should work
r1 <- withPackage "P1" $ cabal "register" ["--print-ipid", "--inplace"]
r1 <- withPackage "P1" $ cabal' "register" ["--print-ipid", "--inplace"]
withPackage "P2" $ cabal "build" []
r2 <- withPackage "P2" $ cabal "register" ["--print-ipid", "--inplace"]
r2 <- withPackage "P2" $ cabal' "register" ["--print-ipid", "--inplace"]
let exIPID s = takeWhile (/= '\n') $
head . filter (isPrefixOf $ "UniqueIPID-0.1-") $ (tails s)
when ((exIPID $ resultOutput r1) == (exIPID $ resultOutput r2)) $
......@@ -208,7 +208,7 @@ tests config =
internal_lib_test expect = withPackageDb $ do
withPackage "to-install" $ cabal_install []
cabal_build []
r <- runExe "lemon" []
r <- runExe' "lemon" []
assertEqual
("executable should have linked with the " ++ expect ++ " library")
("myLibFunc " ++ expect)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment