From 89ea8cb50cc06ef183bbf2941f0485d4a6bafaf9 Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Sun, 13 Aug 2017 22:43:48 -0700 Subject: [PATCH] improve 2643 integration test, better checks of correctness --- .../tests/2643-copy-compiler-tool/Main.hs | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/test/integration/tests/2643-copy-compiler-tool/Main.hs b/test/integration/tests/2643-copy-compiler-tool/Main.hs index ec9b6f7976..303ca4a5e2 100644 --- a/test/integration/tests/2643-copy-compiler-tool/Main.hs +++ b/test/integration/tests/2643-copy-compiler-tool/Main.hs @@ -1,10 +1,14 @@ import StackTest +import System.Directory main :: IO () main = do -- init stack ["init", defaultResolverArg] + -- place to throw some exes + createDirectory "binny" + -- check assumptions on exec and the build flags and clean stack ["build", "--flag", "*:build-baz"] stack ["exec", "--", "baz-exe" ++ exeExt] @@ -12,11 +16,24 @@ main = do stack ["clean", "--full"] stackErr ["exec", "--", "baz-exe" ++ exeExt] - -- install one exe normally and two compiler-tools, opposite ways + -- install one exe normally + stack ["install", + "--local-bin-path", "./binny", + "--flag", "*:build-foo" + ] + + -- and install two compiler-tools, opposite ways -- (build or install) - stack ["install", "--flag", "*:build-foo"] - stack ["build", "--copy-compiler-tool", "--flag", "*:build-bar"] - stack ["install", "--copy-compiler-tool", "--flag", "*:build-baz"] + stack ["build", + "--local-bin-path", "./binny", + "--copy-compiler-tool", + "--flag", "*:build-bar" + ] + stack ["install", + "--local-bin-path", "./binny", + "--copy-compiler-tool", + "--flag", "*:build-baz" + ] -- nuke the built things that go in .stack-work/, so we can test if -- the installed ones exist for sure @@ -26,8 +43,14 @@ main = do stack ["exec", "--", "bar-exe" ++ exeExt] stack ["exec", "--", "baz-exe" ++ exeExt] - -- foo was installed as a normal exe (in .local/bin/), so shouldn't - -- TODO: Check this in a more reliable fashion + -- foo was installed as a normal exe (in .binny/, which can't be on PATH), + -- so shouldn't stackErr ["exec", "--", "foo-exe" ++ exeExt] - -- TODO: check paths against `stack path` + -- check existences make sense + doesExist $ "./binny/foo-exe" ++ exeExt + doesNotExist $ "./binny/bar-exe" ++ exeExt + doesNotExist $ "./binny/baz-exe" ++ exeExt + + -- just check that this exists + stack ["path", "--compiler-tools-bin"]