-
Notifications
You must be signed in to change notification settings - Fork 37
Conversation
@@ -107,9 +107,10 @@ stage2Packages = return [haddock] | |||
testsuitePackages :: Action [Package] | |||
testsuitePackages = return [ checkApiAnnotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have this list of packages needed for the testsuite, but then do a lot of ad hoc need
s in the testsuite instead of fully relying on this list. Can we do better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, default libraries are built vanilla way, but the libraries listed here are needed in profiling and dynamic ways also. Can we create a separate list of packages needed only for testsuite and have to built in profiling and dynamic ways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, maybe this list should list ways too?
I think someone needs to think about the overall architecture of the testsuite. So far there are a bunch of PRs that seem to introduce various ad hoc solutions, but I do not see a clear design of how everything should be tied together. Can you write up such a design document?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will be creating an Issue in this regards soon enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we need to be a lot more careful about those uses of vanillaContext
and default ways for packages etc. Most of the time we just want to follow what libraryWays
and rtsWays
dictate, I think. I'm expecting this single line of work to fix a lot of test failures.
binPath <- stageBinPath Stage1 | ||
libPath <- stageLibPath Stage1 | ||
iservPath <- needfile Stage1 iserv | ||
runhaskellPath <- needfile Stage1 runGhc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall iserv
and runGhc
be added to testsuitePackages
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It we need iserv in testsuite packages as we need to build its profiling way.
runGhc is already in stage1 and I dont't think we need to build any other way here. But we can add it just to be sure. What are your suggestions @snowleopard .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The testsuitePackages
should contain all packages required for the testsuite. That's what the name suggests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, I see where the confusion can be coming from. The comment says: "Packages that are built only for the testsuite", but I think it should actually say "Packages that are required for the testsuite".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved. There are still few questions regarding this issue but I think I should create a separate issue for that.
src/Rules/Test.hs
Outdated
|
||
-- Set environment variables for test's Makefile. | ||
liftIO $ do | ||
setEnv "MAKE" makePath | ||
setEnv "TEST_HC" ghcPath | ||
setEnv "TEST_HC_OPTS" ghcFlags | ||
setEnv "CHECK_PPR" checkPprPath | ||
setEnv "CHECK_API_ANNOTATIONS" annotationsPath | ||
|
||
-- Execute the test target. | ||
buildWithCmdOptions env $ target (vanillaContext Stage2 compiler) RunTest [] [] | ||
|
||
-- | Build extra programs required by testsuite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already commented on this: the name needTestsuiteBuilders
is misleading -- this function deals not only with "builders" but also with libraries. It should therefore be renamed, perhaps to needTestsuitePackages
.
src/Rules/Test.hs
Outdated
-- we are going to use, I suppose? | ||
| isLibrary pkg = pkgConfFile (vanillaContext stage pkg) | ||
| otherwise = programPath =<< programContext stage pkg | ||
copyFile iservPath $ libPath -/- "bin/ghc-iserv" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do the copying? We should add a comment here to clarify the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, updating in a revision.
@chitrak7 Thank you! Please see my comments above. |
931ab04
to
a56333e
Compare
@@ -57,21 +57,25 @@ ghcCabalBuilderArgs = mconcat | |||
-- TODO: Isn't vanilla always built? If yes, some conditions are redundant. | |||
-- TODO: Need compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci? | |||
-- TODO: should `elem` be `wayUnit`? | |||
-- This approach still doesn't work. Previously libraries were build only in the | |||
-- Default flavours and not using context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might actually be dead code, since we no longer call ghc-cabal
. Are you sure this function is actually executed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, maybe this is why this approach is not working. Can you please tell me how exactly we are configuring cabal files then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chitrak7 I'll try to find time today to remove dead code. You should look into the module Hadrian.Haskell.Cabal.Parse
.
@snowleopard does ghc always make vanilla? |
@chitrak7 Yes, I think it does. |
@snowleopard I find the logic testsuite uses to find which ways libraries are built quite weak. It simply checks for the presence/absence of PrimoWrappers.hi/dyn_hi/p_hi. Should I use the same logic also?? |
@chitrak7 Why don't you look at the contents of |
Ideally I think we really want to examine the |
@alpmestan As I mentioned elsewhere, I think we might want to add a new build flavour, specifically for the testsuite, listing precisely all the ways that we'd like to test (and therefore build). In other words, the build for testing is different from a usual (default) build: not only we build a different collection of packages, we might also want to specify precisely which ways we want. |
@snowleopard I have added fore features to this PR.
Can you please explain what you mean when you say this. Exactly whose ways are we supposed to look? |
I'm not sure I agree with this. The behaviour of the Make build system here, when you e.g say This by the way does not exclude having a dedicated flavour that just has everything the testsuite needs to run all the tests on a given system. |
@snowleopard I think I agree with Alp on this one. We should instead modify Hadrian to read input test ways and build libraries based on them. This is what I was trying to fix through when I encountered #626. Aside from that, I favor using input flavors and build flavors to build libraries instead of checking the libraries we have already installed. |
@snowleopard I think I am finished with major part of this issue. I will handle library ways in a later PR. Can you review this one at present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment, but this looks good.
@@ -107,9 +107,10 @@ stage2Packages = return [haddock] | |||
testsuitePackages :: Action [Package] | |||
testsuitePackages = return [ checkApiAnnotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we need to be a lot more careful about those uses of vanillaContext
and default ways for packages etc. Most of the time we just want to follow what libraryWays
and rtsWays
dictate, I think. I'm expecting this single line of work to fix a lot of test failures.
src/Settings/Builders/RunTest.hs
Outdated
withNativeCodeGen <- expr $ fmap stringToBool (testSetting TestGhcWithNativeCodeGen) | ||
withInterpreter <- expr $ fmap stringToBool (testSetting TestGhcWithInterpreter) | ||
unregisterised <- expr $ fmap stringToBool (testSetting TestGhcUnregisterised) | ||
withSMP <- expr $ fmap stringToBool (testSetting TestGhcWithSMP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safe to say that we might want a shorter name for expr $ fmap stringToBool (testSetting ...)
(or just the fmap stringToBool (testSetting ...)
part?) =)
We will need it for properly configuring python command Some revisions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. With two minor comments.
src/Rules/Test.hs
Outdated
ghcPath <- needfile Stage1 ghc | ||
need [ root -/- ghcConfigProgPath] | ||
command [FileStdout $ root -/- ghcConfigPath] (root -/- ghcConfigProgPath) | ||
[ ghcPath ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the variable ghcPath
may be incorrect. In ghc's testsuite/mk/boilerplate.mk
we pass the $(TEST_HC)
as argument to ghc-config
. However in the "test"
rule, we use stage2 compiler as TEST_HC
. I think here the consistency does matter.
Ref: https://github.com/ghc/ghc/blob/master/testsuite/mk/boilerplate.mk#L240
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also, the stage2 compiler is used only. We just build stage2 compiler in stage1 and this is why I have used stage1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In need needTestBuilders
we ensure the stage2 ghc is ready before run test. The stage1 and stage2 compiler are often built in different ways (for example, with or without -prof
). We are testing again the stage2 compiler, I think it does matter to use stage2 compiler to get these test settings (for example, GhcWithInterpreter
, GhcProfiled
and GhcDebugged
).
We just build stage2 compiler in stage1 and this is why I have used stage1.
I think we could needBuilder $ Ghc CompileHs Stage2
in rule root -/- ghcConfigPath
, before executing the ghc-config
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sighingnow when I call needfile Stage1 ghc, I call the path of stage2 compiler only. Now, stage2 compiler is built in _build/stage1/bin/ghc. Hence, I am still pointing to stage2 compiler only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are correct. Thanks for the explanation. I just found that hadrain places the stage2 ghc inside the stage1
folder....
Now this PR looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review @sighingnow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h I just found that hadrain places the stage2 ghc inside the stage1 folder....
Right, because it is built by stage1. It is however indeed confusing at first, but it makes sense to me now.
testRTSSettings :: Action [String] | ||
testRTSSettings = do | ||
file <- testConfigFile | ||
fmap words $ lookupValueOrError file "GhcRTSWays" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the testRTSSettings
is just a case of testSetting
.
How about add a TestGhcRTSWays
constructor to TestSetting
and move the lookupValueOrError file "GhcRTSWays"
part into testSetting
, then the testRTSSettings
will be:
testRTSSettings :: Action [String]
testRTSSettings = words <$> testSetting TestGhcRTSWays
More concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sighingnow I just refrained from using RTSSetting with testSetting because someone might use testSetting instead of testRTSSetting and get errors. I wanted to separate RTSWays completely from testSetting so as no confusion is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks for making this point clear to me.
@alpmestan @chitrak7 OK, you convinced me :) Then, what about producing a file, e.g. |
An alternative is then, which you seem to suggest, is to require the user to run the testsuite with exactly the same flavour as during the build. For example, |
| TestMinGhcVersion801 | ||
deriving (Show) | ||
|
||
-- | Lookup for testsettings in ghcconfig file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide the full path to the ghcconfig
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snowleopard Why do we need the full path. The provided path is relative to buildroot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm referring to the comment. You should keep in mind the readers that have no idea what this code is supposed to do. The full path will be helpful for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
src/Rules/Test.hs
Outdated
-- | Using program shipped with testsuite to generate ghcconfig file. | ||
root -/- ghcConfigProgPath ~> do | ||
ghc <- builderPath $ Ghc CompileHs Stage0 | ||
command [] ghc [ghcConfigHsPath, "-o" , root -/- ghcConfigProgPath] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you switch to using cmd
instead of command
as in the rest of Hadrian?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/Rules/Test.hs
Outdated
targets <- mapM (needfile Stage1) =<< testsuitePackages | ||
-- | Build extra programs and libraries required by testsuite | ||
needTestsuiteLibraries :: Action () | ||
needTestsuiteLibraries = do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But needTestsuiteLibraries
is as misleading as needTestsuiteBuilders
!
Why not needTestsuitePackages
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
import Hadrian.Oracles.TextFile | ||
import Base | ||
|
||
testConfigFile :: Action FilePath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to add more comments here about the purpose of this module.
Please describe the purpose of the file test/ghcconfig
, give a couple of examples of the settings that you read from it, and how they are used by the testsuite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resloved
@chitrak7 I've added a couple of more comments. Please have a look. |
Right. Or really you'd just do One reason why I think this works rather nicely is that this is the most flexible approach. I see two alternatives. The first one, at the opposite end of the spectrum, is to just require all the ways of everything to be built before we can run any test. This is annoying as it will significantly increase the duration of the build. The other one, sitting in the middle, is only conceptual but is the best one. It'd consist in building just what we need for just those tests the user is asking to run (as determined by command line options etc). However the testsuite doesn't really give us a way to discover this ahead of time, as far as I know. I mean, we could scan the .T files and try to inspect the source code to figure some things out but... I don't think we want to do this :-) So I think it's a good choice to let users specify a flavour that's compatible with the tests they want to run. Now... in this scheme that I'm suggesting, what if we call the |
@alpmestan Yes, I agree, this looks like the right approach indeed.
Hmm, are you sure the rebuilds won't happen? We track all command line arguments, so if changing the flavour means a command line changes (e.g. you add |
I agree with this idea. |
@snowleopard I'm not entirely sure, and I'm in the middle of something right now so I can't really give it a shot.
@sighingnow Right. I'll be happy as long as I can start from a fresh source tree and just call Note that this is the default behaviour of |
src/Settings/Builders/Ghc.hs
Outdated
@@ -79,6 +79,7 @@ commonGhcArgs = do | |||
, arg "-hcsuf", arg $ hcsuf way | |||
, wayGhcArgs | |||
, packageGhcArgs | |||
, arg "-lnuma" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snowleopard I incurred an error which I think is due to #559 and added an additional flag to resolve this. I accidentally committed the change but think might be helpful. Should I remove the argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't add such flags unconditionally. Better do this in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
src/Settings/Builders/Ghc.hs
Outdated
@@ -79,6 +79,7 @@ commonGhcArgs = do | |||
, arg "-hcsuf", arg $ hcsuf way | |||
, wayGhcArgs | |||
, packageGhcArgs | |||
, arg "-lnuma" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be dependent on whether we enable NUMA support in ./configure
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I supplied no such flag, neither is there any such flag with configure script help. I think it is default setting. Reverting this change and looking further into the matter.
OK, looks like all comments have been addressed. Shall I merge this? |
@alpmestan @snowleopard Is this pull ready to land. |
@chitrak7 Merged, thanks! |
I have copied some files as required by testsuite.
Also, I have unsuccessfully attempted to resolve #626.
@sighingnow @snowleopard @alpmestan