Skip to content

Commit

Permalink
CI: add GHC 9.10 (haskell#9914)
Browse files Browse the repository at this point in the history
* CI: add GHC 9.10

* GHC 9.10 compat in testsuite: CPP symbols don't get passed to CC as
eagearly

Discussion: haskell#9914 (comment)

Related GHC issue: https://gitlab.haskell.org/ghc/ghc/-/issues/21291

* GHC 9.10 compat in tests: disable tests regressing due to haskell#9940
  • Loading branch information
ulysses4ever authored May 29, 2024
1 parent 88c81c9 commit 3a8c69c
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
# If you remove something from here, then add it to the old-ghcs job.
# Also a removed GHC from here means that we are actually dropping
# support, so the PR *must* have a changelog entry.
ghc: ['9.8.2', '9.6.4', '9.4.8', '9.2.8', '9.0.2', '8.10.7', '8.8.4', '8.6.5']
ghc: ['9.10.1', '9.8.2', '9.6.4', '9.4.8', '9.2.8', '9.0.2', '8.10.7', '8.8.4', '8.6.5']
exclude:
# corrupts GHA cache or the fabric of reality itself, see https://github.com/haskell/cabal/issues/8356
- os: windows-latest
Expand Down Expand Up @@ -104,6 +104,7 @@ jobs:
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133
ghcup-release-channel: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml

# See the following link for a breakdown of the following step
# https://github.com/haskell/actions/issues/7#issuecomment-745697160
Expand Down
7 changes: 6 additions & 1 deletion cabal-install/src/Distribution/Client/TargetSelector.hs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ import Control.Arrow ((&&&))
import Control.Monad hiding
( mfilter
)
#if MIN_VERSION_base(4,20,0)
import Data.Functor as UZ (unzip)
#else
import qualified Data.List.NonEmpty as UZ (unzip)
#endif
import Data.List
( stripPrefix
)
Expand Down Expand Up @@ -585,7 +590,7 @@ resolveTargetSelector knowntargets@KnownTargets{..} mfilter targetStrStatus =

classifyMatchErrors errs
| Just expectedNE <- NE.nonEmpty expected =
let (things, got :| _) = NE.unzip expectedNE
let (things, got :| _) = UZ.unzip expectedNE
in TargetSelectorExpected targetStr (NE.toList things) got
| not (null nosuch) =
TargetSelectorNoSuch targetStr nosuch
Expand Down
6 changes: 4 additions & 2 deletions cabal-install/tests/IntegrationTests2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1438,9 +1438,11 @@ testSetupScriptStyles config reportSubCase = do

let isOSX (Platform _ OSX) = True
isOSX _ = False
compilerVer = compilerVersion (pkgConfigCompiler sharedConfig)
-- Skip the Custom tests when the shipped Cabal library is buggy
unless (isOSX (pkgConfigPlatform sharedConfig)
&& compilerVersion (pkgConfigCompiler sharedConfig) < mkVersion [7,10]) $ do
unless ((isOSX (pkgConfigPlatform sharedConfig) && (compilerVer < mkVersion [7,10]))
-- 9.10 ships Cabal 3.12.0.0 affected by #9940
|| (mkVersion [9,10] <= compilerVer && compilerVer < mkVersion [9,11])) $ do

(plan1, res1) <- executePlan plan0
pkg1 <- expectPackageInstalled plan1 res1 pkgidA
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE LambdaCase #-}

module UnitTests.Distribution.Client.Init.NonInteractive
Expand All @@ -12,7 +13,9 @@ import UnitTests.Distribution.Client.Init.Utils
import qualified Data.List.NonEmpty as NEL
import qualified Distribution.SPDX as SPDX

#if !MIN_VERSION_base(4,20,0)
import Data.List (foldl')
#endif
import qualified Data.Set as Set
import Distribution.CabalSpecVersion
import Distribution.Client.Init.Defaults
Expand Down
8 changes: 0 additions & 8 deletions cabal-testsuite/PackageTests/CCompilerOverride/foo.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@

#ifndef NOERROR1
#error "NOERROR1 was not passed"
#endif

#ifndef NOERROR2
#error "NOERROR2 was not passed"
#endif

#ifndef NOERROR3
#error "NOERROR3 was not passed"
#endif

#ifndef NOERROR4
#error "NOERROR4 was not passed"
#endif
Expand Down
2 changes: 1 addition & 1 deletion cabal-testsuite/PackageTests/CCompilerOverride/my.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ executable foo
main-is: Main.hs
c-sources: foo.c
build-depends: base
ghc-options: -DNOERROR4
ghc-options: -optc=-DNOERROR4
cc-options: -DNOERROR5 -march=native
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Setup configure
Configuring my-0.1...
Warning: [misplaced-c-opt] Instead of 'ghc-options: -DNOERROR4' use 'cpp-options: -DNOERROR4'
# Setup build
1 change: 0 additions & 1 deletion cabal-testsuite/PackageTests/CCompilerOverride/setup.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Setup configure
Configuring my-0.1...
Warning: [misplaced-c-opt] Instead of 'ghc-options: -DNOERROR4' use 'cpp-options: -DNOERROR4'
# Setup build
8 changes: 5 additions & 3 deletions cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import Test.Cabal.Prelude
-- Test that all the respective defines -DNOERROR... specified in various ways
-- all end up routed to the C compiler. Otherwise the C file we depend on will
-- not compile.
--
-- This has been largely gutted, as ghc 9.10 no longer passes through most
-- of the defines we were testing; see
-- https://gitlab.haskell.org/ghc/ghc/-/commit/8ff3134ed4aa323b0199ad683f72165e51a59ab6
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 8.8"
isWin <- isWindows
Expand All @@ -14,9 +18,7 @@ main = setupAndCabalTest $ do
pwd ++ "/custom-cc" ++ if isWin then win_suffix else ""

setup "configure"
[ "--ghc-option=-DNOERROR1"
, "--ghc-option=-optc=-DNOERROR2"
, "--ghc-option=-optP=-DNOERROR3"
[ "--ghc-option=-optc=-DNOERROR2"
, "--with-gcc=" ++ customCC
]
setup "build" ["-v2"]
16 changes: 14 additions & 2 deletions project-cabal/ghc-latest.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,17 @@

-- NOTE: don't forget to update the compiler version in the conditional
-- when upgrading to a newer GHC
if impl(ghc >= 9.8.1)
-- allow-newer: windns:*
if impl(ghc >= 9.10.0)
allow-newer:
--windns:*, rere:*, tree-diff:*, uuid-types:*, these:*, hashable:*, assoc:*, semialign:*, indexed-traversable-instances:*, indexed-traversable:*, OneTuple:*, scientific:*, time-compat:*, text-short:*, integer-conversion:*, generically:*, data-fix:*, binary:*
-- Artem, 2024-04-21: I started and then gave up...
*:base, *:template-haskell, text-short, *:deepseq, *:bytestring, *:ghc-prim

repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
key-threshold: 3
root-keys:
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89

0 comments on commit 3a8c69c

Please sign in to comment.