Un-ignore .bat files
[cabal.git] / cabal-testsuite / PackageTests / ExtraCompilationArtifacts / test.hs
blob44141cdb7b742f015a7ad0572e1c5b43a4d94d78
1 import Distribution.Simple.LocalBuildInfo
2 import Test.Cabal.Prelude
3 import System.Directory
4 import System.FilePath
6 -- Test if extra-compilation-artifacts are installed
7 main = setupAndCabalTest . recordMode DoNotRecord $ do
8 withPackageDb $ do
9 setup "configure" []
10 setup "build" []
11 generateExtraCompArtifactsToBuildDir
12 setup "copy" []
14 lbi <- getLocalBuildInfoM
15 let installedLibPath = libdir $ absoluteInstallDirs (localPkgDescr lbi) lbi NoCopyDest
17 shouldExist $ installedLibPath </> "extra-compilation-artifacts" </> "ghc-plugin-X" </> "data-dir" </> "content-A.txt"
18 shouldExist $ installedLibPath </> "extra-compilation-artifacts" </> "ghc-plugin-X" </> "data-dir" </> "content-B.txt"
19 shouldExist $ installedLibPath </> "extra-compilation-artifacts" </> "ghc-plugin-Y" </> "content-Y.txt"
21 generateExtraCompArtifactsToBuildDir :: TestM ()
22 generateExtraCompArtifactsToBuildDir = do
23 -- extra compilation artifacts can be generated optionally by ghc plugins
24 dist_dir <- fmap testDistDir getTestEnv
25 let genArtifact fname = liftIO $ do
26 let dst = dist_dir </> "build" </> "extra-compilation-artifacts" </> fname
27 createDirectoryIfMissing True (takeDirectory dst)
28 writeFile dst ""
29 genArtifact $ "ghc-plugin-X" </> "data-dir" </> "content-A.txt"
30 genArtifact $ "ghc-plugin-X" </> "data-dir" </> "content-B.txt"
31 genArtifact $ "ghc-plugin-Y" </> "content-Y.txt"