Skip to content

Commit

Permalink
GHC 9.8 compat: update hashes of data structures as computed by Struc…
Browse files Browse the repository at this point in the history
…tured

It seems, GHC 9.8 changed something in the code generation for data types.
Structured class is supposed to catch such cases.
  • Loading branch information
ulysses4ever committed Nov 29, 2023
1 parent 436784b commit 33ac8dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ tests = testGroup "Distribution.Utils.Structured"
, testCase "SPDX.License" $
md5Check (Proxy :: Proxy License) 0xd3d4a09f517f9f75bc3d16370d5a853a
-- The difference is in encoding of newtypes
#if MIN_VERSION_base(4,7,0)
#if MIN_VERSION_base(4,19,0)
, testCase "GenericPackageDescription" $
md5Check (Proxy :: Proxy GenericPackageDescription) 0xf5fdb32b43aca790192f44d9ecaa9689
, testCase "LocalBuildInfo" $
md5Check (Proxy :: Proxy LocalBuildInfo) 0x205fbe2649bc5e488bce50c07a71cadb
#elif MIN_VERSION_base(4,7,0)
, testCase "GenericPackageDescription" $
md5Check (Proxy :: Proxy GenericPackageDescription) 0xb287a6f04e34ef990cdd15bc6cb01c76
, testCase "LocalBuildInfo" $
Expand Down
18 changes: 16 additions & 2 deletions cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE CPP #-}

module UnitTests.Distribution.Client.FileMonitor (tests) where

import Distribution.Parsec (simpleParsec)
Expand Down Expand Up @@ -31,8 +33,8 @@ tests mtimeChange =
[ testGroup
"Structured hashes"
[ testCase "MonitorStateFile" $ structureHash (Proxy :: Proxy MonitorStateFile) @?= Fingerprint 0xe4108804c34962f6 0x06e94f8fc9e48e13
, testCase "MonitorStateGlob" $ structureHash (Proxy :: Proxy MonitorStateGlob) @?= Fingerprint 0xfd8f6be0e8258fe7 0xdb5fac737139bca6
, testCase "MonitorStateFileSet" $ structureHash (Proxy :: Proxy MonitorStateFileSet) @?= Fingerprint 0xb745f4ea498389a5 0x70db6adb5078aa27
, testCase "MonitorStateGlob" $ structureHash (Proxy :: Proxy MonitorStateGlob) @?= Fingerprint fingerprintStateGlob1 fingerprintStateGlob2
, testCase "MonitorStateFileSet" $ structureHash (Proxy :: Proxy MonitorStateFileSet) @?= Fingerprint fingerprintStateFileSet1 fingerprintStateFileSet2
]
, testCase "sanity check mtimes" $ testFileMTimeSanity mtimeChange
, testCase "sanity check dirs" $ testDirChangeSanity mtimeChange
Expand Down Expand Up @@ -85,6 +87,18 @@ tests mtimeChange =
knownBrokenInWindows msg = case buildOS of
Windows -> expectFailBecause msg
_ -> id
fingerprintStateGlob1, fingerprintStateGlob2, fingerprintStateFileSet1, fingerprintStateFileSet2 :: Word64
#if MIN_VERSION_base(4,19,0)
fingerprintStateGlob1 = 0xae70229aabb1ba1f
fingerprintStateGlob2 = 0xb53ed324c96f0d0d
fingerprintStateFileSet1 = 0x8e509e16f973e036
fingerprintStateFileSet2 = 0xa23f21d8dc8a2dee
#else
fingerprintStateGlob1 = 0xfd8f6be0e8258fe7
fingerprintStateGlob2 = 0xdb5fac737139bca6
fingerprintStateFileSet1 = 0xb745f4ea498389a5
fingerprintStateFileSet2 = 0x70db6adb5078aa27
#endif

-- Check the file system behaves the way we expect it to

Expand Down

0 comments on commit 33ac8dd

Please sign in to comment.