-
Notifications
You must be signed in to change notification settings - Fork 704
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6872 from phadej/issue-6377-add-cmm-test
Issue 6377 add cmm test
- Loading branch information
Showing
15 changed files
with
114 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
cabal-install/Distribution/Client/CmdRun/ClientRunFlags.hs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# cabal v2-run | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- cmmexperiment-0 (lib) (first run) | ||
- cmmexperiment-0 (exe:demo) (first run) | ||
Configuring library for cmmexperiment-0.. | ||
Preprocessing library for cmmexperiment-0.. | ||
Building library for cmmexperiment-0.. | ||
Configuring executable 'demo' for cmmexperiment-0.. | ||
Warning: The package has an extraneous version range for a dependency on an internal library: cmmexperiment >=0 && ==0. This version range includes the current package but isn't needed as the current package's library will always be used. | ||
Preprocessing executable 'demo' for cmmexperiment-0.. | ||
Building executable 'demo' for cmmexperiment-0.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
packages: . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest $ do | ||
res <- cabal' "v2-run" ["demo"] | ||
assertOutputContains "= Post common block elimination =" res | ||
assertOutputContains "In Box we have 0x" res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "Cmm.h" | ||
|
||
aToMyWordzh (P_ clos) | ||
{ | ||
return (clos); | ||
} |
27 changes: 27 additions & 0 deletions
27
cabal-testsuite/PackageTests/CmmSources/cmmexperiment.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cabal-version: 3.0 | ||
name: cmmexperiment | ||
version: 0 | ||
build-type: Simple | ||
|
||
-- This code is extracted form ghc-heap | ||
-- Copyright (c) 2012-2013, Joachim Breitner | ||
-- (and probably -2020 GHC Team) | ||
-- Under BSD-3-Clause | ||
|
||
library | ||
default-language: Haskell2010 | ||
hs-source-dirs: src | ||
build-depends: base | ||
exposed-modules: Demo | ||
|
||
cmm-sources: cbits/HeapPrim.cmm | ||
if impl(ghc >=8.2) | ||
cmm-options: -ddump-cmm-verbose | ||
else | ||
cmm-options: -ddump-cmm | ||
|
||
executable demo | ||
default-language: Haskell2010 | ||
main-is: Main.hs | ||
hs-source-dirs: demo | ||
build-depends: base, cmmexperiment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module Main (main) where | ||
import Demo (main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Setup configure | ||
Configuring cmmexperiment-0... | ||
# Setup build | ||
Preprocessing library for cmmexperiment-0.. | ||
Building library for cmmexperiment-0.. | ||
Preprocessing executable 'demo' for cmmexperiment-0.. | ||
Building executable 'demo' for cmmexperiment-0.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = setupTest $ do | ||
skipIf =<< ghcVersionIs (< mkVersion [7,8]) | ||
setup "configure" [] | ||
res <- setup' "build" [] | ||
assertOutputContains "= Post common block elimination =" res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{-# LANGUAGE CPP #-} | ||
{-# LANGUAGE ForeignFunctionInterface #-} | ||
{-# LANGUAGE GHCForeignImportPrim #-} | ||
{-# LANGUAGE MagicHash #-} | ||
{-# LANGUAGE UnliftedFFITypes #-} | ||
module Demo (main) where | ||
|
||
#include "MachDeps.h" | ||
|
||
import Data.Bits | ||
import GHC.Exts | ||
import Numeric (showHex) | ||
|
||
foreign import prim "aToMyWordzh" aToWord# :: Any -> Word# | ||
|
||
tAG_MASK :: Int | ||
tAG_MASK = (1 `shift` TAG_BITS) - 1 | ||
|
||
data Box = Box Any | ||
|
||
instance Show Box where | ||
showsPrec _ (Box a) rs = | ||
-- unsafePerformIO (print "↓" >> pClosure a) `seq` | ||
pad_out (showHex addr "") ++ (if tag>0 then "/" ++ show tag else "") ++ rs | ||
where | ||
ptr = W# (aToWord# a) | ||
tag = ptr .&. fromIntegral tAG_MASK -- ((1 `shiftL` TAG_BITS) -1) | ||
addr = ptr - tag | ||
pad_out ls = '0':'x':ls | ||
|
||
asBox :: a -> Box | ||
asBox x = Box (unsafeCoerce# x) | ||
|
||
main :: IO () | ||
main = do | ||
let box = asBox "foobar" | ||
putStrLn $ "In Box we have " ++ show box |