[Git][ghc/ghc][wip/fix-multi-repl] 4 commits: ci: Add job to test hadrian-multi command

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Tue Sep 27 16:04:41 UTC 2022



Matthew Pickering pushed to branch wip/fix-multi-repl at Glasgow Haskell Compiler / GHC


Commits:
7f363bb5 by Matthew Pickering at 2022-09-27T17:04:31+01:00
ci: Add job to test hadrian-multi command

I am not sure this job is good because it requires booting HEAD with
HEAD, but it should be fine.

- - - - -
4fe1815f by Matthew Pickering at 2022-09-27T17:04:31+01:00
hadrian-multi: Put interface files in separate directories

Before we were putting all the interface files in the same directory
which was leading to collisions if the files were called the same thing.

- - - - -
dc1247cb by Matthew Pickering at 2022-09-27T17:04:31+01:00
hadrian-toolargs: Add filepath to allowed repl targets

- - - - -
626ebd0b by Matthew Pickering at 2022-09-27T17:04:31+01:00
driver: Set correct UnitId when rehydrating modules

We were not setting the UnitId before rehydrating modules which just led
to us attempting to find things in the wrong HPT. The test for this is
the hadrian-multi command (which is now added as a CI job).

Fixes #22222

- - - - -


4 changed files:

- .gitlab-ci.yml
- compiler/GHC/Driver/Make.hs
- hadrian/ghci-multi-cabal.in
- hadrian/src/Rules/ToolArgs.hs


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -367,6 +367,53 @@ hadrian-ghc-in-ghci:
     paths:
       - cabal-cache
 
+############################################################
+# Hadrian Multi-Repl
+############################################################
+
+hadrian-multi:
+  needs:
+    - job: x86_64-linux-fedora33-release
+      optional: true
+    - job: nightly-x86_64-linux-fedora33-release
+      optional: true
+    - job: release-x86_64-linux-fedora33-release
+      optional: true
+  dependencies: null
+  image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-fedora33:$DOCKER_REV"
+  before_script:
+    # workaround for docker permissions
+    - sudo chown ghc:ghc -R .
+  variables:
+    GHC_FLAGS: -Werror
+    CONFIGURE_ARGS: --enable-bootstrap-with-devel-snapshot
+  tags:
+    - x86_64-linux
+  script:
+    - git clean -xdf && git submodule foreach git clean -xdf
+    - root=$(pwd)/ghc
+    - |
+      mkdir tmp
+      tar -xf ../ghc-x86_64-linux-fedora33-release.tar.xz -C tmp
+      pushd tmp/ghc-*/
+      ./configure --prefix=$root
+      make install
+      popd
+      rm -Rf tmp
+    - export BOOT_HC=$(which ghc)
+    - export HC=$root/bin/ghc
+    - export GHC=$root/bin/ghc
+    - .gitlab/ci.sh setup
+    - .gitlab/ci.sh configure
+    # Load hadrian-multi then immediately exit and check the modules loaded
+    - echo ":q" | hadrian/ghci-multi -j`mk/detect-cpu-count.sh`| tail -n2 | grep "Ok,"
+  after_script:
+    - .gitlab/ci.sh save_cache
+  cache:
+    key: hadrian-ghci-$CACHE_REV
+    paths:
+      - cabal-cache
+
 ############################################################
 # stack-hadrian-build
 ############################################################


=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -1162,9 +1162,10 @@ interpretBuildPlan hug mhmi_cache old_hpt plan = do
       hug_var <- gets hug_var
       !build_map <- getBuildMap
       res_var <- liftIO newEmptyMVar
-      let
+      let loop_unit :: UnitId
+          !loop_unit = nodeKeyUnitId (gwib_mod (head deps))
           !build_deps = getDependencies (map gwib_mod deps) build_map
-      let loop_action = do
+      let loop_action = withCurrentUnit loop_unit $ do
             (hug, tdeps) <- wait_deps_hug hug_var build_deps
             hsc_env <- asks hsc_env
             let new_hsc = setHUG hug hsc_env


=====================================
hadrian/ghci-multi-cabal.in
=====================================
@@ -10,4 +10,4 @@ export TOOL_OUTPUT=.hadrian_ghci_multi/ghci_args
 # Replace newlines with spaces, as these otherwise break the ghci invocation on windows.
 CABFLAGS=-v0 "hadrian/build-cabal" multi:ghc --build-root=.hadrian_ghci_multi --flavour=ghc-in-ghci $HADRIAN_ARGS
 GHC_FLAGS="$GHC_FLAGS $(cat $TOOL_OUTPUT | tr '\n\r' ' ')"
-$GHC --interactive $GHC_FLAGS $@ -fno-code -fwrite-interface -hidir=.hadrian_ghci_multi/interface -O0 +RTS -A128m
+$GHC --interactive $GHC_FLAGS $@ -fno-code -fwrite-interface -O0 +RTS -A128m


=====================================
hadrian/src/Rules/ToolArgs.hs
=====================================
@@ -84,9 +84,11 @@ multiSetup pkg_s = do
       gens <- interpretInContext c generatedDependencies
       need (srcs ++ gens)
       let rexp m = ["-reexported-module", m]
+      let hidir = root </> "interfaces" </> pkgPath p
       writeFile' (resp_file root p) (intercalate "\n" (th_hack arg_list
                                                       ++  modules cd
-                                                      ++ concatMap rexp (reexportModules cd) ))
+                                                      ++ concatMap rexp (reexportModules cd)
+                                                      ++ ["-outputdir", hidir]))
       return (resp_file root p)
 
 
@@ -151,6 +153,7 @@ toolTargets = [ binary
               , directory
               , process
               , exceptions
+              , filepath
               -- , ghc     -- # depends on ghc library
               -- , runGhc  -- # depends on ghc library
               , ghcBoot



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/27d19a7b6f9c5e89d570c8f378ea35d025520df4...626ebd0bbb06982b79c2308c6c83dcedb046cb67

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/27d19a7b6f9c5e89d570c8f378ea35d025520df4...626ebd0bbb06982b79c2308c6c83dcedb046cb67
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220927/6582b7f3/attachment-0001.html>


More information about the ghc-commits mailing list