Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Getting information of input test compiler #639

Closed
wants to merge 1 commit into from

Conversation

chitrak7
Copy link
Contributor

Earlier, we would get configuration from stage2 compiler irrespective of the test compiler in the input . This PR fixes this.

Copy link
Owner

@snowleopard snowleopard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chitrak7 Many thanks! Looks good to me in general, but I've added some comments.

compilerPath $ testCompiler args

-- | Set Test Compiler
compilerPath :: String -> Action FilePath
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unhappy about using strings here. Could the first argument be turned into a Stage, ideally during parsing of test arguments?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I suppose this could be turned into compilerPath :: Either Stage FilePath -> Action FilePath ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alpmestan Indeed, I missed the last case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alpmestan @snowleopard The input still will be a string. I will need to change command line input type as well, but I don't think we will get any major benefit from this, but needlessly complicate the code.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chitrak7 The benefit is in keeping parsing, string manipulation and associated errors in one place. The rest of the codebase should preferably be strongly typed.

root -/- ghcConfigPath ~> do
ghcPath <- needfile Stage1 ghc
ghcPath <- getCompiler
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange whitespace

@@ -17,6 +16,7 @@ oneZero lbl True = lbl ++ "=1"
stringToBool :: String -> Bool
stringToBool "YES" = True
stringToBool "NO" = False
stringToBool _ = error "Cannot parse string"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename this function to something more obvious, e.g. parseYesNo? Also I would prefer to make it type safe by returning Maybe Bool and handling possible failures at the use site.

Also, note that we already have something like this here:

https://github.com/snowleopard/hadrian/blob/master/src/Oracles/Flag.hs#L39-L40

As you can see, handling such errors at the use site allows for more informative error messages.

Copy link
Collaborator

@alpmestan alpmestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With:

needTestBuilders :: Action ()
needTestBuilders = do
    needBuilder $ Ghc CompileHs Stage2
    needBuilder $ GhcPkg Update Stage1
    needBuilder Hpc
    needBuilder (Hsc2Hs Stage1)
    timeoutProgBuilder
    needTestsuitePackages

still there, this means this patch is not done yet right? Because we likely want to need whatever the test compiler requires, no? Instead of Ghc CompileHs Stage2, GhcPkg Update Stage1, etc.

compilerPath $ testCompiler args

-- | Set Test Compiler
compilerPath :: String -> Action FilePath
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I suppose this could be turned into compilerPath :: Either Stage FilePath -> Action FilePath ?

@snowleopard
Copy link
Owner

@chitrak7 Are you planning to complete this PR?

@snowleopard
Copy link
Owner

I think we should close this PR. It has fallen behind GHC development.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants