[Git][ghc/ghc][wip/backports-9.6] 6 commits: Testsuite: decrease length001 timeout for JS (#22921)

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Thu Feb 23 19:05:54 UTC 2023



Ben Gamari pushed to branch wip/backports-9.6 at Glasgow Haskell Compiler / GHC


Commits:
e0cfea59 by Sylvain Henry at 2023-02-23T14:05:44-05:00
Testsuite: decrease length001 timeout for JS (#22921)

- - - - -
54fc7394 by Luite Stegeman at 2023-02-23T14:05:44-05:00
Check for platform support for JavaScript foreign imports

GHC was accepting `foreign import javascript` declarations
on non-JavaScript platforms. This adds a check so that these
are only supported on an platform that supports the JavaScript
calling convention.

Fixes #22774

(cherry picked from commit 1d7c2e4c9d63a7b392024cfcde299849b8d667a8)

- - - - -
81020431 by Ben Gamari at 2023-02-23T14:05:44-05:00
Bump terminfo submodule to 0.4.1.6

- - - - -
55cfa7c7 by Ben Gamari at 2023-02-23T14:05:44-05:00
Bump unix submodule to preliminary 2.8 release

- - - - -
fba19572 by Ben Gamari at 2023-02-23T14:05:44-05:00
Bump haskeline submodule to 0.8.2.1

- - - - -
feccc865 by Ben Gamari at 2023-02-23T14:05:44-05:00
Bump unix submodule to 2.8.1.0

- - - - -


8 changed files:

- compiler/GHC/Tc/Gen/Foreign.hs
- libraries/base/tests/all.T
- libraries/haskeline
- libraries/terminfo
- libraries/unix
- testsuite/driver/testlib.py
- + testsuite/tests/ffi/should_compile/T22774.hs
- testsuite/tests/ffi/should_compile/all.T


Changes:

=====================================
compiler/GHC/Tc/Gen/Foreign.hs
=====================================
@@ -341,9 +341,10 @@ tcCheckFIType arg_tys res_ty idecl@(CImport src (L lc cconv) (L ls safety) mh
       checkForeignRes nonIOok checkSafe (isFFIPrimResultTy dflags) res_ty
       return (CImport src (L lc cconv) (L ls safety) mh (CFunction target))
   | cconv == JavaScriptCallConv = do
+      cconv' <- checkCConv (Right idecl) cconv
       checkCg (Right idecl) backendValidityOfCImport
       -- leave the rest to the JS backend (at least for now)
-      return (CImport src (L lc cconv) (L ls safety) mh (CFunction target))
+      return (CImport src (L lc cconv') (L ls safety) mh (CFunction target))
   | otherwise = do              -- Normal foreign import
       checkCg (Right idecl) backendValidityOfCImport
       cconv' <- checkCConv (Right idecl) cconv


=====================================
libraries/base/tests/all.T
=====================================
@@ -79,7 +79,9 @@ test('length001',
      # excessive amounts of stack space. So we specifically set a low
      # stack limit and mark it as failing under a few conditions.
      [extra_run_opts('+RTS -K8m -RTS'),
-     expect_fail_for(['normal', 'threaded1', 'llvm', 'nonmoving', 'nonmoving_thr', 'nonmoving_thr_ghc'])],
+     expect_fail_for(['normal', 'threaded1', 'llvm', 'nonmoving', 'nonmoving_thr', 'nonmoving_thr_ghc']),
+     # JS doesn't support stack limit so the test sometimes passes just fine. We decrease the timeout duration to force the failure.
+     when(js_arch(), run_timeout_multiplier(0.2))],
      compile_and_run, [''])
 
 test('ratio001', 	normal, compile_and_run, [''])


=====================================
libraries/haskeline
=====================================
@@ -1 +1 @@
-Subproject commit ad40faf532ca86ae6d0839a299234db2ce4fc424
+Subproject commit 1c2ad91edc936a9836d1ad80a26f8be03a7d8bb0


=====================================
libraries/terminfo
=====================================
@@ -1 +1 @@
-Subproject commit 0a05f06bc8a56c43578ce06d4ef1339ee70fb3fc
+Subproject commit 98100776edcf33796ddf2e752233e6ef179b876d


=====================================
libraries/unix
=====================================
@@ -1 +1 @@
-Subproject commit 98adc732bfbfca4fef945d546ecbaae13952a950
+Subproject commit 720debbf5b89366007bac473e8d7fd18e4114f1a


=====================================
testsuite/driver/testlib.py
=====================================
@@ -129,14 +129,17 @@ def no_deps( name, opts):
 def skip( name, opts ):
     opts.skip = True
 
+def js_arch() -> bool:
+    return arch("javascript");
+
 # disable test on JS arch
 def js_skip( name, opts ):
-    if arch("javascript"):
+    if js_arch():
         skip(name,opts)
 
 # expect broken for the JS backend
 def js_broken( bug: IssueNumber ):
-    if arch("javascript"):
+    if js_arch():
         return expect_broken(bug);
     else:
         return normal;


=====================================
testsuite/tests/ffi/should_compile/T22774.hs
=====================================
@@ -0,0 +1,4 @@
+module T22774 where
+
+foreign import javascript foo :: IO ()
+


=====================================
testsuite/tests/ffi/should_compile/all.T
=====================================
@@ -44,3 +44,6 @@ test(
 )
 test('T15531', normal, compile, ['-Wall'])
 test('T22043', [omit_ways(['ghci'])], compile, [''])
+
+test('T22774', when(not js_arch(), expect_fail), compile, [''])
+



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4b4ceb220642c8e81f79ef4dc6ccf0d66db6f2b6...feccc865db4645d02c6326cb9363df8441525950

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4b4ceb220642c8e81f79ef4dc6ccf0d66db6f2b6...feccc865db4645d02c6326cb9363df8441525950
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/20230223/fa3ed631/attachment-0001.html>


More information about the ghc-commits mailing list