diff options
author | Alp Mestanogullari <alpmestan@gmail.com> | 2019-04-26 14:25:46 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-05-29 10:36:35 -0400 |
commit | 7a75a09403264c60a1f513b7466dc9503b966aab (patch) | |
tree | f447111fa2f5a7a7fe7ab5730be63529b15eea0c /hadrian/src | |
parent | c8380a4a738e5c2488337496b0d1b1faf6a7de9d (diff) | |
download | haskell-7a75a09403264c60a1f513b7466dc9503b966aab.tar.gz |
testsuite: introduce 'static_stats' tests
They are a particular type of perf tests. This patch introduces a
'stats_files_dir' configuration field in the testsuite driver where all
haddock timing files (and possibly others in the future) are assumed to live.
We also change both the Make and Hadrian build systems to pass respectively
$(TOP)/testsuite/tests/perf/haddock/ and
<build root>/stage1/haddock-timing-files/ as the value of that new
configuration field, and to generate the timing files in those directories
in the first place while generating documentation with haddock.
This new test type can be seen as one dedicated to examining stats files that
are generated while building a GHC distribution. This also lets us get rid of
the 'extra_files' directives in the all.T entries for haddock.base,
haddock.Cabal and haddock.compiler.
Diffstat (limited to 'hadrian/src')
-rw-r--r-- | hadrian/src/Context.hs | 3 | ||||
-rw-r--r-- | hadrian/src/Context/Path.hs | 5 | ||||
-rw-r--r-- | hadrian/src/Rules/Documentation.hs | 5 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/Haddock.hs | 4 | ||||
-rw-r--r-- | hadrian/src/Settings/Builders/RunTest.hs | 6 |
5 files changed, 19 insertions, 4 deletions
diff --git a/hadrian/src/Context.hs b/hadrian/src/Context.hs index 7c7bb124ff..0676743ee5 100644 --- a/hadrian/src/Context.hs +++ b/hadrian/src/Context.hs @@ -8,7 +8,8 @@ module Context ( -- * Paths contextDir, buildPath, buildDir, pkgInplaceConfig, pkgSetupConfigFile, pkgHaddockFile, pkgRegisteredLibraryFile, pkgLibraryFile, pkgGhciLibraryFile, - pkgConfFile, objectPath, contextPath, getContextPath, libPath, distDir + pkgConfFile, objectPath, contextPath, getContextPath, libPath, distDir, + haddockStatsFilesDir ) where import Base diff --git a/hadrian/src/Context/Path.hs b/hadrian/src/Context/Path.hs index 4bc9d9be34..e5a82710ab 100644 --- a/hadrian/src/Context/Path.hs +++ b/hadrian/src/Context/Path.hs @@ -41,3 +41,8 @@ buildPath context = buildRoot <&> (-/- buildDir context) -- | The expression that evaluates to the build path of the current 'Context'. getBuildPath :: Expr Context b FilePath getBuildPath = expr . buildPath =<< getContext + +-- | Path to the directory containing haddock timing files, used by +-- the haddock perf tests. +haddockStatsFilesDir :: Action FilePath +haddockStatsFilesDir = (-/- "stage1" -/- "haddock-timing-files") <$> buildRoot diff --git a/hadrian/src/Rules/Documentation.hs b/hadrian/src/Rules/Documentation.hs index a70b4d5c9d..9991f01708 100644 --- a/hadrian/src/Rules/Documentation.hs +++ b/hadrian/src/Rules/Documentation.hs @@ -205,7 +205,12 @@ buildPackageDocumentation = do -- TODO: Pass the correct way from Rules via Context. dynamicPrograms <- dynamicGhcPrograms =<< flavour let haddockWay = if dynamicPrograms then dynamic else vanilla + statsFilesDir <- haddockStatsFilesDir + createDirectory statsFilesDir build $ target (context {way = haddockWay}) (Haddock BuildPackage) srcs [file] + produces [ + statsFilesDir </> pkgName (Context.package context) <.> "t" + ] data PkgDocTarget = DotHaddock PackageName | HaddockPrologue PackageName deriving (Eq, Show) diff --git a/hadrian/src/Settings/Builders/Haddock.hs b/hadrian/src/Settings/Builders/Haddock.hs index 65c703160c..b01b8a2459 100644 --- a/hadrian/src/Settings/Builders/Haddock.hs +++ b/hadrian/src/Settings/Builders/Haddock.hs @@ -35,13 +35,13 @@ haddockBuilderArgs = mconcat output <- getOutput pkg <- getPackage root <- getBuildRoot - path <- getBuildPath context <- getContext version <- expr $ pkgVersion pkg synopsis <- expr $ pkgSynopsis pkg deps <- getContextData depNames haddocks <- expr $ haddockDependencies context hVersion <- expr $ pkgVersion haddock + statsDir <- expr $ haddockStatsFilesDir ghcOpts <- haddockGhcArgs mconcat [ arg "--verbosity=0" @@ -66,6 +66,6 @@ haddockBuilderArgs = mconcat , pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ] , getInputs , arg "+RTS" - , arg $ "-t" ++ path -/- "haddock.t" + , arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t") , arg "--machine-readable" , arg "-RTS" ] ] diff --git a/hadrian/src/Settings/Builders/RunTest.hs b/hadrian/src/Settings/Builders/RunTest.hs index 6cc11f8aef..63e3dfd6c9 100644 --- a/hadrian/src/Settings/Builders/RunTest.hs +++ b/hadrian/src/Settings/Builders/RunTest.hs @@ -85,11 +85,14 @@ runTestBuilderArgs = builder RunTest ? do wordsize <- getTestSetting TestWORDSIZE top <- expr $ topDirectory ghcFlags <- expr runTestGhcFlags - timeoutProg <- expr buildRoot <&> (-/- timeoutPath) cmdrootdirs <- expr (testRootDirs <$> userSetting defaultTestArgs) let defaultRootdirs = ("testsuite" -/- "tests") : libTests rootdirs | null cmdrootdirs = defaultRootdirs | otherwise = cmdrootdirs + root <- expr buildRoot + let timeoutProg = root -/- timeoutPath + statsFilesDir <- expr haddockStatsFilesDir + -- See #16087 let ghcBuiltByLlvm = False -- TODO: Implement this check @@ -134,6 +137,7 @@ runTestBuilderArgs = builder RunTest ? do , arg "--config", arg $ "gs=gs" -- Use the default value as in test.mk , arg "--config", arg $ "timeout_prog=" ++ show (top -/- timeoutProg) + , arg "--config", arg $ "stats_files_dir=" ++ statsFilesDir , arg $ "--threads=" ++ show threads , getTestArgs -- User-provided arguments from command line. ] |