forked from haskell/cabal
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for non-vanilla profiling and dynamic builds with Template H…
…askell
- Loading branch information
Showing
13 changed files
with
117 additions
and
1 deletion.
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,44 @@ | |||
module PackageTests.TemplateHaskell.Check where | |||
|
|||
import Test.HUnit | |||
import System.FilePath | |||
import PackageTests.PackageTester | |||
import Data.List (isInfixOf, intercalate) | |||
import Distribution.Version | |||
import Distribution.PackageDescription.Parse | |||
( readPackageDescription ) | |||
import Distribution.PackageDescription.Configuration | |||
( finalizePackageDescription ) | |||
import Distribution.Package | |||
( PackageIdentifier(..), PackageName(..), Dependency(..) ) | |||
import Distribution.PackageDescription | |||
( PackageDescription(..), BuildInfo(..), TestSuite(..), Library(..) | |||
, TestSuiteInterface(..) | |||
, TestType(..), emptyPackageDescription, emptyBuildInfo, emptyLibrary | |||
, emptyTestSuite, BuildType(..) ) | |||
import Distribution.Verbosity (silent) | |||
import Distribution.License (License(..)) | |||
import Distribution.ModuleName (fromString) | |||
import Distribution.System (buildPlatform) | |||
import Distribution.Compiler | |||
( CompilerId(..), CompilerFlavor(..) ) | |||
import Distribution.Text | |||
|
|||
profiling :: Test | |||
profiling = TestCase $ do | |||
let flags = ["--disable-library-vanilla" | |||
,"--enable-library-profiling" | |||
,"--enable-executable-profiling"] | |||
spec = PackageSpec ("PackageTests" </> "TemplateHaskell" </> "profiling") flags | |||
result <- cabal_build spec | |||
assertEqual "cabal build should succeed - see test-log.txt" True (successful result) | |||
|
|||
dynamic :: Test | |||
dynamic = TestCase $ do | |||
let flags = ["--disable-library-vanilla" | |||
,"--enable-shared" | |||
,"--enable-executable-dynamic"] | |||
spec = PackageSpec ("PackageTests" </> "TemplateHaskell" </> "dynamic") flags | |||
result <- cabal_build spec | |||
assertEqual "cabal build should succeed - see test-log.txt" True (successful result) | |||
|
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
{-# LANGUAGE TemplateHaskell #-} | |||
module Main where | |||
|
|||
import TH | |||
|
|||
main = print $(splice) |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
{-# LANGUAGE TemplateHaskell #-} | |||
module Lib where | |||
|
|||
import TH | |||
|
|||
val = $(splice) |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
import Distribution.Simple | |||
main = defaultMain | |||
|
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
{-# LANGUAGE TemplateHaskell #-} | |||
module TH where | |||
|
|||
splice = [| () |] |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
Name: templateHaskell | |||
Version: 0.1 | |||
Build-Type: Simple | |||
Cabal-Version: >= 1.2 | |||
|
|||
Library | |||
Exposed-Modules: Lib | |||
Other-Modules: TH | |||
Build-Depends: base, template-haskell | |||
Extensions: TemplateHaskell | |||
|
|||
Executable main | |||
Main-is: Exe.hs | |||
Build-Depends: base, template-haskell | |||
Extensions: TemplateHaskell |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
{-# LANGUAGE TemplateHaskell #-} | |||
module Main where | |||
|
|||
import TH | |||
|
|||
main = print $(splice) |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,6 @@ | |||
{-# LANGUAGE TemplateHaskell #-} | |||
module Lib where | |||
|
|||
import TH | |||
|
|||
val = $(splice) |
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
import Distribution.Simple | |||
main = defaultMain | |||
|
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
{-# LANGUAGE TemplateHaskell #-} | |||
module TH where | |||
|
|||
splice = [| () |] |
15 changes: 15 additions & 0 deletions
15
Cabal/tests/PackageTests/TemplateHaskell/profiling/my.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
Name: templateHaskell | |||
Version: 0.1 | |||
Build-Type: Simple | |||
Cabal-Version: >= 1.2 | |||
|
|||
Library | |||
Exposed-Modules: Lib | |||
Other-Modules: TH | |||
Build-Depends: base, template-haskell | |||
Extensions: TemplateHaskell | |||
|
|||
Executable main | |||
Main-is: Exe.hs | |||
Build-Depends: base, template-haskell | |||
Extensions: TemplateHaskell |
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