Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cabal-install/src/Distribution/Client/ProjectConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ readProjectFileSkeletonGen
monitorFiles [monitorFileHashed extensionFile]
pcs <- liftIO $ parseConfig extensionFile
let paths =
[ projectConfigPathRoot path
[ currentProjectConfigPath path
| (Nothing, path) <- projectSkeletonImports pcs
]
for_ paths $ \p -> do
Expand Down
5 changes: 0 additions & 5 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,6 @@ sanityCheckElaboratedConfiguredPackage
ElabPackage pkg -> sanityCheckElaboratedPackage elab pkg
ElabComponent comp -> sanityCheckElaboratedComponent elab comp
)
-- The assertion below fails occasionally for unknown reason
-- so it was muted until we figure it out, otherwise it severely
-- hinders our ability to share and test development builds of cabal-install.
-- Tracking issue: https://github.com/haskell/cabal/issues/6006
--
-- either a package is being built inplace, or the
-- 'installedPackageId' we assigned is consistent with
-- the 'hashedInstalledPackageId' we would compute from
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Monitor existing: <ROOT>/cabal.project
Monitor imported: nested/hop.config (<ROOT>/nested/hop.config)
Monitor imported: nested/deeply-nested/hop.config (<ROOT>/nested/deeply-nested/hop.config)
Monitor imported: test/tests-toggle.config (<ROOT>/test/tests-toggle.config)
Monitor nonexistent: <ROOT>/cabal.project.freeze
Monitor nonexistent: <ROOT>/cabal.project.local
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ main = do
cabalTest' "main-project" . recordMode DoNotRecord $ do
let opts = ["--project-file=cabal.project"]
expectedMonitoring <-
-- TODO: When fixed, use expected output, not the actual output and delete
-- the actual output file.
-- readFileVerbatim "cabal.main-project.expect.txt"
readFileVerbatim "cabal.main-project.actual.txt"
readFileVerbatim "cabal.main-project.expect.txt"
runProjectTest expectedMonitoring opts
runCommandTest opts
runConfigureTest "cabal.project.local" opts
Expand All @@ -32,20 +29,14 @@ main = do
cabalTest' "local-only" . recordMode DoNotRecord $ do
let opts = ["--project-file=cabal.local-only.project"]
expectedMonitoring <-
-- TODO: When fixed, use expected output, not the actual output and delete
-- the actual output file.
-- readFileVerbatim "cabal.local-only.expect.txt"
readFileVerbatim "cabal.local-only.actual.txt"
readFileVerbatim "cabal.local-only.expect.txt"
runProjectTest expectedMonitoring opts
runCommandTest opts

cabalTest' "freeze-only" . recordMode DoNotRecord $ do
let opts = ["--project-file=cabal.freeze-only.project"]
expectedMonitoring <-
-- TODO: When fixed, use expected output, not the actual output and delete
-- the actual output file.
-- readFileVerbatim "cabal.freeze-only.expect.txt"
readFileVerbatim "cabal.freeze-only.actual.txt"
readFileVerbatim "cabal.freeze-only.expect.txt"
runProjectTest expectedMonitoring opts
runCommandTest opts
runConfigureTest "cabal.freeze-only.project.local" opts
Expand Down Expand Up @@ -131,10 +122,10 @@ runProjectTest expectMsg projOpts = do
cwd <- testCurrentDir <$> getTestEnv
let configFile = cwd </> "test" </> "tests-toggle.config"
liftIO $ writeFile configFile "package *\n tests: False"
-- TODO: If project imports were properly monitored, the build
-- should succeed without a clean. When fixed, remove the clean.
-- NOTE: When project imports are properly monitored, the build succeeds
-- without a clean or touching the root project file. The change to the
-- imported file is noticed.
log "A clean should not be necessary with proper monitoring of files a project imports."
_ <- cabal' "clean" projOpts
projDisabledTests <- cabal' "build" projOpts
assertOutputDoesNotContain testNotYetImplementedMsg projDisabledTests
assertOutputDoesNotContain failureMsg projDisabledTests
Expand Down
53 changes: 48 additions & 5 deletions cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,45 @@
{-# LANGUAGE NondecreasingIndentation #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wno-duplicate-exports #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}

-- | Generally useful definitions that we expect most test scripts
-- to use.
module Test.Cabal.Prelude
( module Test.Cabal.Prelude
( -- * Assertions

-- ** Assert Marked Output
-- $marked-output
assertOutputContains
, assertOutputDoesNotContain
, assertOutputMatches
, assertOutputDoesNotMatch
, assertOn

-- ** Assert File
, assertFileDoesContain
, assertFileDoesNotContain
, assertFindInFile
, assertAnyFileContains
, assertNoFileContains

-- ** Assert Glob
, assertGlobMatches
, assertGlobDoesNotMatch
, assertGlobMatchesTestDir
, assertGlobDoesNotMatchTestDir

-- ** Other Assertions
, assertBool
, assertEqual
, assertExitCode
, assertFailure
, assertNotEqual
, assertRegex

-- * Re-exports
, module Test.Cabal.Prelude
, module Test.Cabal.Monad
, module Test.Cabal.NeedleHaystack
, module Test.Cabal.Run
Expand Down Expand Up @@ -36,9 +69,6 @@ import Distribution.Simple.Configure
import Distribution.Simple.PackageDescription (readGenericPackageDescription)
import Distribution.Simple.Program
import Distribution.Simple.Utils
( tryFindPackageDesc
, withFileContents
)
import Distribution.System (Arch (JavaScript), OS (Linux, OSX, Windows), buildArch, buildOS)
import Distribution.Types.LocalBuildInfo
import Distribution.Utils.Path
Expand Down Expand Up @@ -67,7 +97,7 @@ import qualified Data.ByteString.Base16 as Base16
import qualified Data.ByteString.Char8 as C
import qualified Data.ByteString.Lazy as BSL
import qualified Data.Char as Char
import Data.List (isInfixOf, isPrefixOf, stripPrefix)
import Data.List (isPrefixOf, stripPrefix)
import Data.Maybe (fromMaybe, isJust, mapMaybe)
import Network.Wait (waitTcpVerbose)
import System.Directory
Expand All @@ -85,6 +115,19 @@ import System.Process
import System.Posix.Resource
#endif

-- $marked-output
-- When asserting on the output of a command we only have access to the marked
-- output. That is the output between these markers:
--
-- @
-- -----BEGIN CABAL OUTPUT-----
-- -----END CABAL OUTPUT-----
-- @
--
-- This is the output from 'notice' and `warn` messages. It does not include the
-- output from `debug` or `info` messages. This is mostly because the output
-- from `debug` and `info` messages is not expected to be deterministic.

------------------------------------------------------------------------

-- * Utilities
Expand Down
9 changes: 9 additions & 0 deletions changelog.d/12077.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
synopsis: Fix monitoring of project file imports
packages: [cabal-install]
prs: 12077
issues: [10255]
---

Watch for changes in all project files, the root `cabal.project` and all local
files it imports. We don't monitor remote URI imports.
Loading