UnkindPartition / tasty

Modern and extensible testing framework for Haskell
640 stars 110 forks source link

Build failure in v0.12.0.1 with GHC 7.4.2 #321

Closed sjakobi closed 2 years ago

sjakobi commented 2 years ago
Test/Tasty/Run.hs:159:14:
    No instance for (Applicative (WriterT (First SomeException) IO))
      arising from a use of `F.foldMap'
    Possible fix:
      add an instance declaration for
      (Applicative (WriterT (First SomeException) IO))
    In the first argument of `flip', namely `F.foldMap'
    In the expression: flip F.foldMap fins
    In the second argument of `($)', namely
      `flip F.foldMap fins
       $ \ (Finalizer doRelease initVar finishVar)
           -> Traversal
              $ do { iAmLast <- liftIO $ atomically $ do { ... };
                     mbExcn <- liftIO
                               $ if iAmLast then join $ atomically $ ... else return Nothing;
                     .... }'

Test/Tasty/Run.hs:204:7:
    No instance for (Applicative
                       (WriterT
                          ([((Seq.Seq Initializer, Seq.Seq Finalizer) -> IO (),
                             TVar Status)],
                           [ResourceVar])
                          IO))
      arising from a use of `foldTestTree'
    Possible fix:
      add an instance declaration for
      (Applicative
         (WriterT
            ([((Seq.Seq Initializer, Seq.Seq Finalizer) -> IO (),
               TVar Status)],
             [ResourceVar])
            IO))
    In the expression:
      foldTestTree
        (trivialFold
           {foldSingle = runSingleTest, foldResource = addInitAndRelease})
        opts0
        tree
    In an equation for `traversal':
        traversal
          = foldTestTree
              (trivialFold
                 {foldSingle = runSingleTest, foldResource = addInitAndRelease})
              opts0
              tree
    In the expression:
      do { let traversal ::
                 Traversal (WriterT ([(InitFinPair -> IO (), TVar Status)],
                                     [ResourceVar]) IO)
               traversal = foldTestTree (...) opts0 tree;
           (tests, rvars) <- unwrap traversal;
           let tests' = map (first ($ ...)) tests;
           return (tests', rvars) }

I've encountered this issue in CI for prettyprinter: https://github.com/quchen/prettyprinter/runs/4704432962?check_suite_focus=true

Unfortunately I haven't been able to reproduce the issue locally so far, because my version of ghc-7.4.2 segfaults while building the text and generic-deriving dependencies.

sjakobi commented 2 years ago

I have found a good build plan for the same version though:

$ cabal install tasty-0.12.0.1 -w ghc-7.4.2 --constraint 'text < 0'
Resolving dependencies...
Build profile: -w ghc-7.4.2 -O1
In order, the following will be built (use -v for more details):
 - ansi-terminal-0.9.1 (lib) (requires build)
 - nats-0.1.3 (lib) (requires download & build)
 - stm-2.4.5.1 (lib) (requires build)
 - transformers-0.5.6.2 (lib:transformers) (requires build)
 - semigroups-0.9.2 (lib) (requires download & build)
 - async-2.1.1.1 (lib) (requires download & build)
 - transformers-compat-0.5.1.4 (lib) (requires build)
 - mtl-2.2.2 (lib) (requires build)
 - ansi-wl-pprint-0.6.8.2 (lib) (requires build)
 - tagged-0.8.6.1 (lib) (requires build)
 - regex-base-0.93.2 (lib:regex-base) (requires build)
 - parsec-3.1.1 (lib:parsec) (requires download & build)
 - optparse-applicative-0.12.1.0 (lib) (requires build)
 - regex-tdfa-1.2.2 (lib:regex-tdfa) (requires build)
 - tasty-0.12.0.1 (lib) (requires build)
...

Maybe the build failure is related to some change in transformers-0.6?!

sjakobi commented 2 years ago

Actually I can reproduce the build failure with mtl < 2:

$ cabal install tasty -w ghc-7.4.2 --constraint 'text < 0' --constraint 'mtl < 2'
...
Test/Tasty/Run.hs:159:14:
    No instance for (Applicative (WriterT (First SomeException) IO))
      arising from a use of `F.foldMap'
    Possible fix:
      add an instance declaration for
      (Applicative (WriterT (First SomeException) IO))
    In the first argument of `flip', namely `F.foldMap'
    In the expression: flip F.foldMap fins
    In the second argument of `($)', namely
      `flip F.foldMap fins
       $ \ (Finalizer doRelease initVar finishVar)
           -> Traversal
              $ do { iAmLast <- liftIO $ atomically $ do { ... };
                     mbExcn <- liftIO
                               $ if iAmLast then join $ atomically $ ... else return Nothing;
                     .... }'

Test/Tasty/Run.hs:204:7:
    No instance for (Applicative
                       (WriterT
                          ([((Seq.Seq Initializer, Seq.Seq Finalizer) -> IO (),
                             TVar Status)],
                           [ResourceVar])
                          IO))
      arising from a use of `foldTestTree'
    Possible fix:
      add an instance declaration for
      (Applicative
         (WriterT
            ([((Seq.Seq Initializer, Seq.Seq Finalizer) -> IO (),
               TVar Status)],
             [ResourceVar])
            IO))
    In the expression:
      foldTestTree
        (trivialFold
           {foldSingle = runSingleTest, foldResource = addInitAndRelease})
        opts0
        tree
    In an equation for `traversal':
        traversal
          = foldTestTree
              (trivialFold
                 {foldSingle = runSingleTest, foldResource = addInitAndRelease})
              opts0
              tree
    In the expression:
      do { let traversal ::
                 Traversal (WriterT ([(InitFinPair -> IO (), TVar Status)],
                                     [ResourceVar]) IO)
               traversal = foldTestTree (...) opts0 tree;
           (tests, rvars) <- unwrap traversal;
           let tests' = map (first ($ ...)) tests;
           return (tests', rvars) }
cabal: Failed to build tasty-0.12.0.1.

With mtl-2.0.0.0 I also get a build error:

$ cabal install tasty -w ghc-7.4.2 --constraint 'text < 0' --constraint 'mtl == 2.0.0.0'
Test/Tasty/Ingredients/ConsoleReporter.hs:27:42:
    Module `Control.Monad.Reader' does not export `reader'
cabal: Failed to build tasty-0.12.0.1. 
sjakobi commented 2 years ago

A few other versions seem to be affected similarly:

$ trustee get tasty
$ trustee --constraint 'text < 0' --constraint 'mtl < 2.0.1.0' --constraint 'generic-deriving < 0' --ghcs '==7.4.2' matrix *
                7.4.2
tasty-1.4.2.1   NO-IP
tasty-1.4.2     NO-IP
tasty-1.4.1     NO-IP
tasty-1.4.0.3   NO-IP
tasty-1.4.0.2   NO-IP
tasty-1.4.0.1   NO-IP
tasty-1.4       NO-IP
tasty-1.3.1     NO-IP
tasty-1.3       NO-IP
tasty-1.2.3     NO-IP
tasty-1.2.2     NO-IP
tasty-1.2.1     NO-IP
tasty-1.2       NO-IP
tasty-1.1.0.4   NO-IP
tasty-1.1.0.3   NO-IP
tasty-1.1.0.2   NO-IP
tasty-1.1.0.1   NO-IP
tasty-1.1       NO-IP
tasty-1.0.1.1   NO-IP
tasty-1.0.1     NO-IP
tasty-1.0.0.1   NO-IP
tasty-1.0       NO-IP
tasty-0.12.0.1  FAIL 
tasty-0.12      FAIL 
tasty-0.11.3    FAIL 
tasty-0.11.2.5  FAIL 
tasty-0.11.2.4  NO-IP
tasty-0.11.2.3  FAIL 
tasty-0.11.2.2  FAIL 
tasty-0.11.2.1  FAIL 
tasty-0.11.2    FAIL 
tasty-0.11.1    FAIL 
tasty-0.11.0.4  FAIL 
tasty-0.11.0.3  FAIL 
tasty-0.11.0.2  FAIL 
tasty-0.11.0.1  FAIL 
tasty-0.11      FAIL 
tasty-0.10.1.2  FAIL 
tasty-0.10.1.1  FAIL 
tasty-0.10.1    FAIL 
tasty-0.10.0.4  FAIL 
tasty-0.10.0.3  FAIL 
tasty-0.10.0.2  FAIL 
tasty-0.10.0.1  FAIL 
tasty-0.10      FAIL 
tasty-0.9.0.1   FAIL 
tasty-0.8.1.3   OK   
tasty-0.8.1.2   OK   
tasty-0.8.1.1   OK   
tasty-0.8.0.4   OK   
tasty-0.8.0.2   OK   
tasty-0.8       OK   
tasty-0.7       OK   
tasty-0.6       OK   
tasty-0.5.2.1   OK   
tasty-0.5.2     OK   
tasty-0.5.1     OK   
tasty-0.5       OK   
tasty-0.4.2     OK   
tasty-0.4.1.1   OK   
tasty-0.4.0.1   OK   
tasty-0.4       OK   
tasty-0.3.1     OK   
tasty-0.3       OK   
tasty-0.2       OK   
tasty-0.1.1     OK   
tasty-0.1       OK   

As a Hackage trustee I have created a revisions for the affected versions that should prevent users from encountering these build errors. See e.g. https://hackage.haskell.org/package/tasty-0.12.0.1/revisions/.