Commit f817d816 authored by Sylvain Henry's avatar Sylvain Henry Committed by Ben Gamari
Browse files

Update testsuite

* support detection of slow ghc-bignum backend (to replace the detection
  of integer-simple use). There are still some test cases that the
  native backend doesn't handle efficiently enough.

* remove tests for GMP only functions that have been removed from
  ghc-bignum

* fix test results showing dependent packages (e.g. integer-gmp) or
  showing suggested instances

* fix test using Integer/Natural API or showing internal names
parent aa9e7b71
......@@ -253,6 +253,4 @@ test('T15349', [exit_code(1), expect_broken_for(15349, ['ghci'])], compile_and_r
test('T16111', exit_code(1), compile_and_run, [''])
test('T16943a', normal, compile_and_run, [''])
test('T16943b', normal, compile_and_run, [''])
# This frequently times out with slow bignum implementations
test('T17499', [when(have_slow_bignum(), skip), collect_stats('bytes allocated',5)],
compile_and_run, ['-O -w'])
test('T17499', [collect_stats('bytes allocated',5)], compile_and_run, ['-O -w'])
......@@ -139,6 +139,9 @@ class TestConfig:
# Is readelf available?
self.have_readelf = False
# Do we use a fast backend for bignum (e.g. GMP)
self.have_fast_bignum = True
# Are we testing an in-tree compiler?
self.in_tree_compiler = True
......
......@@ -563,11 +563,11 @@ def have_gdb( ) -> bool:
def have_readelf( ) -> bool:
return config.have_readelf
def integer_gmp( ) -> bool:
return have_library("integer-gmp")
def have_fast_bignum( ) -> bool:
return config.have_fast_bignum
def integer_simple( ) -> bool:
return have_library("integer-simple")
def have_slow_bignum( ) -> bool:
return not(have_fast_bignum())
def llvm_build ( ) -> bool:
return config.ghc_built_by_llvm
......@@ -2143,11 +2143,11 @@ def normalise_errmsg(s: str) -> str:
# collisions, so we need to normalise that to just "ghc"
s = re.sub('ghc-stage[123]', 'ghc', s)
# Error messages sometimes contain integer implementation package
s = re.sub('integer-(gmp|simple)-[0-9.]+', 'integer-<IMPL>-<VERSION>', s)
# Error messages sometimes contain ghc-bignum implementation package
s = re.sub('ghc-bignum-[0-9.]+', 'ghc-bignum-<VERSION>', s)
# Error messages sometimes contain this blurb which can vary
# spuriously depending upon build configuration (e.g. based on integer
# spuriously depending upon build configuration (e.g. based on bignum
# backend)
s = re.sub('...plus ([a-z]+|[0-9]+) instances involving out-of-scope types',
'...plus N instances involving out-of-scope types', s)
......
......@@ -100,6 +100,10 @@ HAVE_PROFILING := $(shell if [ -f $(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrap
HAVE_GDB := $(shell if gdb --version > /dev/null 2> /dev/null; then echo YES; else echo NO; fi)
HAVE_READELF := $(shell if readelf --version > /dev/null 2> /dev/null; then echo YES; else echo NO; fi)
# we need a better way to find which backend is selected and if --check flag is
# used
BIGNUM_GMP := $(shell "$(GHC_PKG)" field ghc-bignum exposed-modules | grep GMP)
ifeq "$(HAVE_VANILLA)" "YES"
RUNTEST_OPTS += -e config.have_vanilla=True
else
......@@ -156,6 +160,12 @@ else
RUNTEST_OPTS += -e config.have_readelf=False
endif
ifeq "$(BIGNUM_GMP)" ""
RUNTEST_OPTS += -e config.have_fast_bignum=False
else
RUNTEST_OPTS += -e config.have_fast_bignum=True
endif
ifeq "$(GhcDynamicByDefault)" "YES"
RUNTEST_OPTS += -e config.ghc_dynamic_by_default=True
CABAL_MINIMAL_BUILD = --enable-shared --disable-library-vanilla
......
......@@ -27,11 +27,10 @@ T13242a.hs:13:13: error:
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance Eq Ordering -- Defined in ‘GHC.Classes’
instance Eq Integer
-- Defined in ‘integer-gmp-1.0.3.0:GHC.Integer.Type’
instance Eq Integer -- Defined in ‘GHC.Num.Integer’
instance Eq () -- Defined in ‘GHC.Classes’
...plus 21 others
...plus six instances involving out-of-scope types
...plus five instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block: return (x == x)
In the expression:
......
......@@ -42,5 +42,4 @@ TYPE SIGNATURES
(Monad m, Num (m a)) =>
(m a -> m (m a)) -> p -> m a
Dependent modules: []
Dependent packages: [base-4.14.0.0, ghc-prim-0.6.1,
integer-gmp-1.0.3.0]
Dependent packages: [base-4.14.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]
test('ado001', normal, compile_and_run, [''])
test('ado002', normal, compile_fail, [''])
test('ado003', normal, compile_fail, [''])
test('ado004', normalise_version('base','ghc-prim','integer-gmp'), compile, [''])
test('ado004', normalise_version('base','ghc-prim','ghc-bignum'), compile, [''])
test('ado005', normal, compile_fail, [''])
test('ado006', normal, compile, [''])
test('ado007', normal, compile, [''])
......
......@@ -8,7 +8,8 @@ annfail10.hs:9:1: error:
Data.Data.Data (Either a b)
-- Defined in ‘Data.Data’
instance Data.Data.Data Ordering -- Defined in ‘Data.Data’
instance Data.Data.Data Integer -- Defined in ‘Data.Data’
instance Data.Data.Data a => Data.Data.Data (Maybe a)
-- Defined in ‘Data.Data’
...plus 15 others
...plus 47 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
......
......@@ -204,7 +204,7 @@ mkRFun :: Id -> [Id] -> CoreExpr -> CoreExpr -> CoreExpr
mkRFun v xs rhs body = mkRLet v (mkLams xs rhs) body
mkLit :: Integer -> CoreExpr
mkLit i = Lit (mkLitInteger i intTy)
mkLit i = mkUncheckedIntExpr i
-- Collects all let-bound IDs
allBoundIds :: CoreExpr -> VarSet
......
......@@ -11,5 +11,4 @@ COERCION AXIOMS
FAMILY INSTANCES
type instance F Int = Bool -- Defined at T14729.hs:10:15
Dependent modules: []
Dependent packages: [base-4.15.0.0, ghc-prim-0.6.1,
integer-gmp-1.0.3.0]
Dependent packages: [base-4.15.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]
......@@ -3,5 +3,4 @@ TYPE CONSTRUCTORS
forall {k1} k2 (k3 :: k2). Proxy k3 -> k1 -> k2 -> *
roles nominal nominal nominal phantom phantom phantom
Dependent modules: []
Dependent packages: [base-4.15.0.0, ghc-prim-0.6.1,
integer-gmp-1.0.3.0]
Dependent packages: [base-4.15.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]
......@@ -52,5 +52,4 @@ DATA CONSTRUCTORS
(d :: Proxy k5) (e :: Proxy k7).
f c -> T k8 a b f c d e
Dependent modules: []
Dependent packages: [base-4.15.0.0, ghc-prim-0.6.1,
integer-gmp-1.0.3.0]
Dependent packages: [base-4.15.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]
......@@ -5,8 +5,7 @@ TYPE SIGNATURES
(Applicative f, Num t, Num b) =>
(t -> f b) -> f b
Dependent modules: []
Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1,
integer-gmp-1.0.2.0]
Dependent packages: [base-4.13.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]
[1 of 1] Compiling A ( A.hs, A.o )
TYPE SIGNATURES
test2 ::
......@@ -14,5 +13,4 @@ TYPE SIGNATURES
(Applicative f, Num t, Num b) =>
(t -> f b) -> f b
Dependent modules: []
Dependent packages: [base-4.13.0.0, ghc-prim-0.6.1,
integer-gmp-1.0.2.0]
Dependent packages: [base-4.13.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]
{"span": null,"doc": "TYPE SIGNATURES\n foo :: forall a. a -> a\nDependent modules: []\nDependent packages: [base-4.13.0.0, ghc-prim-0.6.1,\n integer-gmp-1.0.2.0]","severity": "SevOutput","reason": null}
{"span": null,"doc": "TYPE SIGNATURES\n foo :: forall a. a -> a\nDependent modules: []\nDependent packages: [base-4.13.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]","severity": "SevOutput","reason": null}
......@@ -45,7 +45,7 @@ test('print033', normal, ghci_script, ['print033.script'])
test('print034', extra_files(['../GADT.hs', '../Test.hs']), ghci_script, ['print034.script'])
test('print035', extra_files(['../Unboxed.hs']), ghci_script, ['print035.script'])
test('print036', expect_broken(9046), ghci_script, ['print036.script'])
test('print037', when(llvm_build() and integer_gmp(),
test('print037', when(llvm_build(),
fragile_for(16205, ['ghci-ext']))
, ghci_script
, ['print037.script'])
......
......@@ -6,10 +6,10 @@
Relevant bindings include it :: a (bound at <interactive>:4:1)
These potential instances exist:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 22 others
...plus 18 instances involving out-of-scope types
...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
......@@ -20,9 +20,9 @@
Relevant bindings include it :: a (bound at <interactive>:6:1)
These potential instances exist:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
...plus 22 others
...plus 18 instances involving out-of-scope types
...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
......@@ -5,12 +5,9 @@ let f = Just (1.2::Float)
f
:p f
-- With @integer-gmp@, small integer literals get converted directly into
-- @S# 10#@. This optimization means that small integers are always already
-- With @ghc-bignum@, small integer literals get converted directly into
-- @IS 10#@. This optimization means that small integers are always already
-- evaluated in the output for @:p@.
--
-- Since we want this test to work on @integer-simple@ too, we explicitly
-- force the literal.
let ten = 10 :: Integer
:f ten
let i = Just ten
......
......@@ -7,8 +7,8 @@
These potential instances exist:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show TyCon -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
instance Show a => Show (List1 a) -- Defined at Test.hs:11:12
...plus 29 others
...plus 19 instances involving out-of-scope types
...plus 13 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
-- Test out printing of integers in GHCi
-- With @integer-gmp@, small integer literals get converted directly into
-- @S# i#@. This optimization means that small integers are always already
-- With @ghc-bignum@, small integer literals get converted directly into
-- @IS i#@. This optimization means that small integers are always already
-- evaluated in the output for @:p@.
--
-- Since we want this test to work on @integer-simple@ too, we explicitly
-- force the literals.
let smallNeg = -53 :: Integer
:f smallNeg
......
......@@ -3,5 +3,4 @@ TYPE CONSTRUCTORS
associated type family F{2} :: forall a. Maybe a -> *
roles nominal nominal
Dependent modules: []
Dependent packages: [base-4.15.0.0, ghc-prim-0.6.1,
integer-gmp-1.0.3.0]
Dependent packages: [base-4.15.0.0, ghc-bignum-1.0, ghc-prim-0.6.1]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment