Skip to content

Commit 2ff9813

Browse files
committed
Improve error message for testsuite failure
If the testsuite is not run from the root directory it will fail with a scary error. This makes it obvious what went wrong.
1 parent 3f62b6f commit 2ff9813

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/haskell/Main.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ main = do
4646
env <- getEnvironment
4747
let mkTest = mkGoldenTest False env
4848
golden_tests_paths <- findByExtension [".hdb-test"] "test/golden"
49+
`catch` \(e::IOException) -> do
50+
hPutStrLn stderr "-- !! ERROR !! -----------------------------------------------------------------"
51+
hPutStrLn stderr "Failed to find golden tests by `*.hdb-test` extension."
52+
hPutStrLn stderr "Make sure that the testsuite is being run from the project root (where the relative path `test/golden` is valid)."
53+
hPutStrLn stderr "--------------------------------------------------------------------------------"
54+
throwIO e
4955

5056
let internalOnlyTests = filter (\p -> ".internal" `isSuffixOf` takeBaseName p) golden_tests_paths
5157
let externalOnlyTests = filter (\p -> ".external" `isSuffixOf` takeBaseName p) golden_tests_paths

0 commit comments

Comments
 (0)