[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 4 commits: testsuite: Add --top flag to driver
Marge Bot
gitlab at gitlab.haskell.org
Sun Nov 1 23:54:19 UTC 2020
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
5e9eec58 by GHC GitLab CI at 2020-11-01T18:54:06-05:00
testsuite: Add --top flag to driver
This allows us to make `config.top` a proper Path. Previously it was a
str, which caused the Ghostscript detection logic to break.
- - - - -
078252c3 by Ben Gamari at 2020-11-01T18:54:06-05:00
Document that ccall convention doesn't support varargs
We do not support foreign "C" imports of varargs functions. While this
works on amd64, in general the platform's calling convention may need
more type information that our Cmm representation can currently provide.
For instance, this is the case with Darwin's AArch64 calling convention.
Document this fact in the users guide and fix T5423 which makes use of a
disallowed foreign import.
Closes #18854.
- - - - -
58e81685 by Simon Peyton Jones at 2020-11-01T18:54:07-05:00
Expand type synonyms with :kind!
The User's Guide claims that `:kind!` should expand type synonyms,
but GHCi wasn't doing this in practice. Let's just update the implementation
to match the specification in the User's Guide.
Fixes #13795. Fixes #18828.
Co-authored-by: Ryan Scott <ryan.gl.scott at gmail.com>
- - - - -
e015d282 by Ben Gamari at 2020-11-01T18:54:07-05:00
hadrian: Don't capture RunTest output
There are a few reasons why capturing the output of the RunTest builder
is undesirable:
* there is a large amount of output which then gets unnecessarily
duplicated by Hadrian if the builder fails
* the output may contain codepoints which are unrepresentable in the
current codepage on Windows, causing Hadrian to crash
* capturing the output causes the testsuite driver to disable
its colorisation logic, making the output less legible.
- - - - -
19 changed files:
- compiler/GHC/Tc/Module.hs
- docs/users_guide/9.2.1-notes.rst
- docs/users_guide/exts/ffi.rst
- hadrian/src/Builder.hs
- hadrian/src/Settings/Builders/RunTest.hs
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/mk/test.mk
- + testsuite/tests/ghci/scripts/T13795.script
- + testsuite/tests/ghci/scripts/T13795.stdout
- + testsuite/tests/ghci/scripts/T18828.hs
- + testsuite/tests/ghci/scripts/T18828.script
- + testsuite/tests/ghci/scripts/T18828.stdout
- testsuite/tests/ghci/scripts/all.T
- testsuite/tests/rts/T5423.hs
- testsuite/tests/rts/T5423.stdout
- testsuite/tests/rts/T5423_c.c
- testsuite/tests/rts/T5423_cmm.cmm
Changes:
=====================================
compiler/GHC/Tc/Module.hs
=====================================
@@ -2629,12 +2629,13 @@ tcRnType hsc_env flexi normalise rdr_type
-- Do validity checking on type
; checkValidType (GhciCtxt True) ty
- ; ty' <- if normalise
- then do { fam_envs <- tcGetFamInstEnvs
- ; let (_, ty')
- = normaliseType fam_envs Nominal ty
- ; return ty' }
- else return ty ;
+ -- Optionally (:k vs :k!) normalise the type. Does two things:
+ -- normaliseType: expand type-family applications
+ -- expandTypeSynonyms: expand type synonyms (#18828)
+ ; fam_envs <- tcGetFamInstEnvs
+ ; let ty' | normalise = expandTypeSynonyms $ snd $
+ normaliseType fam_envs Nominal ty
+ | otherwise = ty
; return (ty', mkInfForAllTys kvs (tcTypeKind ty')) }
=====================================
docs/users_guide/9.2.1-notes.rst
=====================================
@@ -37,6 +37,9 @@ Compiler
- Type checker plugins which work with the natural numbers now
should use ``naturalTy`` kind instead of ``typeNatKind``, which has been removed.
+- GHCi's ``:kind!`` command now expands through type synonyms in addition to type
+ families. See :ghci-cmd:`:kind`.
+
``ghc-prim`` library
~~~~~~~~~~~~~~~~~~~~
=====================================
docs/users_guide/exts/ffi.rst
=====================================
@@ -83,6 +83,21 @@ For more details on the implementation see the Paper:
Last known to be accessible `here
<https://www.microsoft.com/en-us/research/wp-content/uploads/2004/09/conc-ffi.pdf>`_.
+Varargs not supported by ``ccall`` calling convention
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Note that functions requiring varargs arguments are unsupported by the ``ccall``
+calling convention. Foreign imports needing to call such functions should rather
+use the ``capi`` convention, giving an explicit signature for the needed
+call-pattern. For instance, one could write: ::
+
+ foreign import "capi" "printf"
+ my_printf :: Ptr CChar -> CInt -> IO ()
+
+ printInt :: CInt -> IO ()
+ printInt n = my_printf "printed number %d" n
+
+
.. _ffi-ghcexts:
GHC extensions to the FFI Chapter
=====================================
hadrian/src/Builder.hs
=====================================
@@ -304,6 +304,11 @@ instance H.Builder Builder where
Makeindex -> unit $ cmd' [Cwd output] [path] (buildArgs ++ [input])
Tar _ -> cmd' buildOptions echo [path] buildArgs
+
+ -- RunTest produces a very large amount of (colorised) output;
+ -- Don't attempt to capture it.
+ RunTest -> cmd echo [path] buildArgs
+
_ -> cmd' echo [path] buildArgs
-- TODO: Some builders are required only on certain platforms. For example,
=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -102,6 +102,7 @@ runTestBuilderArgs = builder RunTest ? do
-- TODO: set CABAL_MINIMAL_BUILD/CABAL_PLUGIN_BUILD
mconcat [ arg $ "testsuite/driver/runtests.py"
, pure [ "--rootdir=" ++ testdir | testdir <- rootdirs ]
+ , arg "--top", arg (top -/- "testsuite")
, arg "-e", arg $ "windows=" ++ show windowsHost
, arg "-e", arg $ "darwin=" ++ show osxHost
, arg "-e", arg $ "config.local=False"
@@ -129,7 +130,6 @@ runTestBuilderArgs = builder RunTest ? do
, arg "-e", arg $ "config.ghc_dynamic_by_default=" ++ show hasDynamicByDefault
, arg "-e", arg $ "config.ghc_dynamic=" ++ show hasDynamic
- , arg "-e", arg $ "config.top=" ++ show (top -/- "testsuite")
, arg "-e", arg $ "config.wordsize=" ++ show wordsize
, arg "-e", arg $ "config.os=" ++ show os
, arg "-e", arg $ "config.arch=" ++ show arch
=====================================
testsuite/driver/runtests.py
=====================================
@@ -14,6 +14,7 @@ import tempfile
import time
import re
import traceback
+from pathlib import Path
# We don't actually need subprocess in runtests.py, but:
# * We do need it in testlibs.py
@@ -56,6 +57,7 @@ parser = argparse.ArgumentParser(description="GHC's testsuite driver")
perf_group = parser.add_mutually_exclusive_group()
parser.add_argument("-e", action='append', help="A string to execute from the command line.")
+parser.add_argument("--top", type=Path, help="path to top of testsuite/ tree")
parser.add_argument("--config-file", action="append", help="config file")
parser.add_argument("--config", action='append', help="config field")
parser.add_argument("--rootdir", action='append', help="root of tree containing tests (default: .)")
@@ -104,6 +106,9 @@ config.summary_file = args.summary_file
config.no_print_summary = args.no_print_summary
config.baseline_commit = args.perf_baseline
+if args.top:
+ config.top = args.top
+
if args.only:
config.only = args.only
config.run_only_some_tests = True
@@ -277,7 +282,7 @@ testopts_local.x = TestOptions()
# if timeout == -1 then we try to calculate a sensible value
if config.timeout == -1:
- config.timeout = int(read_no_crs(config.top + '/timeout/calibrate.out'))
+ config.timeout = int(read_no_crs(config.top / 'timeout' / 'calibrate.out'))
print('Timeout is ' + str(config.timeout))
print('Known ways: ' + ', '.join(config.other_ways))
=====================================
testsuite/driver/testglobals.py
=====================================
@@ -22,7 +22,7 @@ class TestConfig:
def __init__(self):
# Where the testsuite root is
- self.top = ''
+ self.top = Path('.')
# Directories below which to look for test description files (foo.T)
self.rootdirs = []
=====================================
testsuite/driver/testlib.py
=====================================
@@ -1110,7 +1110,7 @@ def do_test(name: TestName,
dst_makefile = in_testdir('Makefile')
if src_makefile.exists():
makefile = src_makefile.read_text(encoding='UTF-8')
- makefile = re.sub('TOP=.*', 'TOP=' + config.top, makefile, 1)
+ makefile = re.sub('TOP=.*', 'TOP=%s' % config.top, makefile, 1)
dst_makefile.write_text(makefile, encoding='UTF-8')
if opts.pre_cmd:
=====================================
testsuite/mk/test.mk
=====================================
@@ -256,13 +256,13 @@ endif
RUNTEST_OPTS += \
--rootdir=. \
--config-file=$(CONFIG) \
+ --top="$(TOP_ABS)" \
-e 'config.platform="$(TARGETPLATFORM)"' \
-e 'config.os="$(TargetOS_CPP)"' \
-e 'config.arch="$(TargetARCH_CPP)"' \
-e 'config.wordsize="$(WORDSIZE)"' \
-e 'config.timeout=int($(TIMEOUT)) or config.timeout' \
- -e 'config.exeext="$(exeext)"' \
- -e 'config.top="$(TOP_ABS)"'
+ -e 'config.exeext="$(exeext)"'
# Wrap non-empty program paths in quotes, because they may contain spaces. Do
# it here, so we don't have to (and don't forget to do it) in the .T test
=====================================
testsuite/tests/ghci/scripts/T13795.script
=====================================
@@ -0,0 +1,2 @@
+type A = ()
+:kind! A
=====================================
testsuite/tests/ghci/scripts/T13795.stdout
=====================================
@@ -0,0 +1,2 @@
+A :: *
+= ()
=====================================
testsuite/tests/ghci/scripts/T18828.hs
=====================================
@@ -0,0 +1,31 @@
+{-# Language ConstraintKinds #-}
+{-# Language DataKinds #-}
+{-# Language GADTs #-}
+{-# Language PolyKinds #-}
+{-# Language RankNTypes #-}
+{-# Language StandaloneKindSignatures #-}
+{-# Language TypeFamilies #-}
+{-# Language TypeOperators #-}
+module T18828 where
+
+import Data.Kind
+
+type Cat :: Type -> Type
+type Cat ob = ob -> ob -> Type
+
+type Dict :: Constraint -> Type
+data Dict cls where
+ Dict :: cls => Dict cls
+
+type (:-) :: Cat Constraint
+newtype cls1 :- cls2 where
+ Sub :: (cls1 => Dict cls2) -> (cls1 :- cls2)
+
+type ObjectSyn :: Cat ob -> Type
+type ObjectSyn (cat :: ob -> ob -> Type) = ob
+
+type
+ ObjectFam :: Cat ob -> Type
+type family
+ ObjectFam cat where
+ ObjectFam @ob cat = ob
=====================================
testsuite/tests/ghci/scripts/T18828.script
=====================================
@@ -0,0 +1,9 @@
+:load T18828
+:set -XDataKinds -XKindSignatures -XRankNTypes
+import Data.Type.Equality
+:k! ObjectSyn (->)
+:k! forall ob. ObjectSyn ((:~:) :: Cat ob)
+:k! ObjectSyn (:-)
+:k! ObjectFam (->)
+:k! forall ob. ObjectFam ((:~:) :: Cat ob)
+:k! ObjectFam (:-)
=====================================
testsuite/tests/ghci/scripts/T18828.stdout
=====================================
@@ -0,0 +1,12 @@
+ObjectSyn (->) :: *
+= *
+forall ob. ObjectSyn ((:~:) :: Cat ob) :: *
+= ob
+ObjectSyn (:-) :: *
+= Constraint
+ObjectFam (->) :: *
+= *
+forall ob. ObjectFam ((:~:) :: Cat ob) :: *
+= ob
+ObjectFam (:-) :: *
+= Constraint
=====================================
testsuite/tests/ghci/scripts/all.T
=====================================
@@ -279,6 +279,7 @@ test('T13591', expect_broken(13591), ghci_script, ['T13591.script'])
test('T13699', normal, ghci_script, ['T13699.script'])
test('T13988', normal, ghci_script, ['T13988.script'])
test('T13407', normal, ghci_script, ['T13407.script'])
+test('T13795', normal, ghci_script, ['T13795.script'])
test('T13963', normal, ghci_script, ['T13963.script'])
test('T14342', [extra_hc_opts("-XOverloadedStrings -XRebindableSyntax")],
ghci_script, ['T14342.script'])
@@ -322,3 +323,4 @@ test('T17669', [extra_run_opts('-fexternal-interpreter -fobject-code'), expect_b
test('T18501', normal, ghci_script, ['T18501.script'])
test('T18644', normal, ghci_script, ['T18644.script'])
test('T18755', normal, ghci_script, ['T18755.script'])
+test('T18828', normal, ghci_script, ['T18828.script'])
=====================================
testsuite/tests/rts/T5423.hs
=====================================
@@ -1,3 +1,5 @@
+-- | Verify that @foreign import prim@ calls with more than 10 arguments
+-- are lowered correctly.
{-# LANGUAGE MagicHash, GHCForeignImportPrim, UnliftedFFITypes #-}
=====================================
testsuite/tests/rts/T5423.stdout
=====================================
@@ -1,2 +1,2 @@
-111 112 113 114 115 116 117 118 119 120
+111 112 113 114 115 116 117 118 119 120
120
=====================================
testsuite/tests/rts/T5423_c.c
=====================================
@@ -1,6 +1,34 @@
+#include <Rts.h>
#include <stdio.h>
void flush_stdout(void)
{
fflush(stdout);
}
+
+void print_it(
+ StgWord r1,
+ StgWord r2,
+ StgWord r3,
+ StgWord r4,
+ StgWord r5,
+ StgWord r6,
+ StgWord r7,
+ StgWord r8,
+ StgWord r9,
+ StgWord r10
+ )
+{
+ printf("%" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word
+ " %" FMT_Word "\n",
+ r1, r2, r3, r4, r5,
+ r6, r7, r8, r9, r10);
+}
=====================================
testsuite/tests/rts/T5423_cmm.cmm
=====================================
@@ -10,7 +10,6 @@ test (W_ r1,
W_ r9,
W_ r10)
{
- foreign "C" printf("%d %d %d %d %d %d %d %d %d %d\n",
- r1, r2, r3, r4, r5, r6, r7, r8, r9, r10);
+ foreign "C" print_it(r1, r2, r3, r4, r5, r6, r7, r8, r9, r10);
return (r10);
}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ba7415574a201a4db0f839ef0906982b751c92e4...e015d2824c5c17dd3be9fbb7f1467c800b219a75
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ba7415574a201a4db0f839ef0906982b751c92e4...e015d2824c5c17dd3be9fbb7f1467c800b219a75
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/20201101/9494ffb0/attachment-0001.html>
More information about the ghc-commits
mailing list