[Git][ghc/ghc][wip/js-staging] 2 commits: Only change the test environment for cross

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Mon Oct 24 15:50:01 UTC 2022



Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
175f1262 by Sylvain Henry at 2022-10-24T16:13:45+02:00
Only change the test environment for cross

- - - - -
d6951afc by Sylvain Henry at 2022-10-24T17:53:11+02:00
Force creation of hpc/haddock/runghc programs for cross

- - - - -


1 changed file:

- hadrian/src/Rules/Test.hs


Changes:

=====================================
hadrian/src/Rules/Test.hs
=====================================
@@ -193,38 +193,31 @@ testRules = do
         need [root -/- timeoutPath]
 
         cross <- flag CrossCompiling
-        isJs  <- isJsTarget
 
-        let stage2 s
-             | Stage2 {} <- s = True
-             | otherwise      = False
-
-        -- get absolute path for the given program in the given stage
-        let absolute_path_stage s p = do
-              rel_path <- programPath =<< programContext s p
+        -- get relative path for the given program in the given stage
+        let relative_path_stage s p = programPath =<< programContext s p
+        let make_absolute rel_path = do
               abs_path <- liftIO (IO.makeAbsolute rel_path)
               fixAbsolutePathOnWindows abs_path
 
-        -- get absolute path for the given program in the target stage
-        let absolute_path
-              | isJs && stage2 stg = absolute_path_stage (predStage stg)
-              | otherwise          = absolute_path_stage stg
+        rel_ghc_pkg     <- relative_path_stage Stage1 ghcPkg
+        rel_hsc2hs      <- relative_path_stage Stage1 hsc2hs
+        rel_hp2ps       <- relative_path_stage Stage1 hp2ps
+        rel_haddock     <- relative_path_stage (Stage0 InTreeLibs) haddock
+        rel_hpc         <- relative_path_stage (Stage0 InTreeLibs) hpc
+        rel_runghc      <- relative_path_stage (Stage0 InTreeLibs) runGhc
 
-        -- get absolute path for the given program in stage1 (useful for
-        -- cross-compilers)
-        let absolute_path1
-              | cross            = absolute_path_stage (Stage0 InTreeLibs)
-              | Stage0 {} <- stg = absolute_path_stage stg
-              | otherwise        = absolute_path_stage $ predStage stg
+        -- force stage0 program building for cross
+        when cross $ need [rel_hpc, rel_haddock, rel_runghc]
 
-        ghcPath <- getCompilerPath testCompilerArg
+        prog_ghc_pkg     <- make_absolute rel_ghc_pkg
+        prog_hsc2hs      <- make_absolute rel_hsc2hs
+        prog_hp2ps       <- make_absolute rel_hp2ps
+        prog_haddock     <- make_absolute rel_haddock
+        prog_hpc         <- make_absolute rel_hpc
+        prog_runghc      <- make_absolute rel_runghc
 
-        prog_ghc_pkg     <- absolute_path ghcPkg
-        prog_hsc2hs      <- absolute_path hsc2hs
-        prog_hp2ps       <- absolute_path hp2ps
-        prog_hpc         <- absolute_path1 hpc
-        prog_haddock     <- absolute_path1 haddock
-        prog_runghc      <- absolute_path1 runGhc
+        ghcPath <- getCompilerPath testCompilerArg
 
         makePath        <- builderPath $ Make ""
         top             <- topDirectory
@@ -254,12 +247,13 @@ testRules = do
             setEnv "TEST_CC" ccPath
             setEnv "TEST_CC_OPTS" ccFlags
 
-            setEnv "GHC_PKG"   prog_ghc_pkg
-            setEnv "HSC2HS"    prog_hsc2hs
-            setEnv "HP2PS_ABS" prog_hp2ps
-            setEnv "HPC"       prog_hpc
-            setEnv "HADDOCK"   prog_haddock
-            setEnv "RUNGHC"    prog_runghc
+            when cross $ do
+              setEnv "GHC_PKG"   prog_ghc_pkg
+              setEnv "HSC2HS"    prog_hsc2hs
+              setEnv "HP2PS_ABS" prog_hp2ps
+              setEnv "HPC"       prog_hpc
+              setEnv "HADDOCK"   prog_haddock
+              setEnv "RUNGHC"    prog_runghc
 
             setEnv "CHECK_PPR" (top -/- root -/- checkPprProgPath)
             setEnv "CHECK_EXACT" (top -/- root -/- checkExactProgPath)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6fdb94262c4d6f70a1da6facec7aed4400994735...d6951afc4985b5b68e723d8fefc08ebe86127b12

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/6fdb94262c4d6f70a1da6facec7aed4400994735...d6951afc4985b5b68e723d8fefc08ebe86127b12
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/20221024/b015a26c/attachment-0001.html>


More information about the ghc-commits mailing list