Skip to content

Commit 11063a8

Browse files
committed
Add tests for unsupported builds on Windows
1 parent d67040e commit 11063a8

File tree

10 files changed

+58
-0
lines changed

10 files changed

+58
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ register.sh
6969
# listed explicitly to show which files are generated but ignored
7070
testdb/intree/cabal.project-test
7171
testdb/intree/store/**/bin/alex
72+
testdb/intree/store/**/bin/alex.exe
7273
testdb/intree/store/**/cabal-hash.txt
7374
testdb/intree/store/**/share/AlexTemplate.hs
7475
testdb/intree/store/**/share/AlexWrappers.hs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Main where
2+
3+
main :: IO ()
4+
main = pure ()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cabal-version: 3.0
2+
name: aa
3+
version: 0.1.0.0
4+
build-type: Simple
5+
6+
executable a
7+
default-language: Haskell2010
8+
main-is: Main.hs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# cabal build
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- aa-0.1.0.0 (exe:a) (first run)
6+
Configuring executable 'a' for aa-0.1.0.0...
7+
Error: [Cabal-3339]
8+
Operating system: windows, does not support shared executables
9+
Error: [Cabal-7125]
10+
Failed to build aa-0.1.0.0-inplace-a. The failure occurred during the configure step.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Test.Cabal.Prelude
2+
3+
main = do
4+
skipUnlessWindows
5+
cabalTest $ fails $ cabal "build" ["--enable-executable-dynamic"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Main where
2+
3+
main :: IO ()
4+
main = pure ()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cabal-version: 3.0
2+
name: aa
3+
version: 0.1.0.0
4+
build-type: Simple
5+
6+
executable a
7+
default-language: Haskell2010
8+
main-is: Main.hs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# cabal build
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- aa-0.1.0.0 (exe:a) (first run)
6+
Configuring executable 'a' for aa-0.1.0.0...
7+
Error: [Cabal-3339]
8+
Operating system: windows, does not support relocatable builds
9+
Error: [Cabal-7125]
10+
Failed to build aa-0.1.0.0-inplace-a. The failure occurred during the configure step.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Test.Cabal.Prelude
2+
3+
main = do
4+
skipUnlessWindows
5+
cabalTest $ fails $ cabal "build" ["--enable-relocatable"]

cabal-testsuite/src/Test/Cabal/Prelude.hs

+3
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,9 @@ isJavaScript = buildArch == JavaScript
937937
skipIfWindows :: String -> IO ()
938938
skipIfWindows why = skipIfIO ("Windows " <> why) isWindows
939939

940+
skipUnlessWindows :: IO ()
941+
skipUnlessWindows = skipIfIO "Only interesting in Windows" (not isWindows)
942+
940943
getOpenFilesLimit :: TestM (Maybe Integer)
941944
#ifdef mingw32_HOST_OS
942945
-- No MS-specified limit, was determined experimentally on Windows 10 Pro x64,

0 commit comments

Comments
 (0)