on master help sign in
Merge pull request #2939 from melted/fix_testing

Only use IDRIS if there's actually such an executable

commit0cbea4abaa4f876c94f3c681379f9c13e9688777 authorNiklas Larsson <metaniklas@gmail.com> dateMon 1 Feb 2016, 20:26 (11 years ago) parent5518fc31c7680a
2 files changed+16−7
test/Makefile+5−4 test/runtest.hs+11−3
test/Makefile+5−4
@@ -1,9 +1,5 @@
11.PHONY: test test_js time update diff distclean $(TESTS)
22
3−runtest:
4− @ghc --make runtest.hs
5− @rm runtest.o runtest.hi
6−
73TESTS = $(sort $(patsubst %/,%.test,$(wildcard */)))
84
95test: $(TESTS)
@@ -31,3 +27,8 @@ distclean:
3127 @rm runtest
3228 @rm -f *~
3329 @rm -f */output
30+
31+
32+runtest:
33+ @ghc --make runtest.hs
34+ @rm runtest.o runtest.hi
test/runtest.hs+11−3
@@ -171,17 +171,25 @@ runDiff conf = do
171171whisper :: Config -> String -> IO ()
172172whisper conf s = do unless (isQuiet conf) $ putStrLn s
173173
174+isWindows :: Bool
175+isWindows = os `elem` ["win32", "mingw32", "cygwin32"]
176+
174177setPath :: Config -> IO ()
175178setPath conf = do
176179 maybeEnv <- lookupEnv "IDRIS"
177− idrisEnv <- return $ fromMaybe "" maybeEnv
178− if (idrisEnv /= "")
180+ idrisExists <- case maybeEnv of
181+ Just idrisExe -> do
182+ let exeExtension = if isWindows then ".exe" else ""
183+ doesFileExist (idrisExe ++ exeExtension)
184+ Nothing -> return False
185+ if (idrisExists)
179186 then do
180− idrisAbs <- makeAbsolute idrisEnv
187+ idrisAbs <- makeAbsolute $ fromMaybe "" maybeEnv
181188 setEnv "IDRIS" idrisAbs
182189 whisper conf $ "Using " ++ idrisAbs
183190 else do
184191 path <- getEnv "PATH"
192+ setEnv "IDRIS" ""
185193 let sandbox = "../.cabal-sandbox/bin"
186194 hasBox <- doesDirectoryExist sandbox
187195 bindir <- if hasBox