Skip to content

Commit

Permalink
Rename the changelog with *.md extension
Browse files Browse the repository at this point in the history
- Add a section on cabal-testsuite changes
  • Loading branch information
philderbeast committed Dec 23, 2024
1 parent a7a092e commit 80552bc
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 34 deletions.
34 changes: 0 additions & 34 deletions changelog.d/pr-10646

This file was deleted.

71 changes: 71 additions & 0 deletions changelog.d/pr-10646.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
synopsis: Configuration messages without duplicates
packages: [cabal-install-solver]
prs: 10646
issues: 10645
---

The "using configuration from" message no longer has duplicates on Windows when
the `cabal.project` uses forward slashes for its imports but the message reports
imports with backslashes.

```diff
$ cat cabal.project
import: dir-a/b.config

$ cabal build all --dry-run
...
When using configuration from:
- - dir-a/b.config
- dir-a\b.config
- cabal.project
```

## Changed `Ord ProjectConfigPath` Instance

For comparison purposes, path separators are normalized to the `buildOS`
platform's path separator.

```haskell
-- >>> let abFwd = ProjectConfigPath $ "a/b.config" :| []
-- >>> let abBwd = ProjectConfigPath $ "a\\b.config" :| []
-- >>> compare abFwd abBwd
-- EQ
```

## Changes in `cabal-testsuite`

With `ghc-9.12.1` adding `-XMultilineStrings` it would be easier to write
multiline strings in `cabal-testsuite/PackageTests/**/*.test.hs` scripts but the
catch is we run these tests with older `GHC` versions so would need to use
`-XCPP` for those versions and the C preprocessor does not play nicely with
string gaps. To avoid these problems a `readVerbatimFile` function can be used
to read the expected multiline output for tests verbatim. This has the same
implementation as `readFile` from the `strict-io` package to avoid problems at
cleanup.

```
Warning: Windows file locking hack: hit the retry limit 3 while trying to
remove C:\Users\phild\AppData\Local\Temp\cabal-testsuite-8376
cabal.test.hs:
C:\Users\<username>\AppData\Local\Temp\cabal-testsuite-8376\errors.expect.txt:
removePathForcibly:DeleteFile
"\\\\?\\C:\\Users\\<username>\\AppData\\Local\\Temp\\cabal-testsuite-8376\\errors.expect.txt":
permission denied (The process cannot access the file because it is being
used by another process.)
```

The other process accessing the file is `C:\WINDOWS\System32\svchost.exe`
running a `QueryDirectory` event and this problem only occurs when the test
fails.

The `assertOutputContains` function was modifying the output but in a way not
"visible" enough. An added `assertOn` function (that `assertOutputContains`
calls) takes a `NeedleHaystack` configuration for how the search is made, what
to expect and and how to display the expected and actual values. A pilcrow ¶ is
often used to visibly display line endings but our terminal output is restricted
to ASCII so lines are visibly delimited between `^` and `$` visible markers. The
needle (the expected output fragment) is shown annotated this way and the
haystack (the output) can optionally be shown this way too.

The `concatOutput` function is renamed to `lineBreaksToSpaces`.

0 comments on commit 80552bc

Please sign in to comment.