From 46e8fd638734fe1c67d95a655ef9c759964e4800 Mon Sep 17 00:00:00 2001 From: Rodrigo Mesquita Date: Wed, 22 Nov 2023 16:06:39 +0000 Subject: [PATCH] Allow per-component builds with coverage enabled This commits re-enables per-component builds when coverage checking is enabled. This restriction was previously added in #5004 to fix #4798. However, the fix for #5213, in #7493, fixes the paths of the testsuite `.mix` files to the same location as that of the main library component, which in turn fixes #4798 as well -- meaning the restriction to treat testsuites per-package (legacy-fallback) is no longer needed. 1. We allow hpc in per-component builds 2. To generate hpc files in the appropriate component directories in the distribution tree, we move the hack from #7493 from dictating the `.mix` directories where hpc information is stored to dictating the `.mix` directories that are included in the call to `hpc markup`. We also drop an unnecessary directory in the hpc file hierarchy. 3. To account for internal libraries, we include the mix dirs and exposed modules of all (non-indefinite) libraries in the package 4. We only add non-indefinite libraries to the hpc markup command. Indefinite libraries and instantiations are ignored as it is not obvious what it means for HPC to support backpack, e.g. covering a library function that two different instantiations The combination of (1,3) fix #6440, and adding (4) fixes #6397 Includes regression tests for #6440, #6397, and #4798 (the test for #5213 already exists) Fixes #6440, #6397, and fixes in a new way the previously fixed #4798, #5213. --- Cabal/src/Distribution/Simple/GHC.hs | 4 +- Cabal/src/Distribution/Simple/GHCJS.hs | 4 +- Cabal/src/Distribution/Simple/Hpc.hs | 144 +++++++++++------- Cabal/src/Distribution/Simple/Test/ExeV10.hs | 7 +- Cabal/src/Distribution/Simple/Test/LibV09.hs | 8 +- .../src/Distribution/Types/LocalBuildInfo.hs | 1 + .../Distribution/Client/ProjectPlanning.hs | 8 +- .../Backpack/Includes2/Includes2.cabal | 7 + .../Includes2/enable-coverage.test.hs | 4 + .../PackageTests/Regression/T4798/T4798.cabal | 18 +++ .../Regression/T4798/cabal.project | 1 + .../Regression/T4798/cabal.test.hs | 3 + .../PackageTests/Regression/T4798/src/U2F.hs | 6 + .../Regression/T4798/src/U2F/Types.hs | 3 + .../Regression/T4798/tests/test.hs | 6 + .../Regression/T6440/cabal.project | 2 + .../Regression/T6440/cabal.test.hs | 2 + .../Regression/T6440/cabal6440.cabal | 23 +++ .../PackageTests/Regression/T6440/src/Top.hs | 5 + .../Regression/T6440/srcint/Inn.hs | 4 + .../Regression/T6440/tests/Main.hs | 6 + .../ExeV10/setup-no-markup.test.hs | 2 +- 22 files changed, 196 insertions(+), 72 deletions(-) create mode 100644 cabal-testsuite/PackageTests/Backpack/Includes2/enable-coverage.test.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T4798/T4798.cabal create mode 100644 cabal-testsuite/PackageTests/Regression/T4798/cabal.project create mode 100644 cabal-testsuite/PackageTests/Regression/T4798/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T4798/src/U2F.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T4798/src/U2F/Types.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T4798/tests/test.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T6440/cabal.project create mode 100644 cabal-testsuite/PackageTests/Regression/T6440/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal create mode 100644 cabal-testsuite/PackageTests/Regression/T6440/src/Top.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T6440/srcint/Inn.hs create mode 100644 cabal-testsuite/PackageTests/Regression/T6440/tests/Main.hs diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 3c380a41a86..ba381a253e6 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -651,7 +651,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do distPref = fromFlag $ configDistPref $ configFlags lbi hpcdir way | forRepl = mempty -- HPC is not supported in ghci - | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way pkg_name + | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way | otherwise = mempty createDirectoryIfMissingVerbose verbosity True libTargetDir @@ -1548,7 +1548,7 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do distPref = fromFlag $ configDistPref $ configFlags lbi hpcdir way | gbuildIsRepl bm = mempty -- HPC is not supported in ghci - | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way (gbuildName bm) + | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way | otherwise = mempty rpaths <- getRPaths lbi clbi diff --git a/Cabal/src/Distribution/Simple/GHCJS.hs b/Cabal/src/Distribution/Simple/GHCJS.hs index 58194f5ffa3..cc9de70f593 100644 --- a/Cabal/src/Distribution/Simple/GHCJS.hs +++ b/Cabal/src/Distribution/Simple/GHCJS.hs @@ -523,7 +523,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do distPref = fromFlag $ configDistPref $ configFlags lbi hpcdir way | forRepl = mempty -- HPC is not supported in ghci - | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way pkg_name + | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way | otherwise = mempty createDirectoryIfMissingVerbose verbosity True libTargetDir @@ -1243,7 +1243,7 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do distPref = fromFlag $ configDistPref $ configFlags lbi hpcdir way | gbuildIsRepl bm = mempty -- HPC is not supported in ghci - | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way (gbuildName bm) + | isCoverageEnabled = toFlag $ Hpc.mixDir distPref way | otherwise = mempty rpaths <- getRPaths lbi clbi diff --git a/Cabal/src/Distribution/Simple/Hpc.hs b/Cabal/src/Distribution/Simple/Hpc.hs index 5d24f190b7e..24eae533596 100644 --- a/Cabal/src/Distribution/Simple/Hpc.hs +++ b/Cabal/src/Distribution/Simple/Hpc.hs @@ -48,6 +48,8 @@ import Distribution.Verbosity (Verbosity ()) import Distribution.Version (anyVersion) import System.Directory (createDirectoryIfMissing, doesFileExist) import System.FilePath +import Distribution.Types.LocalBuildInfo (componentNameCLBIs) +import Distribution.Types.ComponentLocalBuildInfo (componentIsIndefinite) -- ------------------------------------------------------------------------- -- Haskell Program Coverage @@ -73,44 +75,16 @@ mixDir -- ^ \"dist/\" prefix -> Way -> FilePath - -- ^ Component name - -> FilePath -- ^ Directory containing test suite's .mix files -mixDir distPref way name = hpcDir distPrefBuild way "mix" name - where - -- This is a hack for HPC over test suites, needed to match the directory - -- where HPC saves and reads .mix files when the main library of the same - -- package is being processed, perhaps in a previous cabal run (#5213). - -- E.g., @distPref@ may be - -- @./dist-newstyle/build/x86_64-linux/ghc-9.0.1/cabal-gh5213-0.1/t/tests@ - -- but the path where library mix files reside has two less components - -- at the end (@t/tests@) and this reduced path needs to be passed to - -- both @hpc@ and @ghc@. For non-default optimization levels, the path - -- suffix is one element longer and the extra path element needs - -- to be preserved. - distPrefElements = splitDirectories distPref - distPrefBuild = case drop (length distPrefElements - 3) distPrefElements of - ["t", _, "noopt"] -> - joinPath $ - take (length distPrefElements - 3) distPrefElements - ++ ["noopt"] - ["t", _, "opt"] -> - joinPath $ - take (length distPrefElements - 3) distPrefElements - ++ ["opt"] - [_, "t", _] -> - joinPath $ take (length distPrefElements - 2) distPrefElements - _ -> distPref +mixDir distPref way = hpcDir distPref way "mix" tixDir :: FilePath -- ^ \"dist/\" prefix -> Way -> FilePath - -- ^ Component name - -> FilePath -- ^ Directory containing test suite's .tix files -tixDir distPref way name = hpcDir distPref way "tix" name +tixDir distPref way = hpcDir distPref way "tix" -- | Path to the .tix file containing a test suite's sum statistics. tixFilePath @@ -121,17 +95,15 @@ tixFilePath -- ^ Component name -> FilePath -- ^ Path to test suite's .tix file -tixFilePath distPref way name = tixDir distPref way name name <.> "tix" +tixFilePath distPref way name = tixDir distPref way name <.> "tix" htmlDir :: FilePath -- ^ \"dist/\" prefix -> Way -> FilePath - -- ^ Component name - -> FilePath -- ^ Path to test suite's HTML markup directory -htmlDir distPref way name = hpcDir distPref way "html" name +htmlDir distPref way = hpcDir distPref way "html" -- | Attempt to guess the way the test suites in this package were compiled -- and linked with the library so the correct module interfaces are found. @@ -146,14 +118,12 @@ markupTest :: Verbosity -> LocalBuildInfo -> FilePath - -- ^ \"dist/\" prefix - -> String - -- ^ Library name + -- ^ Testsuite \"dist/\" prefix + -> PD.PackageDescription -> TestSuite - -> Library -> IO () -markupTest verbosity lbi distPref libraryName suite library = do - tixFileExists <- doesFileExist $ tixFilePath distPref way $ testName' +markupTest verbosity lbi testDistPref pkg_descr suite = do + tixFileExists <- doesFileExist $ tixFilePath testDistPref way $ testName' when tixFileExists $ do -- behaviour of 'markup' depends on version, so we need *a* version -- but no particular one @@ -163,15 +133,15 @@ markupTest verbosity lbi distPref libraryName suite library = do hpcProgram anyVersion (withPrograms lbi) - let htmlDir_ = htmlDir distPref way testName' + let htmlDir_ = htmlDir testDistPref way markup hpc hpcVer verbosity - (tixFilePath distPref way testName') + (tixFilePath testDistPref way testName') mixDirs htmlDir_ - (exposedModules library) + included notice verbosity $ "Test coverage report written to " ++ htmlDir_ @@ -179,19 +149,20 @@ markupTest verbosity lbi distPref libraryName suite library = do where way = guessWay lbi testName' = unUnqualComponentName $ testName suite - mixDirs = map (mixDir distPref way) [testName', libraryName] + mixDirs = mixDir testDistPref way : map (libMixDir way testDistPref) (nonIndefiniteLibraries lbi pkg_descr) + included = concatMap exposedModules $ nonIndefiniteLibraries lbi pkg_descr -- | Generate the HTML markup for all of a package's test suites. markupPackage :: Verbosity -> LocalBuildInfo -> FilePath - -- ^ \"dist/\" prefix + -- ^ Testsuite \"dist/\" prefix -> PD.PackageDescription -> [TestSuite] -> IO () -markupPackage verbosity lbi distPref pkg_descr suites = do - let tixFiles = map (tixFilePath distPref way) testNames +markupPackage verbosity lbi testDistPref pkg_descr suites = do + let tixFiles = map (tixFilePath testDistPref way) testNames tixFilesExist <- traverse doesFileExist tixFiles when (and tixFilesExist) $ do -- behaviour of 'markup' depends on version, so we need *a* version @@ -202,8 +173,8 @@ markupPackage verbosity lbi distPref pkg_descr suites = do hpcProgram anyVersion (withPrograms lbi) - let outFile = tixFilePath distPref way libraryName - htmlDir' = htmlDir distPref way libraryName + let outFile = tixFilePath testDistPref way pkgName + htmlDir' = htmlDir testDistPref way excluded = concatMap testModules suites ++ [main] createDirectoryIfMissing True $ takeDirectory outFile union hpc verbosity tixFiles outFile excluded @@ -215,6 +186,75 @@ markupPackage verbosity lbi distPref pkg_descr suites = do where way = guessWay lbi testNames = fmap (unUnqualComponentName . testName) suites - mixDirs = map (mixDir distPref way) $ libraryName : testNames - included = concatMap (exposedModules) $ PD.allLibraries pkg_descr - libraryName = prettyShow $ PD.package pkg_descr + pkgName = prettyShow $ PD.package pkg_descr + mixDirs = mixDir testDistPref way : map (libMixDir way testDistPref) (nonIndefiniteLibraries lbi pkg_descr) + included = concatMap exposedModules $ nonIndefiniteLibraries lbi pkg_descr + +-- | Get all the non-indefinite libraries in a package, ignoring indefinite +-- components and their instantiations. +-- HPC doesn't support backpack (eg. would does it mean to cover a module of a +-- library that is instantiated in two different ways?), so we invoke this +-- function to determine which library hpc dirs to add to the include path of +-- the hpc markup command. +nonIndefiniteLibraries :: LocalBuildInfo -> PD.PackageDescription -> [Library] +nonIndefiniteLibraries lbi pkg_desc + = [ lib + | lib <- PD.allLibraries pkg_desc + -- We only care about libraries with exactly one CLBI. + -- If there were more than one CLBI, they would be the indefinite CLBI and + -- the multiple instantiations. + -- Because backpack is unsupported by hpc, we ignore all indefinite components + , [c] <- pure $ componentNameCLBIs lbi (PD.CLibName (libName lib)) + , not $ componentIsIndefinite c + ] + +-- | Determine the path to the library's `.mix` dir for the given way +libMixDir :: Way + -> FilePath + -- ^ Testsuite dist-dir prefix (needed in the pathToLibHpc hack) + -> Library + -> FilePath +libMixDir way testDistPref lib = pathToLibHpc testDistPref (PD.libName lib) `mixDir` way + + +-- | A (non-exported) hack to determine the path to the main and internal libs +-- directory given the testsuite's dist prefix. +-- +-- We use this function when constructing calls to `hpc markup` since otherwise +-- having cabal-install communicate the path to the main and sub libraries +-- dist-dir when building the test component, via the Setup.hs interface, is +-- far more complicated. +pathToLibHpc :: FilePath -> PD.LibraryName -> FilePath +pathToLibHpc testDistPref libname = distPrefLib + where + -- This is a hack for HPC over test suites, needed to match the directory + -- where HPC saves and reads .mix files when the main library of the same + -- package is being processed, perhaps in a previous cabal run (#5213). + -- E.g., @distPref@ may be + -- @./dist-newstyle/build/x86_64-linux/ghc-9.0.1/cabal-gh5213-0.1/t/tests@ + -- but the path where library mix files reside has two less components + -- at the end (@t/tests@) and this reduced path needs to be passed to + -- both @hpc@ and @ghc@. For non-default optimization levels, the path + -- suffix is one element longer and the extra path element needs + -- to be preserved. + distPrefElements = splitDirectories testDistPref + distPrefLib = case drop (length distPrefElements - 3) distPrefElements of + ["t", _, "noopt"] -> + joinPath $ + take (length distPrefElements - 3) distPrefElements + ++ [distSuffixInternalLib] + ++ ["noopt"] + ["t", _, "opt"] -> + joinPath $ + take (length distPrefElements - 3) distPrefElements + ++ [distSuffixInternalLib] + ++ ["opt"] + [_, "t", _] -> + joinPath $ + take (length distPrefElements - 2) distPrefElements + ++ [distSuffixInternalLib] + _ -> error "pathToLibHpc: Expecting `testDirPref` to be the dist prefix of a test-suite component" + distSuffixInternalLib = case libname of + PD.LMainLibName -> "" + PD.LSubLibName slname -> "l" unUnqualComponentName slname + diff --git a/Cabal/src/Distribution/Simple/Test/ExeV10.hs b/Cabal/src/Distribution/Simple/Test/ExeV10.hs index 04c7e30073a..9d716fbd7c2 100644 --- a/Cabal/src/Distribution/Simple/Test/ExeV10.hs +++ b/Cabal/src/Distribution/Simple/Test/ExeV10.hs @@ -10,7 +10,6 @@ import Prelude () import Distribution.Compat.Environment import qualified Distribution.PackageDescription as PD -import Distribution.Pretty import Distribution.Simple.Build.PathsModule import Distribution.Simple.BuildPaths import Distribution.Simple.Compiler @@ -51,7 +50,7 @@ runTest runTest pkg_descr lbi clbi flags suite = do let isCoverageEnabled = LBI.testCoverage lbi way = guessWay lbi - tixDir_ = tixDir distPref way testName' + tixDir_ = tixDir distPref way pwd <- getCurrentDirectory existingEnv <- getEnvironment @@ -174,8 +173,8 @@ runTest pkg_descr lbi clbi flags suite = do case PD.library pkg_descr of Nothing -> dieWithException verbosity TestCoverageSupport - Just library -> - markupTest verbosity lbi distPref (prettyShow $ PD.package pkg_descr) suite library + Just _library -> + markupTest verbosity lbi distPref pkg_descr suite return suiteLog where diff --git a/Cabal/src/Distribution/Simple/Test/LibV09.hs b/Cabal/src/Distribution/Simple/Test/LibV09.hs index b87897bfed7..8ca3bd87ba5 100644 --- a/Cabal/src/Distribution/Simple/Test/LibV09.hs +++ b/Cabal/src/Distribution/Simple/Test/LibV09.hs @@ -80,12 +80,12 @@ runTest pkg_descr lbi clbi flags suite = do -- Remove old .tix files if appropriate. unless (fromFlag $ testKeepTix flags) $ do - let tDir = tixDir distPref way testName' + let tDir = tixDir distPref way exists' <- doesDirectoryExist tDir when exists' $ removeDirectoryRecursive tDir -- Create directory for HPC files. - createDirectoryIfMissing True $ tixDir distPref way testName' + createDirectoryIfMissing True $ tixDir distPref way -- Write summary notices indicating start of test suite notice verbosity $ summarizeSuiteStart testName' @@ -189,8 +189,8 @@ runTest pkg_descr lbi clbi flags suite = do case PD.library pkg_descr of Nothing -> dieWithException verbosity TestCoverageSupportLibV09 - Just library -> - markupTest verbosity lbi distPref (prettyShow $ PD.package pkg_descr) suite library + Just _library -> + markupTest verbosity lbi distPref pkg_descr suite return suiteLog where diff --git a/Cabal/src/Distribution/Types/LocalBuildInfo.hs b/Cabal/src/Distribution/Types/LocalBuildInfo.hs index 116d5db264e..5d85b09aac5 100644 --- a/Cabal/src/Distribution/Types/LocalBuildInfo.hs +++ b/Cabal/src/Distribution/Types/LocalBuildInfo.hs @@ -108,6 +108,7 @@ data LocalBuildInfo = LocalBuildInfo , componentNameMap :: Map ComponentName [ComponentLocalBuildInfo] -- ^ A map from component name to all matching -- components. These coincide with 'componentGraph' + -- There may be more than one matching component because of backpack instantiations , promisedPkgs :: Map (PackageName, ComponentName) ComponentId -- ^ The packages we were promised, but aren't already installed. -- MP: Perhaps this just needs to be a Set UnitId at this stage. diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning.hs b/cabal-install/src/Distribution/Client/ProjectPlanning.hs index 44372967fdb..8b5b6e07900 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning.hs @@ -1673,7 +1673,7 @@ elaborateInstallPlan where -- You are eligible to per-component build if this list is empty why_not_per_component g = - cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag ++ cuz_coverage + cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag where cuz reason = [text reason] -- We have to disable per-component for now with @@ -1710,12 +1710,6 @@ elaborateInstallPlan | fromFlagOrDefault True (projectConfigPerComponent sharedPackageConfig) = [] | otherwise = cuz "you passed --disable-per-component" - -- Enabling program coverage introduces odd runtime dependencies - -- between components. - cuz_coverage - | fromFlagOrDefault False (packageConfigCoverage localPackagesConfig) = - cuz "program coverage is enabled" - | otherwise = [] -- \| Sometimes a package may make use of features which are only -- supported in per-package mode. If this is the case, we should diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal index 7a02fcd961c..51c4768bb06 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal @@ -39,3 +39,10 @@ executable exe main-is: Main.hs hs-source-dirs: exe default-language: Haskell2010 + +test-suite test + type: exitcode-stdio-1.0 + build-depends: base, Includes2 + main-is: test.hs + hs-source-dirs: test + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/enable-coverage.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/enable-coverage.test.hs new file mode 100644 index 00000000000..47704952f28 --- /dev/null +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/enable-coverage.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude +main = cabalTest $ do + skipUnlessGhcVersion ">= 8.1" + cabal "test" ["--enable-coverage"] diff --git a/cabal-testsuite/PackageTests/Regression/T4798/T4798.cabal b/cabal-testsuite/PackageTests/Regression/T4798/T4798.cabal new file mode 100644 index 00000000000..d51b290b569 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T4798/T4798.cabal @@ -0,0 +1,18 @@ +cabal-version: 3.0 +name: T4798 +version: 0.1 + +library + exposed-modules: U2F, U2F.Types + ghc-options: -Wall + build-depends: base + hs-source-dirs: src + default-language: Haskell2010 + +test-suite hspec-suite + type: exitcode-stdio-1.0 + main-is: test.hs + ghc-options: -Wall + hs-source-dirs: tests + default-language: Haskell2010 + build-depends: base, T4798 diff --git a/cabal-testsuite/PackageTests/Regression/T4798/cabal.project b/cabal-testsuite/PackageTests/Regression/T4798/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T4798/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/Regression/T4798/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T4798/cabal.test.hs new file mode 100644 index 00000000000..0d594011fc2 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T4798/cabal.test.hs @@ -0,0 +1,3 @@ +import Test.Cabal.Prelude +main = cabalTest $ cabal "test" ["--enable-coverage"] + diff --git a/cabal-testsuite/PackageTests/Regression/T4798/src/U2F.hs b/cabal-testsuite/PackageTests/Regression/T4798/src/U2F.hs new file mode 100644 index 00000000000..28d9b767995 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T4798/src/U2F.hs @@ -0,0 +1,6 @@ +module U2F where + +import U2F.Types + +ourCurve :: String +ourCurve = show SEC_p256r1 diff --git a/cabal-testsuite/PackageTests/Regression/T4798/src/U2F/Types.hs b/cabal-testsuite/PackageTests/Regression/T4798/src/U2F/Types.hs new file mode 100644 index 00000000000..92accffdcff --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T4798/src/U2F/Types.hs @@ -0,0 +1,3 @@ +module U2F.Types where + +data Curve = SEC_p256r1 deriving Show diff --git a/cabal-testsuite/PackageTests/Regression/T4798/tests/test.hs b/cabal-testsuite/PackageTests/Regression/T4798/tests/test.hs new file mode 100644 index 00000000000..e637e0cf66b --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T4798/tests/test.hs @@ -0,0 +1,6 @@ +import U2F +import U2F.Types + +main = print ourCurve +main :: IO () + diff --git a/cabal-testsuite/PackageTests/Regression/T6440/cabal.project b/cabal-testsuite/PackageTests/Regression/T6440/cabal.project new file mode 100644 index 00000000000..b764c340a62 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T6440/cabal.project @@ -0,0 +1,2 @@ +packages: . + diff --git a/cabal-testsuite/PackageTests/Regression/T6440/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T6440/cabal.test.hs new file mode 100644 index 00000000000..0932c665f31 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T6440/cabal.test.hs @@ -0,0 +1,2 @@ +import Test.Cabal.Prelude +main = cabalTest $ cabal "test" ["--enable-coverage"] diff --git a/cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal b/cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal new file mode 100644 index 00000000000..42192a71672 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T6440/cabal6440.cabal @@ -0,0 +1,23 @@ +cabal-version: 3.0 +name: cabal6440 +version: 0.1 + +library + exposed-modules: Top + -- other-extensions: + build-depends: base, cabal6440:intern6440 + hs-source-dirs: src + default-language: Haskell2010 + +library intern6440 + exposed-modules: Inn + build-depends: base + hs-source-dirs: srcint + + +test-suite tests + main-is: Main.hs + type: exitcode-stdio-1.0 + build-depends: base, cabal6440 + hs-source-dirs: tests + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Regression/T6440/src/Top.hs b/cabal-testsuite/PackageTests/Regression/T6440/src/Top.hs new file mode 100644 index 00000000000..66539d28e3b --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T6440/src/Top.hs @@ -0,0 +1,5 @@ +module Top where +import Inn + +foo :: String +foo = bar diff --git a/cabal-testsuite/PackageTests/Regression/T6440/srcint/Inn.hs b/cabal-testsuite/PackageTests/Regression/T6440/srcint/Inn.hs new file mode 100644 index 00000000000..e77f8fd85a3 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T6440/srcint/Inn.hs @@ -0,0 +1,4 @@ +module Inn where + +bar :: String +bar = "internal" diff --git a/cabal-testsuite/PackageTests/Regression/T6440/tests/Main.hs b/cabal-testsuite/PackageTests/Regression/T6440/tests/Main.hs new file mode 100644 index 00000000000..89a8e05f0e5 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T6440/tests/Main.hs @@ -0,0 +1,6 @@ +module Main where + +import Top + +main :: IO () +main = print foo diff --git a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup-no-markup.test.hs b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup-no-markup.test.hs index 99140253d55..4db84dcec46 100644 --- a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup-no-markup.test.hs +++ b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/setup-no-markup.test.hs @@ -13,4 +13,4 @@ main = setupAndCabalTest $ do , "--ghc-option=-hpcdir" , "--ghc-option=" ++ dist_dir ++ "/hpc/vanilla" ] setup "test" ["test-Short", "--show-details=direct"] - shouldNotExist $ htmlDir dist_dir Vanilla "test-Short" "hpc_index.html" + shouldNotExist $ htmlDir dist_dir Vanilla "hpc_index.html"