Commit 83bfdc2f authored by tibbe's avatar tibbe
Browse files

Merge branch 'master' of https://github.com/ghc/testsuite

parents ad482243 97b75f7d
......@@ -40,6 +40,9 @@ config.compiler_debugged = ghc_debugged
if (ghc_with_vanilla == 1):
config.have_vanilla = True
if (ghc_with_dynamic == 1):
config.have_dynamic = True
if (ghc_with_profiling == 1):
config.have_profiling = True
config.compile_ways.append('profasm')
......
......@@ -81,6 +81,9 @@ class TestConfig:
# Do we have vanilla libraries?
self.have_vanilla = False
# Do we have dynamic libraries?
self.have_dynamic = False
# Do we have profiling support?
self.have_profiling = False
......
......@@ -354,6 +354,42 @@ def if_cygwin( f ):
else:
return normal
def when_have_vanilla( f ):
if config.have_vanilla:
return f
else:
return normal
def unless_have_vanilla( f ):
if config.have_vanilla:
return normal
else:
return f
def when_have_dynamic( f ):
if config.have_dynamic:
return f
else:
return normal
def unless_have_dynamic( f ):
if config.have_dynamic:
return normal
else:
return f
def when_have_profiling( f ):
if config.have_profiling:
return f
else:
return normal
def unless_have_profiling( f ):
if config.have_profiling:
return normal
else:
return f
# ---
def if_ghci_dynamic( f ):
......
......@@ -49,7 +49,8 @@ endif
BASE_LIBDIR := $(shell "$(GHC_PKG)" field base library-dirs | sed 's/^[^:]*: *//')
HAVE_VANILLA := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.hi ]; then echo YES; else echo NO; fi)
HAVE_PROFILING := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.p_a ]; then echo YES; else echo NO; fi)
HAVE_DYNAMIC := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.dyn_hi ]; then echo YES; else echo NO; fi)
HAVE_PROFILING := $(shell if [ -f $(subst \,/,$(BASE_LIBDIR))/Prelude.p_hi ]; then echo YES; else echo NO; fi)
ifeq "$(HAVE_VANILLA)" "YES"
RUNTEST_OPTS += -e ghc_with_vanilla=1
......@@ -57,6 +58,12 @@ else
RUNTEST_OPTS += -e ghc_with_vanilla=0
endif
ifeq "$(HAVE_DYNAMIC)" "YES"
RUNTEST_OPTS += -e ghc_with_dynamic=1
else
RUNTEST_OPTS += -e ghc_with_dynamic=0
endif
ifeq "$(HAVE_PROFILING)" "YES"
RUNTEST_OPTS += -e ghc_with_profiling=1
else
......
{-# LANGUAGE MagicHash #-}
module Main (main) where
import GHC.Exts (Double(D#), Float(F#), word2Double#, word2Float#)
main :: IO ()
main = do
print (D# (word2Double# 0##))
-- 9007199254740992 is 2^53, which is the largest integer which
-- can be stored in a 64-bit IEEE floating-point value without
-- loss of precision.
print (D# (word2Double# 9007199254740992##))
print (F# (word2Float# 0##))
-- 16777216 is 2^24, which is the largest integer which can be
-- stored in a 32-bit IEEE floating-point value without loss of
-- precision
print (F# (word2Float# 16777216##))
0.0
9.007199254740992e15
0.0
1.6777216e7
......@@ -100,3 +100,4 @@ test('T7319', [ extra_ways(['prof']), only_ways(['prof']), exit_code(1),
req_profiling,
extra_hc_opts('-fprof-auto'),
extra_run_opts('+RTS -xc') ], compile_and_run, [''])
test('Word2Float', normal, compile_and_run, [''])
{-# LANGUAGE TypeOperators, GADTs, EmptyCase #-}
module T2431 where
data a :~: b where
Refl :: a :~: a
absurd :: Int :~: Bool -> a
absurd x = case x of {}
==================== Tidy Core ====================
Result size of Tidy Core = {terms: 8, types: 19, coercions: 1}
T2431.$WRefl [InlPrag=INLINE] :: forall a. a T2431.:~: a
[GblId[DataConWrapper],
Caf=NoCafRefs,
Str=DmdType,
Unf=Unf{Src=InlineStable, TopLvl=True, Arity=0, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=False)
Tmpl= \ (@ a) -> T2431.Refl @ a @ a @~ <a>}]
T2431.$WRefl = \ (@ a) -> T2431.Refl @ a @ a @~ <a>
T2431.absurd
:: forall a. (GHC.Types.Int T2431.:~: GHC.Types.Bool) -> a
[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType Tb]
T2431.absurd =
\ (@ a) (x :: GHC.Types.Int T2431.:~: GHC.Types.Bool) ->
case x of _ { }
......@@ -101,3 +101,4 @@ test('T5252Take2',
extra_clean(['T5252Take2a.hi', 'T5252Take2a.o']),
run_command,
['$MAKE -s --no-print-directory T5252Take2'])
test('T2431', normal, compile, ['-ddump-simpl -dsuppress-uniques'])
......@@ -35,7 +35,8 @@ expectedGhcOnlyExtensions = [
"AlternativeLayoutRule",
"AlternativeLayoutRuleTransitional",
"ExplicitNamespaces",
"TypeHoles"]
"TypeHoles",
"EmptyCase" ]
expectedCabalOnlyExtensions :: [String]
expectedCabalOnlyExtensions = ["Generics",
......
module A001 where
a :: Char
a = 'a'
module B001 where
b :: Char
b = 'c'
module B001 where
b :: Char
b = 'b'
module B001 where
b :: Char
b = 'c'
module Main where
import A001
import B001
main = do print a
print b
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
TEST_HC_OPTS_DYN = -dynamic -hisuf dyn_hi -osuf dyn_o
.PHONY: dynamicToo001
# -dynamic-too should notice that the interface files for B don't match,
# and so compile the dyn way separately. This means that the right value
# of B.b should get inlined.
dynamicToo001:
"$(TEST_HC)" $(TEST_HC_OPTS) -O -c A001.hs
"$(TEST_HC)" $(TEST_HC_OPTS) $(TEST_HC_OPTS_DYN) -O -c A001.hs
cp B001_1.hs B001.hs
"$(TEST_HC)" $(TEST_HC_OPTS) -O -c B001.hs
cp B001_2.hs B001.hs
"$(TEST_HC)" $(TEST_HC_OPTS) $(TEST_HC_OPTS_DYN) -O -c B001.hs
"$(TEST_HC)" $(TEST_HC_OPTS) -O -c C001.hs -dynamic-too
"$(TEST_HC)" $(TEST_HC_OPTS) A001.o B001.o C001.o -o s001
"$(TEST_HC)" $(TEST_HC_OPTS) A001.dyn_o B001.dyn_o C001.dyn_o -o d001
./s001
./d001
setTestOpts(only_compiler_types(['ghc']))
test('dynamicToo001',
[extra_clean(['A001.o', 'B001.o', 'C001.o',
'A001.hi', 'B001.hi', 'C001.hi',
'A001.dyn_o', 'B001.dyn_o', 'C001.dyn_o',
'A001.dyn_hi', 'B001.dyn_hi', 'C001.dyn_hi',
's001', 'd001']),
unless_have_vanilla(skip),
unless_have_dynamic(skip)],
run_command,
['$MAKE -s --no-print-directory dynamicToo001'])
module Foo where
import Foreign.Ptr
-- foreign import ccall "stdio.h &putchar" c_putchar :: () -> FunPtr (Char -> IO ())
foreign import ccall "stdio.h &putchar" c_putchar :: Int -> IO ()
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