summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-01-22 19:05:45 -0500
committerBen Gamari <ben@smart-cactus.org>2019-01-26 12:05:50 -0500
commit97e2657f5bd557844826e1ce6e438943b6ac7aa0 (patch)
tree06318cb04a1db03c2e8bf26948d8267aceca8e0a
parent886ddb27bfbbb52c41690cd29e2ab3ed80bf5450 (diff)
downloadhaskell-wip/fix-T16180-on-darwin.tar.gz
testsuite: Fix T16180 on Darwinwip/fix-T16180-on-darwin
As mentioned in #16218, the CPP macro likely isn't defined when we run the assembler.
-rw-r--r--testsuite/tests/th/T16180.hs22
-rw-r--r--testsuite/tests/th/all.T2
2 files changed, 14 insertions, 10 deletions
diff --git a/testsuite/tests/th/T16180.hs b/testsuite/tests/th/T16180.hs
index 2a4b80c976..b6deab6e1c 100644
--- a/testsuite/tests/th/T16180.hs
+++ b/testsuite/tests/th/T16180.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE CPP #-}
module Main where
@@ -8,15 +9,18 @@ import Foreign.C.String
$(do
-- some architectures require a "_" symbol prefix...
-- GHC defines a LEADING_UNDERSCORE CPP constant to indicate this.
- addForeignSource LangAsm
- "#if defined(LEADING_UNDERSCORE)\n\
- \.global \"_mydata\"\n\
- \_mydata:\n\
- \#else\n\
- \.global \"mydata\"\n\
- \mydata:\n\
- \#endif\n\
- \.ascii \"Hello world\\0\"\n"
+ let asm = unlines
+ [ "#include \"ghcconfig.h\""
+ , "#if LEADING_UNDERSCORE"
+ , ".global \"_mydata\""
+ , "_mydata:"
+ , "#else"
+ , ".global \"mydata\""
+ , "mydata:"
+ , "#endif"
+ , ".ascii \"Hello world\\0\""
+ ]
+ addForeignSource LangAsm asm
return [])
foreign import ccall "&mydata" mystring :: CString
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 4062cf2af0..9ddf28345e 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -467,4 +467,4 @@ test('T15437', expect_broken(15437), multimod_compile,
test('T15985', normal, compile, [''])
test('T16133', normal, compile_fail, [''])
test('T15471', normal, multimod_compile, ['T15471.hs', '-v0'])
-test('T16180', when(opsys('darwin'), expect_broken(16218)), compile_and_run, [''])
+test('T16180', normal, compile_and_run, [''])