-
Notifications
You must be signed in to change notification settings - Fork 733
Adding an explicit pgmc flag for interaction with GHC #11713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,16 @@ | ||
| {-# LANGUAGE ForeignFunctionInterface #-} | ||
|
|
||
| module Main where | ||
|
|
||
| import Foreign.C (CInt (..)) | ||
|
|
||
| foreign import ccall "pgmclib.h meaning_of_life_pgmc" | ||
| meaning_of_life_pgmc :: IO CInt | ||
|
|
||
| main :: IO () | ||
| main = do | ||
| secret <- meaning_of_life_pgmc | ||
| -- The value 66 comes from __TESTOPT_PGMC__ - see cc-wrapper.sh. | ||
| if (secret == 66) | ||
| then putStrLn ("The secret is " ++ show secret) | ||
| else error ("Expected value 66, got " ++ show secret) |
This file contains hidden or 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 @@ | ||
| # ForeignOptsPgmc | ||
|
|
||
| This test case asserts that cabal passes the `-pgmc` GHC option to override the C compiler program. | ||
|
|
||
| The cabal file sets `ghc-options: -pgmc scripts/cc-wrapper.sh`, pointing GHC at a shell script wrapper (`scripts/cc-wrapper.sh`) instead of the system C compiler. The wrapper adds `-D__TESTOPT_PGMC__=66` to every compilation and then delegates to the real `cc`. The C source requires `__TESTOPT_PGMC__` to be defined; if the wrapper is not used as the C compiler, the build fails with a `#error`. | ||
|
|
||
| This test is skipped on Windows (no POSIX shell). |
Empty file.
This file contains hidden or 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: . |
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/FFI/ForeignOptsPgmc/cabal.test.hs
This file contains hidden or 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 @@ | ||
| import Test.Cabal.Prelude | ||
|
|
||
| main = do | ||
| skipIfWindows "requires a POSIX shell script as the C compiler wrapper" | ||
| -- Use -pgmc to ensure that Cabal always passes cc-options, ld-options to GHC (#4435, #9801) | ||
| -- We can only do this on GHC >= 9.4, as we need https://gitlab.haskell.org/ghc/ghc/-/merge_requests/6949 | ||
| -- Without that GHC MR, this change would cause GHC to never pass -no-pie when linking, | ||
| -- which can cause breakage depending on the C toolchain use. We would have to appropriately | ||
| -- pass -pgmc-supports-no-pie as appropriate to avoid this regression. | ||
| cabalTest $ recordMode DoNotRecord $ do | ||
| skipUnlessGhcVersion ">= 9.4" | ||
| cabal "v2-build" ["foreign-opts-pgmc-exe"] | ||
| withPlan $ runPlanExe "foreign-opts-pgmc" "foreign-opts-pgmc-exe" [] | ||
9 changes: 9 additions & 0 deletions
9
cabal-testsuite/PackageTests/FFI/ForeignOptsPgmc/cbits/pgmclib.c
This file contains hidden or 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,9 @@ | ||
| #include "pgmclib.h" | ||
|
|
||
| #ifndef __TESTOPT_PGMC__ | ||
| #error "Did not get required __TESTOPT_PGMC__ from the -pgmc wrapper" | ||
| #endif | ||
|
|
||
| int meaning_of_life_pgmc() { | ||
| return __TESTOPT_PGMC__; | ||
| } |
6 changes: 6 additions & 0 deletions
6
cabal-testsuite/PackageTests/FFI/ForeignOptsPgmc/cbits/pgmclib.h
This file contains hidden or 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 @@ | ||
| #ifndef PGMCLIB_H | ||
| #define PGMCLIB_H | ||
|
|
||
| int meaning_of_life_pgmc(); | ||
|
|
||
| #endif |
12 changes: 12 additions & 0 deletions
12
cabal-testsuite/PackageTests/FFI/ForeignOptsPgmc/foreign-opts-pgmc.cabal
This file contains hidden or 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,12 @@ | ||
| cabal-version: 2.2 | ||
| name: foreign-opts-pgmc | ||
| version: 0.1 | ||
| build-type: Simple | ||
|
|
||
| executable foreign-opts-pgmc-exe | ||
| main-is: Main.hs | ||
| build-depends: base | ||
| default-language: Haskell2010 | ||
| include-dirs: cbits | ||
| c-sources: cbits/pgmclib.c | ||
| ghc-options: -pgmc scripts/cc-wrapper.sh |
4 changes: 4 additions & 0 deletions
4
cabal-testsuite/PackageTests/FFI/ForeignOptsPgmc/scripts/cc-wrapper.sh
This file contains hidden or 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,4 @@ | ||
| #!/bin/sh | ||
| # Wrapper around cc that adds -D__TESTOPT_PGMC__=66 to every compilation. | ||
| # Used by the ForeignOptsPgmc test to verify that -pgmc selects this wrapper. | ||
| exec cc -D__TESTOPT_PGMC__=66 "$@" |
67 changes: 67 additions & 0 deletions
67
cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.out
This file contains hidden or 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,67 @@ | ||
| # cabal v2-update | ||
| Downloading the latest package list from test-local-repo | ||
| # cabal build | ||
| Resolving dependencies... | ||
| Build profile: -w ghc-<GHCVER> -O1 | ||
| In order, the following will be built: | ||
| - Complex-0.1.0.0 (lib) (first run) | ||
| - Complex-0.1.0.0 (exe:Complex) (first run) | ||
| Configuring library for Complex-0.1.0.0... | ||
| Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. | ||
| Preprocessing library for Complex-0.1.0.0... | ||
| Building library for Complex-0.1.0.0... | ||
| Configuring executable 'Complex' for Complex-0.1.0.0... | ||
| Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. | ||
| Preprocessing executable 'Complex' for Complex-0.1.0.0... | ||
| Building executable 'Complex' for Complex-0.1.0.0... | ||
| # show-build-info Complex exe:Complex | ||
| {"cabal-lib-version":"<CABALVER>","compiler":{"flavour":"ghc","compiler-id":"ghc-<GHCVER>","path":"<GHCPATH>"},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build","-odir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build","-hidir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build","-hiedir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPsingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","<ROOT>/single-2.dist/home/.cabal/store/ghc-<GHCVER>/package.db","-package-db","<ROOT>/single-2.dist/work/dist/packagedb/ghc-<GHCVER>","-package-id","<PACKAGEDEP>","-package-id","<PACKAGEDEP>","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"<ROOT>/","cabal-file":"Complex.cabal"}]} | ||
| # cabal build | ||
| Up to date | ||
| # show-build-info Complex lib | ||
| {"cabal-lib-version":"<CABALVER>","compiler":{"flavour":"ghc","compiler-id":"ghc-<GHCVER>","path":"<GHCPATH>"},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build","-odir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build","-hidir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build","-hiedir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build/autogen","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build/autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build","-optP-include","-optPsingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/build/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","<ROOT>/single-2.dist/home/.cabal/store/ghc-<GHCVER>/package.db","-package-db","<ROOT>/single-2.dist/work/dist/packagedb/ghc-<GHCVER>","-package-id","<PACKAGEDEP>","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"<ROOT>/","cabal-file":"Complex.cabal"}]} | ||
| # cabal build | ||
| Build profile: -w ghc-<GHCVER> -O1 | ||
| In order, the following will be built: | ||
| - criterion-1.1.4.0 (lib) (requires build) | ||
| - Complex-0.1.0.0 (bench:complex-benchmarks) (first run) | ||
| Configuring library for criterion-1.1.4.0... | ||
| Preprocessing library for criterion-1.1.4.0... | ||
| Building library for criterion-1.1.4.0... | ||
| Installing library in <PATH> | ||
| Configuring benchmark 'complex-benchmarks' for Complex-0.1.0.0... | ||
| Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. | ||
| Preprocessing benchmark 'complex-benchmarks' for Complex-0.1.0.0... | ||
| Building benchmark 'complex-benchmarks' for Complex-0.1.0.0... | ||
| # show-build-info Complex bench:complex-benchmarks | ||
| {"cabal-lib-version":"<CABALVER>","compiler":{"flavour":"ghc","compiler-id":"ghc-<GHCVER>","path":"<GHCPATH>"},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPsingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","<ROOT>/single-2.dist/home/.cabal/store/ghc-<GHCVER>/package.db","-package-db","<ROOT>/single-2.dist/work/dist/packagedb/ghc-<GHCVER>","-package-id","<PACKAGEDEP>","-package-id","<PACKAGEDEP>","-package-id","<PACKAGEDEP>","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"<ROOT>/","cabal-file":"Complex.cabal"}]} | ||
| # cabal build | ||
| Build profile: -w ghc-<GHCVER> -O1 | ||
| In order, the following will be built: | ||
| - test-framework-0.8.1.1 (lib) (requires build) | ||
| - Complex-0.1.0.0 (test:func-test) (first run) | ||
| Configuring library for test-framework-0.8.1.1... | ||
| Preprocessing library for test-framework-0.8.1.1... | ||
| Building library for test-framework-0.8.1.1... | ||
| Installing library in <PATH> | ||
| Configuring test suite 'func-test' for Complex-0.1.0.0... | ||
| Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. | ||
| Preprocessing test suite 'func-test' for Complex-0.1.0.0... | ||
| Building test suite 'func-test' for Complex-0.1.0.0... | ||
| # show-build-info Complex test:func-test | ||
| {"cabal-lib-version":"<CABALVER>","compiler":{"flavour":"ghc","compiler-id":"ghc-<GHCVER>","path":"<GHCPATH>"},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build","-odir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build","-hidir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build","-hiedir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build","-i","-itest","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPsingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","<ROOT>/single-2.dist/home/.cabal/store/ghc-<GHCVER>/package.db","-package-db","<ROOT>/single-2.dist/work/dist/packagedb/ghc-<GHCVER>","-package-id","<PACKAGEDEP>","-package-id","<PACKAGEDEP>","-package-id","<PACKAGEDEP>","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"<ROOT>/","cabal-file":"Complex.cabal"}]} | ||
| # cabal build | ||
| Build profile: -w ghc-<GHCVER> -O1 | ||
| In order, the following will be built: | ||
| - another-framework-0.8.1.1 (lib) (requires build) | ||
| - Complex-0.1.0.0 (test:unit-test) (first run) | ||
| Configuring library for another-framework-0.8.1.1... | ||
| Preprocessing library for another-framework-0.8.1.1... | ||
| Building library for another-framework-0.8.1.1... | ||
| Installing library in <PATH> | ||
| Configuring test suite 'unit-test' for Complex-0.1.0.0... | ||
| Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. | ||
| Preprocessing test suite 'unit-test' for Complex-0.1.0.0... | ||
| Building test suite 'unit-test' for Complex-0.1.0.0... | ||
| # show-build-info Complex test:unit-test | ||
| {"cabal-lib-version":"<CABALVER>","compiler":{"flavour":"ghc","compiler-id":"ghc-<GHCVER>","path":"<GHCPATH>"},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build","-odir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build","-hidir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build","-hiedir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPsingle-2.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","<ROOT>/single-2.dist/home/.cabal/store/ghc-<GHCVER>/package.db","-package-db","<ROOT>/single-2.dist/work/dist/packagedb/ghc-<GHCVER>","-package-id","<PACKAGEDEP>","-package-id","<PACKAGEDEP>","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"<ROOT>/","cabal-file":"Complex.cabal"}]} |
75 changes: 75 additions & 0 deletions
75
cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.test.hs
This file contains hidden or 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,75 @@ | ||
| {-# LANGUAGE OverloadedStrings #-} | ||
|
|
||
| import Test.Cabal.DecodeShowBuildInfo | ||
| import Test.Cabal.Prelude | ||
|
|
||
| main = cabalTest $ do | ||
| -- the With GHC-9.2+ output contains -this-unit-id | ||
| skipUnlessGhcVersion "^>= 9.2" | ||
| withRepo "repo" $ do | ||
| runShowBuildInfo ["exe:Complex"] | ||
| >> withPlan | ||
| ( do | ||
| recordBuildInfo "Complex" (exe "Complex") | ||
| assertComponent | ||
| "Complex" | ||
| (exe "Complex") | ||
| defCompAssertion | ||
| { modules = ["Other", "Paths_Complex"] | ||
| , sourceFiles = ["Main.lhs"] | ||
| , sourceDirs = ["app"] | ||
| } | ||
| ) | ||
|
|
||
| runShowBuildInfo ["lib:Complex"] | ||
| >> withPlan | ||
| ( do | ||
| recordBuildInfo "Complex" mainLib | ||
| assertComponent | ||
| "Complex" | ||
| mainLib | ||
| defCompAssertion | ||
| { modules = ["A", "B", "C", "D", "Paths_Complex"] | ||
| , sourceDirs = ["src", "doesnt-exist"] | ||
| } | ||
| ) | ||
|
|
||
| runShowBuildInfo ["benchmark:complex-benchmarks"] | ||
| >> withPlan | ||
| ( do | ||
| recordBuildInfo "Complex" (bench "complex-benchmarks") | ||
| assertComponent | ||
| "Complex" | ||
| (bench "complex-benchmarks") | ||
| defCompAssertion | ||
| { modules = ["Paths_Complex"] | ||
| , sourceFiles = ["Main.hs"] | ||
| , sourceDirs = ["benchmark"] | ||
| } | ||
| ) | ||
|
|
||
| runShowBuildInfo ["test:func-test"] | ||
| >> withPlan | ||
| ( do | ||
| recordBuildInfo "Complex" (test "func-test") | ||
| assertComponent | ||
| "Complex" | ||
| (test "func-test") | ||
| defCompAssertion | ||
| { sourceFiles = ["FuncMain.hs"] | ||
| , sourceDirs = ["test"] | ||
| } | ||
| ) | ||
|
|
||
| runShowBuildInfo ["test:unit-test"] | ||
| >> withPlan | ||
| ( do | ||
| recordBuildInfo "Complex" (test "unit-test") | ||
| assertComponent | ||
| "Complex" | ||
| (test "unit-test") | ||
| defCompAssertion | ||
| { sourceFiles = ["UnitMain.hs"] | ||
| , sourceDirs = ["test"] | ||
| } | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.