Skip to content
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
2 changes: 1 addition & 1 deletion tests/integration/tests/111-custom-snapshot/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/111

import StackTest
import StackTest

main :: IO ()
main = stack ["build"]
2 changes: 1 addition & 1 deletion tests/integration/tests/1884-url-to-tarball/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/1884

import StackTest
import StackTest

main :: IO ()
main = stack ["build", "--dry-run"]
5 changes: 3 additions & 2 deletions tests/integration/tests/2195-depend-on-exe/Main.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
-- Stack reports an error if a package component depends on a package that has
-- no library component.
--
-- See: https://github.com/commercialhaskell/stack/issues/2195

import Control.Monad ( unless )
import Data.List ( isInfixOf )
import StackTest

main :: IO ()
main = stackErrStderr
["build", "myPackageB"]
(expectMessage "package provides no library")
["build", "myPackageB"]
(expectMessage "package provides no library")

expectMessage :: String -> String -> IO ()
expectMessage msg stderr =
Expand Down
76 changes: 31 additions & 45 deletions tests/integration/tests/2643-copy-compiler-tool/Main.hs
Original file line number Diff line number Diff line change
@@ -1,64 +1,50 @@
import StackTest
import System.Directory
import Control.Monad (unless)
-- Stack can install targets that are executables as compiler tools.

main :: IO ()
main = do
-- init
removeFileIgnore "stack.yaml"
removeDirIgnore ".stack-work"
stack ["init", defaultSnapshotArg]
-- See: https://github.com/commercialhaskell/stack/issues/2643

-- place to throw some exes
removeDirIgnore "binny"
createDirectory "binny"

-- check assumptions on exec and the build flags and clean
stack ["build", "--flag", "copy-compiler-tool-test:build-baz"]
stack ["exec", "--", "baz-exe" ++ exeExt]
stackErr ["exec", "--", "bar-exe" ++ exeExt]
stackCleanFull
-- See #4936. The Windows condition is because `stackCleanFull` may have
-- failed.
unless isWindows $ stackErr ["exec", "--", "baz-exe" ++ exeExt]
import Control.Monad ( unless )
import StackTest
import System.Directory ()

-- install one exe normally
main :: IO ()
main = do
-- Install myExeA executable normally:
stack ["install",
"--local-bin-path", "./binny",
"--flag", "*:build-foo"
"--local-bin-path", "./bin",
"--flag", "myPackage:build-myExeA"
]

-- and install two compiler-tools, opposite ways
-- (build or install)
-- Install myExeB and myExeC executables as compiler tools, in alternative
-- ways (build or install):
stack ["build",
"--local-bin-path", "./binny",
"--local-bin-path", "./bin",
"--copy-compiler-tool",
"--flag", "*:build-bar"
"--flag", "myPackage:build-myExeB"
]
stack ["install",
"--local-bin-path", "./binny",
"--local-bin-path", "./bin",
"--copy-compiler-tool",
"--flag", "*:build-baz"
"--flag", "myPackage:build-myExeC"
]

-- nuke the built things that go in .stack-work/, so we can test if
-- the installed ones exist for sure
-- Remove .stack-work/, so we can test if the installed ones exist:
stackCleanFull

-- bar and baz were installed as compiler tools, should work fine
stack ["exec", "--", "bar-exe" ++ exeExt]
stack ["exec", "--", "baz-exe" ++ exeExt]
-- myExeB and myExeC were installed as compiler tools and should work:
stack ["exec", "--", "myExeB" <> exeExt]
stack ["exec", "--", "myExeC" <> exeExt]

-- myExeA was installed in .bin/, which is not on the PATH, and should not
-- work.

