Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

downstream failure in test cases for STAN-0204 and STAN-0205 #409

Open
maralorn opened this issue Nov 19, 2020 · 1 comment
Open

downstream failure in test cases for STAN-0204 and STAN-0205 #409

maralorn opened this issue Nov 19, 2020 · 1 comment
Labels
question Further information is requested

Comments

@maralorn
Copy link

Hey!

I am trying to get stan tests running in nixpkgs. As dependencies we use stackage-nightly + newest versions from hackage if not on stackage. This conforms to the cabal bounds given in stan.cabal (with exception of pretty-simple (see #408), if that's the culprit I am very sorry, but it seems unlikely.)
I get the following test error, which does not happen in your CI:

    ObservationId is properly ignored

Failures:

  test/Test/Stan/Analysis/Common.hs:62:5:
  1) Static Analysis, Anti-patterns, STAN-0204: finds usage of 'Data.HashMap.size'
       expected: Just (Observation {observationId = Id {unId = "OBS-STAN-0204-wu5bTi-28:19"}, observationInspectionId = Id {unId = "STAN-0204"}, observationSrcSpan = SrcSpanOneLine "target/Target/AntiPattern.hs" 28 19 26, observationFile = "target/Target/AntiPattern.hs", observationModuleName = ModuleName {unModuleName = "Target.AntiPattern"}, observationFileContent = ""})
        but got: Nothing

  To rerun use: --match "/Static Analysis/Anti-patterns/STAN-0204: finds usage of 'Data.HashMap.size'/"

  test/Test/Stan/Analysis/Common.hs:62:5:
  2) Static Analysis, Anti-patterns, STAN-0204: finds usage of 'length' for 'HashMap'
       expected: Just (Observation {observationId = Id {unId = "OBS-STAN-0204-wu5bTi-31:21"}, observationInspectionId = Id {unId = "STAN-0204"}, observationSrcSpan = SrcSpanOneLine "target/Target/AntiPattern.hs" 31 21 27, observationFile = "target/Target/AntiPattern.hs", observationModuleName = ModuleName {unModuleName = "Target.AntiPattern"}, observationFileContent = ""})
        but got: Nothing

  To rerun use: --match "/Static Analysis/Anti-patterns/STAN-0204: finds usage of 'length' for 'HashMap'/"

  test/Test/Stan/Analysis/Common.hs:62:5:
  3) Static Analysis, Anti-patterns, STAN-0205: finds usage of 'Data.HashSet.size'
       expected: Just (Observation {observationId = Id {unId = "OBS-STAN-0205-wu5bTi-34:19"}, observationInspectionId = Id {unId = "STAN-0205"}, observationSrcSpan = SrcSpanOneLine "target/Target/AntiPattern.hs" 34 19 26, observationFile = "target/Target/AntiPattern.hs", observationModuleName = ModuleName {unModuleName = "Target.AntiPattern"}, observationFileContent = ""})
        but got: Nothing

  To rerun use: --match "/Static Analysis/Anti-patterns/STAN-0205: finds usage of 'Data.HashSet.size'/"

  test/Test/Stan/Analysis/Common.hs:62:5:
  4) Static Analysis, Anti-patterns, STAN-0205: finds usage of 'length' for 'HashSet'
       expected: Just (Observation {observationId = Id {unId = "OBS-STAN-0205-wu5bTi-37:21"}, observationInspectionId = Id {unId = "STAN-0205"}, observationSrcSpan = SrcSpanOneLine "target/Target/AntiPattern.hs" 37 21 27, observationFile = "target/Target/AntiPattern.hs", observationModuleName = ModuleName {unModuleName = "Target.AntiPattern"}, observationFileContent = ""})
        but got: Nothing

  To rerun use: --match "/Static Analysis/Anti-patterns/STAN-0205: finds usage of 'length' for 'HashSet'/"

Randomized with seed 1738248362

Any insight into what could be going wrong would be highly appreciated.

@chshersh chshersh added the question Further information is requested label Nov 20, 2020
@chshersh
Copy link
Contributor

Hi @maralorn! Most likely the reason for this error is the fact that the name of the unordered-containers package is not mentioned in the HIE files. Turns out, different build tools change package names on different systems using different tricks to satisfy the file path limit. Moreover, GHC itself allows registering packages under arbitrary names.

We've implemented several hacks to support as many standard use cases as possible:

isExternalName name
&& occName == nameMetaName
&& moduleName == nameMetaModuleName
&& ( nameMetaPackage `T.isPrefixOf` package
-- Cabal hack they made for MacOS. For now, we check for all platforms.
-- See this issue for more info: https://github.com/kowainik/stan/issues/240
|| withoutVowels nameMetaPackage `T.isPrefixOf` package
-- Cabal hack they made for Windows. For now, we check for all platforms
-- See this issue for more info: https://github.com/kowainik/stan/issues/274
|| truncatedWindows nameMetaPackage `T.isPrefixOf` package
)

But I'm personally not on NixOS and I don't use Nix to build Haskell packages, so I can't debug the issue by myself. My guess would be is that Nix doesn't mention the package name at all when registering dependencies. But to be sure, one must debug the content of HIE files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants