-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ import Data.Text.Encoding (decodeUtf8) | |
import Data.Time.Clock (getCurrentTime) | ||
import Data.Traversable (forM) | ||
import Data.Word8 (_colon) | ||
import qualified Distribution.PackageDescription as C | ||
import Distribution.System (OS (Windows), | ||
Platform (Platform)) | ||
import qualified Distribution.Text | ||
|
@@ -1148,7 +1149,7 @@ singleTest runInBase topts testsToRun ac ee task installedMap = do | |
-- FIXME: Since this doesn't use cabal, we should be able to avoid using a | ||
-- fullblown 'withSingleContext'. | ||
(allDepsMap, _cache) <- getConfigCache ee task installedMap True False | ||
withSingleContext runInBase ac ee task (Just allDepsMap) (Just "test") $ \package _cabalfp pkgDir _cabal announce _console mlogFile -> do | ||
withSingleContext runInBase ac ee task (Just allDepsMap) (Just "test") $ \package cabalfp pkgDir _cabal announce _console mlogFile -> do | ||
config <- asks getConfig | ||
let needHpc = toCoverage topts | ||
|
||
|
@@ -1178,11 +1179,24 @@ singleTest runInBase topts testsToRun ac ee task installedMap = do | |
_ -> "" | ||
|
||
errs <- liftM Map.unions $ forM testsToRun $ \testName -> do | ||
nameDir <- parseRelDir $ T.unpack testName | ||
nameExe <- parseRelFile $ T.unpack testName ++ exeExtension | ||
nameTix <- liftM (pkgDir </>) $ parseRelFile $ T.unpack testName ++ ".tix" | ||
suites <- fmap (C.condTestSuites . snd) (readPackageUnresolved cabalfp) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
luigy
Author
Owner
|
||
|
||
let stestName = T.unpack testName | ||
mtestSuiteInterface = fmap (C.testInterface . C.condTreeData . snd) | ||
$ find ((== stestName) . fst) suites | ||
(testName', isTestTypeLib) = | ||
case mtestSuiteInterface of | ||
Just C.TestSuiteLibV09{} -> (stestName ++ "Stub", True) | ||
Just C.TestSuiteExeV10{} -> (stestName, False) | ||
_ -> ("", False) -- TODO throw an unsupported error or not found? | ||
|
||
nameDir <- parseRelDir $ testName' | ||
nameExe <- parseRelFile $ testName' ++ exeExtension | ||
nameTix <- liftM (pkgDir </>) $ parseRelFile $ stestName ++ ".tix" | ||
let exeName = buildDir </> $(mkRelDir "build") </> nameDir </> nameExe | ||
|
||
exists <- fileExists exeName | ||
|
||
menv <- liftIO $ configEnvOverride config EnvSettings | ||
{ esIncludeLocals = taskLocation task == Local | ||
, esIncludeGhcPackagePath = True | ||
|
@@ -1205,7 +1219,7 @@ singleTest runInBase topts testsToRun ac ee task installedMap = do | |
announce $ "test (suite: " <> testName <> argsDisplay <> ")" | ||
let cp = (proc (toFilePath exeName) args) | ||
{ cwd = Just $ toFilePath pkgDir | ||
, Process.env = envHelper menv | ||
, Process.env = Just $ ("HPCTIXFILE", toFilePath nameTix) : maybe [] id (envHelper menv) | ||
This comment has been minimized.
Sorry, something went wrong.
mgsloan
|
||
, std_in = CreatePipe | ||
, std_out = | ||
case mlogFile of | ||
|
@@ -1219,6 +1233,10 @@ singleTest runInBase topts testsToRun ac ee task installedMap = do | |
|
||
-- Use createProcess_ to avoid the log file being closed afterwards | ||
(Just inH, Nothing, Nothing, ph) <- liftIO $ createProcess_ "singleBuild.runTests" cp | ||
when isTestTypeLib $ liftIO $ do | ||
let testLog = buildDir </> $(mkRelFile "stack-test.log") | ||
removeFileIfExists testLog | ||
hPutStr inH $ show (testLog, testName) | ||
liftIO $ hClose inH | ||
ec <- liftIO $ waitForProcess ph | ||
-- Move the .tix file out of the package | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -725,7 +725,7 @@ configureOptsNoDir econfig bco deps wanted isLocal package = concat | |
allGhcOptions = concat | ||
[ Map.findWithDefault [] Nothing (configGhcOptions config) | ||
, Map.findWithDefault [] (Just $ packageName package) (configGhcOptions config) | ||
, concat [["-fhpc", "-fforce-recomp"] | isLocal && toCoverage (boptsTestOpts bopts)] | ||
, concat [["-fhpc"] | isLocal && toCoverage (boptsTestOpts bopts)] | ||
This comment has been minimized.
Sorry, something went wrong.
mgsloan
|
||
, if includeExtraOptions | ||
then boptsGhcOptions bopts | ||
else [] | ||
|
I think it would make sense to instead add more information to
Package
, and modify resolvePackage to provide it. That way, cabal conditionals will be resolved properly.Maybe change the type of
packageTests
toMap Text TestSuiteInterfact
, and usekeysSet
in spots where other usages of it need aSet
?