-- foo was installed as a normal exe (in .binny/, which can't be on PATH),
-- so shouldn't
-- See #4936. The Windows condition is because `stackCleanFull` may have
-- failed.
unless isWindows $ stackErr ["exec", "--", "foo-exe" ++ exeExt]
-- The Windows condition is because `stackCleanFull` may have failed (see
-- issue #4936):
unless isWindows $ stackErr ["exec", "--", "myExeA" <> exeExt]

-- check existences make sense
doesExist $ "./binny/foo-exe" ++ exeExt
doesNotExist $ "./binny/bar-exe" ++ exeExt
doesNotExist $ "./binny/baz-exe" ++ exeExt
-- Check existences make sense:
doesExist $ "./bin/myExeA" <> exeExt
doesNotExist $ "./bin/myExeB" <> exeExt
doesNotExist $ "./bin/myExeC" <> exeExt

-- just check that this exists
-- Check that this exists
stack ["path", "--compiler-tools-bin"]
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
binny/
stack.yaml
.stack-work/
bin/
myPackage.cabal

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions tests/integration/tests/2643-copy-compiler-tool/files/LICENSE

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main (main) where

main :: IO ()
main = pure ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main (main) where

main :: IO ()
main = pure ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main (main) where

main :: IO ()
main = pure ()

This file was deleted.

40 changes: 40 additions & 0 deletions tests/integration/tests/2643-copy-compiler-tool/files/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
spec-version: 0.36.0

name: myPackage

flags:
build-myExeA:
description: Build myExeA
default: false
manual: true
build-myExeB:
description: Build myExeB
default: false
manual: true
build-myExeC:
description: Build myExeC
default: false
manual: true

dependencies:
- base

executables:
myExeA:
source-dirs: appA
main: Main.hs
when:
- condition: "!flag(build-myExeA)"
buildable: false
myExeB:
source-dirs: appB
main: Main.hs
when:
- condition: "!flag(build-myExeB)"
buildable: false
myExeC:
source-dirs: appC
main: Main.hs
when:
- condition: "!flag(build-myExeC)"
buildable: false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
snapshot: ghc-9.10.3
4 changes: 2 additions & 2 deletions tests/integration/tests/2781-shadow-bug/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/2781

import StackTest
import System.Directory ( createDirectoryIfMissing )
import StackTest
import System.Directory ( createDirectoryIfMissing )

main :: IO ()
main = do
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/tests/2997-ensure-warnings-output/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/2997

import Data.List ( isInfixOf )
import StackTest
import Data.List ( isInfixOf )
import StackTest

main :: IO ()
main = do
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/tests/3315-multi-ghc-options/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/3315

import StackTest.Repl
import StackTest.Repl

main :: IO ()
main = do
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/tests/3390-unbuildable-test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/3390

import StackTest
import StackTest

main :: IO ()
main = stack ["test"]
2 changes: 1 addition & 1 deletion tests/integration/tests/3574-extra-dep-local/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/3574

import StackTest
import StackTest

main :: IO ()
main = stack ["build", "myPackage"]
3 changes: 1 addition & 2 deletions tests/integration/tests/3631-build-http2/Main.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
-- Stack can build the http2 package.
--
--
-- https://github.com/commercialhaskell/stack/issues/3631

import StackTest
import StackTest

main :: IO ()
main = do
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/tests/384-local-deps/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/384

import StackTest
import StackTest

main :: IO ()
main = do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/3861

import StackTest
import StackTest

main :: IO ()
main = do
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/tests/3926-ghci-with-sublibraries/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/3926

import Control.Monad ( unless, when )
import Control.Monad.IO.Class ( liftIO )
import Data.List ( isInfixOf, isSuffixOf )
import StackTest.Repl
import Control.Monad ( unless, when )
import Control.Monad.IO.Class ( liftIO )
import Data.List ( isInfixOf, isSuffixOf )
import StackTest.Repl

main :: IO ()
main = do
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/tests/3940-base-upgrade-warning/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
--
-- See: https://github.com/commercialhaskell/stack/issues/3940

import Control.Monad ( unless )
import Data.List ( isInfixOf )
import StackTest
import Control.Monad ( unless )
import Data.List ( isInfixOf )
import StackTest

-- Use short message fragment because prettyWarn formatting and colour
unattainableBaseWarning :: String
Expand Down
Loading
Loading