diff --git a/.gitignore b/.gitignore index f2568f428f8..783d3862eec 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/cabal-testsuite/PackageTests/NoOSSupport/DynExe/Main.hs b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/Main.hs new file mode 100644 index 00000000000..6f2b80aa9ed --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/cabal-testsuite/PackageTests/NoOSSupport/DynExe/a.cabal b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/a.cabal new file mode 100644 index 00000000000..58868453b6b --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/a.cabal @@ -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 diff --git a/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.out b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.out new file mode 100644 index 00000000000..53ccefe2347 --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.out @@ -0,0 +1,12 @@ +# cabal build +Resolving dependencies... +Build profile: -w ghc- -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... +Warning: Executables will use dynamic linking, but a shared library is not +being built. Linking will fail if any executables depend on the library. +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. diff --git a/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.test.hs b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.test.hs new file mode 100644 index 00000000000..aa0c8e83b7b --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +main = do + skipUnlessWindows + cabalTest $ fails $ cabal "build" ["--enable-executable-dynamic", "--disable-shared"] diff --git a/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/Main.hs b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/Main.hs new file mode 100644 index 00000000000..6f2b80aa9ed --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = pure () diff --git a/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/a.cabal b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/a.cabal new file mode 100644 index 00000000000..58868453b6b --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/a.cabal @@ -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 diff --git a/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.out b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.out new file mode 100644 index 00000000000..f59d29e6b17 --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.out @@ -0,0 +1,10 @@ +# cabal build +Resolving dependencies... +Build profile: -w ghc- -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. diff --git a/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.test.hs b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.test.hs new file mode 100644 index 00000000000..448fc6fc22a --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +main = do + skipUnlessWindows + cabalTest $ fails $ cabal "build" ["--enable-relocatable"] diff --git a/cabal-testsuite/src/Test/Cabal/Prelude.hs b/cabal-testsuite/src/Test/Cabal/Prelude.hs index 80653c49f3a..c9a975e0fb7 100644 --- a/cabal-testsuite/src/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/src/Test/Cabal/Prelude.hs @@ -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,