Skip to content
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

Fix Windows tests #10186

Merged
merged 8 commits into from
Jul 18, 2024
Merged
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ testdb/intree/store/*/package.db/package.cache.lock

# windows test artifacts
cabal-testsuite/**/*.exe
cabal-testsuite/**/*.bat
jasagredo marked this conversation as resolved.
Show resolved Hide resolved
cabal-testsuite/**/haddocks

# python artifacts from documentation builds
Expand Down
7 changes: 7 additions & 0 deletions Cabal/src/Distribution/Simple/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,13 @@ exeExtensions = case (buildArch, buildOS) of
-- Possible improvement: on Windows, read the list of extensions from the
-- PATHEXT environment variable. By default PATHEXT is ".com; .exe; .bat;
-- .cmd".
--
-- See also #10179.
--
-- Also we cannot actually run @.bat@ files as we do now, because of
-- https://github.com/haskell/process/issues/140. If we detect one of those,
-- we should record that the program is a script and run a @Process.shell@ instead
-- of a @Process.proc@.
(_, Windows) -> ["", "exe"]
(_, Ghcjs) -> ["", "exe"]
(Wasm32, _) -> ["", "wasm"]
Expand Down
4 changes: 2 additions & 2 deletions cabal-install/src/Distribution/Client/IndexUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ import System.FilePath
, (<.>)
, (</>)
)
import qualified System.FilePath.Posix as FilePath.Posix
import qualified System.FilePath as FilePath
import System.IO
import System.IO.Error (isDoesNotExistError)
import System.IO.Unsafe (unsafeInterleaveIO)
Expand Down Expand Up @@ -928,7 +928,7 @@ withIndexEntries verbosity (RepoIndex _repoCtxt (RepoLocalNoIndex (LocalRepo nam
let bs = BS.toStrict contents
in ((`CacheGPD` bs) <$> parseGenericPackageDescriptionMaybe bs)
where
filename = prettyShow pkgId FilePath.Posix.</> prettyShow (packageName pkgId) ++ ".cabal"
filename = prettyShow pkgId FilePath.</> prettyShow (packageName pkgId) ++ ".cabal"
jasagredo marked this conversation as resolved.
Show resolved Hide resolved
readCabalEntry _ _ x = x
withIndexEntries verbosity index callback _ = do
-- non-secure repositories
Expand Down
60 changes: 31 additions & 29 deletions cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,38 @@ import Test.Cabal.Prelude
import Data.Foldable (traverse_)
import Distribution.Simple.Utils
import System.Directory
main = cabalTest $ do
-- Test the forbidden characters except NUL. Reference:
-- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions
main = do
-- Most of these are magic on Windows, so don't bother testing there.
--
-- Note: we bundle the configure script so no need to autoreconf
-- while building
skipIfWindows
traverse_ check
[ "foo bar"
, "foo\tbar"
, "foo\nbar"
, "foo\"bar"
, "foo#bar"
, "foo$bar"
, "foo&bar"
, "foo'bar"
, "foo(bar"
, "foo)bar"
, "foo*bar"
, "foo;bar"
, "foo<bar"
, "foo=bar"
, "foo>bar"
, "foo?bar"
, "foo[bar"
, "foo\\bar"
, "foo`bar"
, "foo|bar"
]
skipIfWindows "uninteresting"
cabalTest $
-- Test the forbidden characters except NUL. Reference:
-- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions
--
-- Note: we bundle the configure script so no need to autoreconf
-- while building

traverse_ check
[ "foo bar"
, "foo\tbar"
, "foo\nbar"
, "foo\"bar"
, "foo#bar"
, "foo$bar"
, "foo&bar"
, "foo'bar"
, "foo(bar"
, "foo)bar"
, "foo*bar"
, "foo;bar"
, "foo<bar"
, "foo=bar"
, "foo>bar"
, "foo?bar"
, "foo[bar"
, "foo\\bar"
, "foo`bar"
, "foo|bar"
]
where
setup dir = do
env <- getTestEnv
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Includes2
name: I
version: 0.1.0.0
jasagredo marked this conversation as resolved.
Show resolved Hide resolved
license: BSD3
author: Edward Z. Yang
Expand Down Expand Up @@ -35,14 +35,14 @@ library
default-language: Haskell2010

executable exe
build-depends: base, Includes2
build-depends: base, I
main-is: Main.hs
hs-source-dirs: exe
default-language: Haskell2010

test-suite includes2-test
type: exitcode-stdio-1.0
build-depends: base, Includes2
build-depends: base, I
main-is: test.hs
hs-source-dirs: test
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Includes2
name: I
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
Expand Down Expand Up @@ -35,7 +35,7 @@ library
default-language: Haskell2010

executable exe
build-depends: base, Includes2
build-depends: base, I
main-is: Main.hs
hs-source-dirs: exe
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Test.Cabal.Prelude

main = cabalTest $ do
main = do
cabalTest $ do
skipUnlessGhcVersion ">= 8.1"
skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271
jasagredo marked this conversation as resolved.
Show resolved Hide resolved
withProjectFile "cabal.external.project" $ do
cabal "v2-build" ["exe"]
withPlan $ do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- Includes2-0.1.0.0 (lib:mylib) (first run)
Configuring library 'mylib' for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
- I-0.1.0.0 (lib:mylib) (first run)
Configuring library 'mylib' for I-0.1.0.0...
Preprocessing library 'mylib' for I-0.1.0.0...
Building library 'mylib' instantiated with Database = <Database>
for Includes2-0.1.0.0...
for I-0.1.0.0...
66 changes: 33 additions & 33 deletions cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- Includes2-0.1.0.0 (lib:mylib) (first run)
- Includes2-0.1.0.0 (lib:mysql) (first run)
- Includes2-0.1.0.0 (lib:postgresql) (first run)
- Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-mysql:Database.MySQL) (first run)
- Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run)
- Includes2-0.1.0.0 (lib) (first run)
- Includes2-0.1.0.0 (exe:exe) (first run)
Configuring library 'mylib' for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
- I-0.1.0.0 (lib:mylib) (first run)
- I-0.1.0.0 (lib:mysql) (first run)
- I-0.1.0.0 (lib:postgresql) (first run)
- I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-mysql:Database.MySQL) (first run)
- I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run)
- I-0.1.0.0 (lib) (first run)
- I-0.1.0.0 (exe:exe) (first run)
Configuring library 'mylib' for I-0.1.0.0...
Preprocessing library 'mylib' for I-0.1.0.0...
Building library 'mylib' instantiated with Database = <Database>
for Includes2-0.1.0.0...
Configuring library 'mysql' for Includes2-0.1.0.0...
Preprocessing library 'mysql' for Includes2-0.1.0.0...
Building library 'mysql' for Includes2-0.1.0.0...
Configuring library 'postgresql' for Includes2-0.1.0.0...
Preprocessing library 'postgresql' for Includes2-0.1.0.0...
Building library 'postgresql' for Includes2-0.1.0.0...
for I-0.1.0.0...
Configuring library 'mysql' for I-0.1.0.0...
Preprocessing library 'mysql' for I-0.1.0.0...
Building library 'mysql' for I-0.1.0.0...
Configuring library 'postgresql' for I-0.1.0.0...
Preprocessing library 'postgresql' for I-0.1.0.0...
Building library 'postgresql' for I-0.1.0.0...
Configuring library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL
for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
Database = I-0.1.0.0-inplace-mysql:Database.MySQL
for I-0.1.0.0...
Preprocessing library 'mylib' for I-0.1.0.0...
Building library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL
for Includes2-0.1.0.0...
Database = I-0.1.0.0-inplace-mysql:Database.MySQL
for I-0.1.0.0...
Configuring library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for I-0.1.0.0...
Preprocessing library 'mylib' for I-0.1.0.0...
Building library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for Includes2-0.1.0.0...
Configuring library for Includes2-0.1.0.0...
Preprocessing library for Includes2-0.1.0.0...
Building library for Includes2-0.1.0.0...
Configuring executable 'exe' for Includes2-0.1.0.0...
Preprocessing executable 'exe' for Includes2-0.1.0.0...
Building executable 'exe' for Includes2-0.1.0.0...
# Includes2 exe
Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for I-0.1.0.0...
Configuring library for I-0.1.0.0...
Preprocessing library for I-0.1.0.0...
Building library for I-0.1.0.0...
Configuring executable 'exe' for I-0.1.0.0...
Preprocessing executable 'exe' for I-0.1.0.0...
Building executable 'exe' for I-0.1.0.0...
# I exe
"minemysql minepostgresql"
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import Test.Cabal.Prelude

