haskell / random

Random number library
Other
53 stars 50 forks source link

Test failures (legacy-test, spec-introspection) #163

Closed Vekhir closed 7 months ago

Vekhir commented 7 months ago

Hi, when building random 1.2.1.1 with GHC 9.6.3 or 9.8.1 on Arch Linux, both the legacy-test and the spec-inspection tests fail.

Edit: Both issues are fixed on master and can be ignored. See comments for details.

Perhaps you have an idea, especially with respect to legacy-test. I'll keep you posted.

Appendix

legacy-test

Test suite legacy-test: RUNNING...
Int:  Passed
Integer:  Passed
Int8:  Passed
Int16:  Passed
Int32:  Passed
Int64:  Passed
Word:  Passed
Word8:  Passed
Word16:  Passed
Word32:  Passed
Word64:  Passed
Double:  Passed
Float:  legacy-test: Heap exhausted;
legacy-test: Current maximum heap size is 8388608 bytes (8 MB).
legacy-test: Relink with -rtsopts and use `+RTS -M<size>' to increase it.
Test suite legacy-test: FAIL

spec-inspection

Test suite spec-inspection: RUNNING...
InspectionSpec
  Inspection
    uniform_Word8
      uses none of StateGenM:                                     OK
      mentions none of V1, U1, M1, K1, :+:, :*:, :.:, Rec1, Par1: OK
      does not contain dictionary values:                         OK
    uniform_Int8
      uses none of StateGenM:                                     OK
      mentions none of V1, U1, M1, K1, :+:, :*:, :.:, Rec1, Par1: OK
      does not contain dictionary values:                         OK
    uniform_Char
      uses none of StateGenM:                                     OK
      mentions none of V1, U1, M1, K1, :+:, :*:, :.:, Rec1, Par1: OK
      does not contain dictionary values:                         OK
    uniform_MyAction
      uses none of StateGenM:                                     OK
      mentions none of V1, U1, M1, K1, :+:, :*:, :.:, Rec1, Par1: FAIL
        uniform_MyAction :: (MyAction, StdGen)
        uniform_MyAction
          = case $wgo 9297814886316923340#Word64 13679457532755275413#Word64
            of
            { (# ww, ww, ww #) ->
            (let {
               a1 :: Integer
               a1 = integerFromWord64# ww } in
             join {
               $j_srOG :: MyAction
               $j_srOG
                 = let {
                     n :: Integer
                     n = integerSub a1 lvl_srEP } in
                   join {
                     $j_srOa :: MyAction
                     $j_srOa
                       = Eat
                           (case integerShiftR# n 1## of {
                              IS x1 ->
                                case <# x1 1# of {
                                  __DEFAULT -> True;
                                  1# -> False
                                };
                              IP x1 -> True;
                              IN x1 -> False
                            },
                            case integerAnd n lvl_srER of {
                              IS x1 ->
                                case <# x1 1# of {
                                  __DEFAULT -> True;
                                  1# -> False
                                };
                              IP x1 -> True;
                              IN x1 -> False
                            }) } in
                   case n of {
                     IS x1 ->
                       case <# x1 4# of {
                         __DEFAULT -> lvl_srYL;
                         1# -> jump $j_srOa
                       };
                     IP x1 -> lvl_srYL;
                     IN x1 -> jump $j_srOa
                   } } in
             join {
               $j_srOH :: MyAction
               $j_srOH
                 = join {
                     $j_srOd :: MyAction
                     $j_srOd
                       = Code
                           (join {
                              $j :: Maybe Bool
                              $j
                                = Just
                                    (case integerSub a1 lvl_srER of {
                                       IS x1 ->
                                         case <# x1 1# of {
                                           __DEFAULT -> True;
                                           1# -> False
                                         };
                                       IP x1 -> True;
                                       IN x1 -> False
                                     }) } in
                            case a1 of {
                              IS x1 ->
                                case <# x1 1# of {
                                  __DEFAULT -> jump $j;
                                  1# -> Nothing
                                };
                              IP x1 -> jump $j;
                              IN x1 -> Nothing
                            }) } in
                   case a1 of {
                     IS x1 ->
                       case <# x1 3# of {
                         __DEFAULT -> lvl_srYJ;
                         1# -> jump $j_srOd
                       };
                     IP x1 -> lvl_srYJ;
                     IN x1 -> jump $j_srOd
                   } } in
             case a1 of {
               IS x1 ->
                 case <# x1 3# of {
                   __DEFAULT -> jump $j_srOG;
                   1# -> jump $j_srOH
                 };
               IP x1 -> jump $j_srOG;
               IN x1 -> jump $j_srOH
             },
             (SMGen ww ww) `cast` <Co:2> :: ...)
            }

        $wgo :: Word64# -> Word64# -> (# Word64#, Word64#, Word64# #)
        $wgo
          = \ (ww :: Word64#) (ww :: Word64#) ->
              let {
                seed' :: Word64#
                seed' = plusWord64# ww ww } in
              let {
                x# :: Word64#
                x#
                  = timesWord64#
                      (xor64# seed' (uncheckedShiftRL64# seed' 33#))
                      18397679294719823053#Word64 } in
              let {
                x#1 :: Word64#
                x#1
                  = timesWord64#
                      (xor64# x# (uncheckedShiftRL64# x# 33#))
                      14181476777654086739#Word64 } in
              let {
                x'_srO7 :: Word64#
                x'_srO7
                  = and64# (xor64# x#1 (uncheckedShiftRL64# x#1 33#)) 7#Word64 } in
              case gtWord64# x'_srO7 7#Word64 of {
                __DEFAULT -> (# x'_srO7, seed', ww #);
                1# -> $wgo seed' ww
              }

        lvl_srXN :: Addr#
        lvl_srXN = "error"#

        lvl_srXO :: [Char]
        lvl_srXO = unpackCString# lvl_srXN

        lvl_srXP :: Addr#
        lvl_srXP = "random-1.2.1.1-2Xbbyxsliyc8khkzietheX"#

        lvl_srXQ :: [Char]
        lvl_srXQ = unpackCString# lvl_srXP

        lvl_srXR :: Addr#
        lvl_srXR = "System.Random.GFinite"#

        lvl_srXS :: [Char]
        lvl_srXS = unpackCString# lvl_srXR

        lvl_srXT :: Addr#
        lvl_srXT = "src/System/Random/GFinite.hs"#

        lvl_srXU :: [Char]
        lvl_srXU = unpackCString# lvl_srXT

        lvl_srXV :: Int
        lvl_srXV = I# 118#

        lvl_srXW :: Int
        lvl_srXW = I# 23#

        lvl_srXY :: Int
        lvl_srXY = I# 28#

        lvl_srXZ :: SrcLoc
        lvl_srXZ
          = SrcLoc
              lvl_srXQ lvl_srXS lvl_srXU lvl_srXV lvl_srXW lvl_srXV lvl_srXY

        lvl_srY0 :: CallStack
        lvl_srY0 = PushCallStack lvl_srXO lvl_srXZ EmptyCallStack

        lvl_srY1 :: Addr#
        lvl_srY1 = "GFinite: V1 has no inhabitants"#

        lvl_srY2 :: [Char]
        lvl_srY2 = unpackCString# lvl_srY1

        lvl_srIb
          :: M1
               C
               ('MetaCons "Never" 'PrefixI 'False)
               (S1
                  ('MetaSel
                     'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy)
                  (Rec0 Void))
               Any
        lvl_srIb
          = case error (lvl_srY0 `cast` <Co:4> :: ...) lvl_srY2 of wild_00 {
            }

        lvl_srEP :: Integer
        lvl_srEP = IS 3#

        lvl_srER :: Integer
        lvl_srER = IS 1#

        lvl_srYJ :: MyAction
        lvl_srYJ = Never (lvl_srIb `cast` <Co:43> :: ...)

        lvl_srYL :: MyAction
        lvl_srYL = Sleep ()

        Use -p '/uniform_MyAction.mentions none of V1, U1, M1, K1, :+:, :*:, :.:, Rec1, Par1/' to rerun this test only.
Shimuuar commented 7 months ago

I just checked master. Yes spec-inspection fails with GHC 9.6.3 and random 1.2.1.1 from hackage. master is fine though. I didn't look any further

P.S. It looks like we miss tag for 1.2.1.1

lehins commented 7 months ago

master is fine though. I didn't look any further

Yes, legacy-tests have been fixed with newer ghc. You just need to increase the limit a little: https://github.com/haskell/random/blob/623cf518c6bc4c1de6a4d59b43c3ae37fcb22a35/random.cabal#L119

With respect to spec-inspection, I have no clue how it all works, but @Bodigrim will.

It looks like we miss tag for 1.2.1.1

No we are not. Here it is: https://github.com/haskell/random/tree/v1.2.1.1

Bodigrim commented 7 months ago

For inspection tests see https://github.com/haskell/random/commit/c39a647a5ede9546a5c17d0e20cae2af0a71c625. Yes, the released package will fail the test, but it's inconsequential.

Vekhir commented 7 months ago

Would you consider a point release with the test fixes? I.e. https://github.com/haskell/random/commit/c39a647a5ede9546a5c17d0e20cae2af0a71c625 and https://github.com/haskell/random/commit/425ca9af3498edd81aa5243dfc4643332b09055e. I realize them failing doesn't mean anything, but speaking from Arch's perspective (with build automation), I'd rather not disable the tests because of it. The next best thing would be carrying the patches separately on our end, not ideal, but workable. What do you think?

Bodigrim commented 7 months ago

(I personally have no capacity to make a release at the moment)

lehins commented 7 months ago

I can try doing that over the weekend.

lehins commented 7 months ago

Released random-1.2.1.2

Vekhir commented 7 months ago

Thanks for your time! The release is much appreciated