[Git][ghc/ghc][wip/javascript-backend] Try to fix CI, take N

Sylvain Henry (@hsyl20) gitlab at gitlab.haskell.org
Mon Nov 7 17:22:31 UTC 2022



Sylvain Henry pushed to branch wip/javascript-backend at Glasgow Haskell Compiler / GHC


Commits:
e5ab5dc2 by Sylvain Henry at 2022-11-07T18:26:13+01:00
Try to fix CI, take N

- - - - -


3 changed files:

- .gitlab/ci.sh
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml


Changes:

=====================================
.gitlab/ci.sh
=====================================
@@ -594,20 +594,18 @@ function test_hadrian() {
   fi
 
 
-  if [ -n "${CROSS_TARGET:-}" ]; then
-    if [ -n "${CROSS_EMULATOR:-}" ]; then
-      local instdir="$TOP/_build/install"
-      local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
-      install_bindist _build/bindist/ghc-*/ "$instdir"
-      echo 'main = putStrLn "hello world"' > hello.hs
-      echo "hello world" > expected
-      run "$test_compiler" hello.hs
-      $CROSS_EMULATOR ./hello > actual
-      run diff expected actual
-    else
-      info "Cannot test cross-compiled build without CROSS_EMULATOR being set."
-      return
-    fi
+  if [[ "${CROSS_EMULATOR:-}" == "NOT_SET" ]]; then
+    info "Cannot test cross-compiled build without CROSS_EMULATOR being set."
+    return
+  elif[[ "${CROSS_EMULATOR:-}" != "NOT_NEEDED" ]]; then
+    local instdir="$TOP/_build/install"
+    local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
+    install_bindist _build/bindist/ghc-*/ "$instdir"
+    echo 'main = putStrLn "hello world"' > hello.hs
+    echo "hello world" > expected
+    run "$test_compiler" hello.hs
+    $CROSS_EMULATOR ./hello > actual
+    run diff expected actual
   elif [[ -n "${REINSTALL_GHC:-}" ]]; then
     run_hadrian \
       test \


=====================================
.gitlab/gen_ci.hs
=====================================
@@ -109,6 +109,11 @@ bignumString :: BignumBackend -> String
 bignumString Gmp = "gmp"
 bignumString Native = "native"
 
+data CrossEmulator
+  = NoEmulator
+  | NoEmulatorNeeded
+  | Emulator String
+
 -- | A BuildConfig records all the options which can be modified to affect the
 -- bindists produced by the compiler.
 data BuildConfig
@@ -120,7 +125,7 @@ data BuildConfig
                 , withAssertions :: Bool
                 , withNuma       :: Bool
                 , crossTarget    :: Maybe String
-                , crossEmulator  :: Maybe String
+                , crossEmulator  :: CrossEmulator
                 , configureWrapper :: Maybe String
                 , fullyStatic    :: Bool
                 , tablesNextToCode :: Bool
@@ -164,7 +169,7 @@ vanilla = BuildConfig
   , withAssertions = False
   , withNuma = False
   , crossTarget = Nothing
-  , crossEmulator = Nothing
+  , crossEmulator = NoEmulator
   , configureWrapper = Nothing
   , fullyStatic = False
   , tablesNextToCode = True
@@ -197,7 +202,7 @@ staticNativeInt :: BuildConfig
 staticNativeInt = static { bignumBackend = Native }
 
 crossConfig :: String       -- ^ target triple
-            -> Maybe String -- ^ emulator for testing
+            -> CrossEmulator -- ^ emulator for testing
             -> Maybe String -- ^ Configure wrapper
             -> BuildConfig
 crossConfig triple emulator configure_wrapper =
@@ -642,7 +647,12 @@ job arch opsys buildConfig = (jobName, Job {..})
       , "CONFIGURE_ARGS" =: configureArgsStr buildConfig
       , maybe mempty ("CONFIGURE_WRAPPER" =:) (configureWrapper buildConfig)
       , maybe mempty ("CROSS_TARGET" =:) (crossTarget buildConfig)
-      , maybe mempty ("CROSS_EMULATOR" =:) (crossEmulator buildConfig)
+      , case crossEmulator buildConfig of
+          NoEmulator       -> case crossTarget buildConfig of
+            Nothing -> mempty
+            Just _  -> "CROSS_EMULATOR" =: "NOT_SET" -- we need an emulator but it isn't set. Won't run the testsuite
+          Emulator s       -> "CROSS_EMULATOR" =: s
+          NoEmulatorNeeded -> "CROSS_EMULATOR" =: "NOT_NEEDED"
       , if withNuma buildConfig then "ENABLE_NUMA" =: "1" else mempty
       ]
 
@@ -818,8 +828,8 @@ jobs = Map.fromList $ concatMap flattenJobGroup $
      , standardBuilds I386 (Linux Debian9)
      , allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) static)
      , disableValidate (allowFailureGroup (standardBuildsWithConfig Amd64 (Linux Alpine) staticNativeInt))
-     , validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Just "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing)
-     , validateBuilds Amd64 (Linux Debian11) (crossConfig "js-unknown-ghcjs" (Just "") (Just "emconfigure")
+     , validateBuilds Amd64 (Linux Debian11) (crossConfig "aarch64-linux-gnu" (Emulator "qemu-aarch64 -L /usr/aarch64-linux-gnu") Nothing)
+     , validateBuilds Amd64 (Linux Debian11) (crossConfig "js-unknown-ghcjs" NoEmulatorNeeded (Just "emconfigure")
         )
         { bignumBackend = Native
         , buildFlavour  = Release


=====================================
.gitlab/jobs.yaml
=====================================
@@ -1384,7 +1384,7 @@
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--with-intree-gmp",
       "CONFIGURE_WRAPPER": "emconfigure",
-      "CROSS_EMULATOR": "",
+      "CROSS_EMULATOR": "NOT_NEEDED",
       "CROSS_TARGET": "js-unknown-ghcjs",
       "TEST_ENV": "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-release",
       "XZ_OPT": "-9"
@@ -3928,7 +3928,7 @@
       "BUILD_FLAVOUR": "release",
       "CONFIGURE_ARGS": "--with-intree-gmp",
       "CONFIGURE_WRAPPER": "emconfigure",
-      "CROSS_EMULATOR": "",
+      "CROSS_EMULATOR": "NOT_NEEDED",
       "CROSS_TARGET": "js-unknown-ghcjs",
       "TEST_ENV": "x86_64-linux-deb11-int_native-cross_js-unknown-ghcjs-release"
     }



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e5ab5dc2c379ff0c8cefb2c0b34409c5a46e1848

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e5ab5dc2c379ff0c8cefb2c0b34409c5a46e1848
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/20221107/ed9477db/attachment-0001.html>


More information about the ghc-commits mailing list