main = cabalTest $ do
skipUnlessGhcVersion ">= 8.1"
skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271
withProjectFile "cabal.internal.project" $ do
expectBrokenIf isWindows 10191 $ withProjectFile "cabal.internal.project" $ do
cabal "v2-build" ["exe"]
withPlan $ do
r <- runPlanExe' "Includes2" "exe" []
r <- runPlanExe' "I" "exe" []
assertOutputContains "minemysql minepostgresql" r
70 changes: 35 additions & 35 deletions cabal-testsuite/PackageTests/Backpack/Includes2/cov.out
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- Includes2-0.1.0.0 (lib:mylib) (first run)
- Includes2-0.1.0.0 (lib:mysql) (first run)
- Includes2-0.1.0.0 (lib:postgresql) (first run)
- Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-mysql:Database.MySQL) (first run)
- Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run)
- Includes2-0.1.0.0 (lib) (first run)
- Includes2-0.1.0.0 (test:includes2-test) (first run)
Configuring library 'mylib' for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
- I-0.1.0.0 (lib:mylib) (first run)
- I-0.1.0.0 (lib:mysql) (first run)
- I-0.1.0.0 (lib:postgresql) (first run)
- I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-mysql:Database.MySQL) (first run)
- I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run)
- I-0.1.0.0 (lib) (first run)
- I-0.1.0.0 (test:includes2-test) (first run)
Configuring library 'mylib' for I-0.1.0.0...
Preprocessing library 'mylib' for I-0.1.0.0...
Building library 'mylib' instantiated with Database = <Database>
for Includes2-0.1.0.0...
Configuring library 'mysql' for Includes2-0.1.0.0...
Preprocessing library 'mysql' for Includes2-0.1.0.0...
Building library 'mysql' for Includes2-0.1.0.0...
Configuring library 'postgresql' for Includes2-0.1.0.0...
Preprocessing library 'postgresql' for Includes2-0.1.0.0...
Building library 'postgresql' for Includes2-0.1.0.0...
for I-0.1.0.0...
Configuring library 'mysql' for I-0.1.0.0...
Preprocessing library 'mysql' for I-0.1.0.0...
Building library 'mysql' for I-0.1.0.0...
Configuring library 'postgresql' for I-0.1.0.0...
Preprocessing library 'postgresql' for I-0.1.0.0...
Building library 'postgresql' for I-0.1.0.0...
Configuring library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL
for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
Database = I-0.1.0.0-inplace-mysql:Database.MySQL
for I-0.1.0.0...
Preprocessing library 'mylib' for I-0.1.0.0...
Building library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL
for Includes2-0.1.0.0...
Database = I-0.1.0.0-inplace-mysql:Database.MySQL
for I-0.1.0.0...
Configuring library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for I-0.1.0.0...
Preprocessing library 'mylib' for I-0.1.0.0...
Building library 'mylib' instantiated with
Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for Includes2-0.1.0.0...
Configuring library for Includes2-0.1.0.0...
Preprocessing library for Includes2-0.1.0.0...
Building library for Includes2-0.1.0.0...
Configuring test suite 'includes2-test' for Includes2-0.1.0.0...
Preprocessing test suite 'includes2-test' for Includes2-0.1.0.0...
Building test suite 'includes2-test' for Includes2-0.1.0.0...
Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL
for I-0.1.0.0...
Configuring library for I-0.1.0.0...
Preprocessing library for I-0.1.0.0...
Building library for I-0.1.0.0...
Configuring test suite 'includes2-test' for I-0.1.0.0...
Preprocessing test suite 'includes2-test' for I-0.1.0.0...
Building test suite 'includes2-test' for I-0.1.0.0...
Running 1 test suites...
Test suite includes2-test: RUNNING...
Test suite includes2-test: PASS
Test suite logged to: <ROOT>/cov.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Includes2-0.1.0.0/t/includes2-test/test/Includes2-0.1.0.0-includes2-test.log
Package coverage report written to <ROOT>/cov.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Includes2-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html
Test suite logged to: <ROOT>/cov.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/I-0.1.0.0/t/includes2-test/test/I-0.1.0.0-includes2-test.log
Package coverage report written to <ROOT>/cov.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/I-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html
1 of 1 test suites (1 of 1 test cases) passed.
Package coverage report written to <ROOT>/cov.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/Includes2-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html
Package coverage report written to <ROOT>/cov.dist/work/./dist/build/<ARCH>/ghc-<GHCVER>/I-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Test.Cabal.Prelude
main = cabalTest $ do
skipUnlessGhcVersion ">= 8.1"
skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271
jasagredo marked this conversation as resolved.
Show resolved Hide resolved
-- #6397
cabal "test" ["--enable-coverage", "includes2-test"]
Loading
Loading