Skip to content

Commit 251ee08

Browse files
authored
Expect bench experiments to fail with Cabal (#704)
1 parent 8a96da6 commit 251ee08

File tree

6 files changed

+25
-2
lines changed

6 files changed

+25
-2
lines changed

stack-ghc-lib.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ flags:
2424
ghc-options:
2525
ghc-lib-parser: -O0
2626
ghc-lib: -O0
27+
ghcide: -DSTACK

stack.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ extra-deps:
1818
- extra-1.7.2
1919
nix:
2020
packages: [zlib]
21+
22+
ghc-options:
23+
ghcide: -DSTACK

stack810.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ extra-deps:
2727

2828
nix:
2929
packages: [zlib]
30+
31+
ghc-options:
32+
ghcide: -DSTACK

stack84.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ extra-deps:
3636

3737
nix:
3838
packages: [zlib]
39+
40+
41+
ghc-options:
42+
ghcide: -DSTACK

stack88.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ extra-deps:
1010
- extra-1.7.2
1111
nix:
1212
packages: [zlib]
13+
14+
ghc-options:
15+
ghcide: -DSTACK

test/exe/Main.hs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
12611261
, ""
12621262
, "import Debug.Trace"
12631263
, ""
1264-
, "f a = traceShow \"debug\" a"
1264+
, "f a = traceShow \"debug\" a"
12651265
])
12661266
[ (DsWarning, (6, 6), "Defaulting the following constraint") ]
12671267
"Add type annotation ‘[Char]’ to ‘\"debug\""
@@ -2303,6 +2303,13 @@ xfail8101 = flip expectFailBecause
23032303
xfail8101 t _ = t
23042304
#endif
23052305

2306+
expectFailCabal :: String -> TestTree -> TestTree
2307+
#ifdef STACK
2308+
expectFailCabal _ = id
2309+
#else
2310+
expectFailCabal = expectFailBecause
2311+
#endif
2312+
23062313
data Expect
23072314
= ExpectRange Range -- Both gotoDef and hover should report this range
23082315
| ExpectLocation Location
@@ -2678,17 +2685,19 @@ nonLspCommandLine = testGroup "ghcide command line"
26782685
]
26792686

26802687
benchmarkTests :: TestTree
2688+
-- These tests require stack and will fail with cabal test
26812689
benchmarkTests =
26822690
let ?config = Bench.defConfig
26832691
{ Bench.verbosity = Bench.Quiet
26842692
, Bench.repetitions = Just 3
26852693
, Bench.buildTool = Bench.Stack
26862694
} in
26872695
withResource Bench.setup id $ \_ -> testGroup "benchmark experiments"
2688-
[ testCase (Bench.name e) $ do
2696+
[ expectFailCabal "Requires stack" $ testCase (Bench.name e) $ do
26892697
res <- Bench.runBench runInDir e
26902698
assertBool "did not successfully complete 5 repetitions" $ Bench.success res
26912699
| e <- Bench.experiments
2700+
, Bench.name e /= "edit" -- the edit experiment does not ever fail
26922701
]
26932702

26942703
----------------------------------------------------------------------

0 commit comments

Comments
 (0)