Skip to content

Commit a573769

Browse files
author
Artyom Kazak
authored
Merge pull request #3770 from commercialhaskell/no-rerun-tests
Fix --no-rerun-tests
2 parents f7ba7a7 + 39ff251 commit a573769

File tree

7 files changed

+38
-0
lines changed

7 files changed

+38
-0
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ Bug fixes:
3030
this bug, you will likely need to delete the binary build cache
3131
associated with the relevant custom snapshot. See
3232
[#3714](https://github.com/commercialhaskell/stack/issues/3714).
33+
* `--no-rerun-tests` has been fixed. Previously, after running a test
34+
we were forgetting to record the result, which meant that all tests
35+
always ran even if they had already passed before. See
36+
[#3770](https://github.com/commercialhaskell/stack/pull/3770).
3337

3438
## v1.6.3
3539

src/Stack/Build/Execute.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,8 @@ singleTest runInBase topts testsToRun ac ee task installedMap = do
17351735
(fmap fst mlogFile)
17361736
bs
17371737

1738+
setTestSuccess pkgDir
1739+
17381740
-- | Implements running a package's benchmarks.
17391741
singleBench :: HasEnvConfig env
17401742
=> (RIO env () -> IO ())
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import StackTest
2+
import System.Directory
3+
import Control.Monad
4+
5+
main :: IO ()
6+
main = do
7+
stack ["test"]
8+
exists1 <- doesFileExist "foo"
9+
unless exists1 $ error "exists1 should be True"
10+
removeFile "foo"
11+
stack ["test", "--no-rerun-tests"]
12+
exists2 <- doesFileExist "foo"
13+
when exists2 $ error "exists2 should be False"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.stack-work/
2+
files.cabal
3+
*~
4+
foo
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: files
2+
3+
dependencies:
4+
- base >= 4.7 && < 5
5+
6+
library:
7+
source-dirs: src
8+
9+
tests:
10+
test:
11+
main: Spec.hs
12+
source-dirs: test
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
resolver: ghc-8.2.2
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
main :: IO ()
2+
main = writeFile "foo" ""

0 commit comments

Comments
 (0)