Skip to content

Commit

Permalink
Add tests for unsupported builds on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Jul 22, 2024
1 parent d67040e commit 11063a8
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ register.sh
# listed explicitly to show which files are generated but ignored
testdb/intree/cabal.project-test
testdb/intree/store/**/bin/alex
testdb/intree/store/**/bin/alex.exe
testdb/intree/store/**/cabal-hash.txt
testdb/intree/store/**/share/AlexTemplate.hs
testdb/intree/store/**/share/AlexWrappers.hs
Expand Down
4 changes: 4 additions & 0 deletions cabal-testsuite/PackageTests/NoOSSupport/DynExe/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = pure ()
8 changes: 8 additions & 0 deletions cabal-testsuite/PackageTests/NoOSSupport/DynExe/a.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cabal-version: 3.0
name: aa
version: 0.1.0.0
build-type: Simple

executable a
default-language: Haskell2010
main-is: Main.hs
10 changes: 10 additions & 0 deletions cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# cabal build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- aa-0.1.0.0 (exe:a) (first run)
Configuring executable 'a' for aa-0.1.0.0...
Error: [Cabal-3339]
Operating system: windows, does not support shared executables
Error: [Cabal-7125]
Failed to build aa-0.1.0.0-inplace-a. The failure occurred during the configure step.
5 changes: 5 additions & 0 deletions cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

main = do
skipUnlessWindows
cabalTest $ fails $ cabal "build" ["--enable-executable-dynamic"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = pure ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cabal-version: 3.0
name: aa
version: 0.1.0.0
build-type: Simple

executable a
default-language: Haskell2010
main-is: Main.hs
10 changes: 10 additions & 0 deletions cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# cabal build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following will be built:
- aa-0.1.0.0 (exe:a) (first run)
Configuring executable 'a' for aa-0.1.0.0...
Error: [Cabal-3339]
Operating system: windows, does not support relocatable builds
Error: [Cabal-7125]
Failed to build aa-0.1.0.0-inplace-a. The failure occurred during the configure step.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Test.Cabal.Prelude

main = do
skipUnlessWindows
cabalTest $ fails $ cabal "build" ["--enable-relocatable"]
3 changes: 3 additions & 0 deletions cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,9 @@ isJavaScript = buildArch == JavaScript
skipIfWindows :: String -> IO ()
skipIfWindows why = skipIfIO ("Windows " <> why) isWindows

skipUnlessWindows :: IO ()
skipUnlessWindows = skipIfIO "Only interesting in Windows" (not isWindows)

getOpenFilesLimit :: TestM (Maybe Integer)
#ifdef mingw32_HOST_OS
-- No MS-specified limit, was determined experimentally on Windows 10 Pro x64,
Expand Down

0 comments on commit 11063a8

Please sign in to comment.