Skip to content

Commit

Permalink
[ #1675, tests ] Don't run latex compilers on travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
phile314 committed Oct 13, 2015
1 parent d933ce4 commit e390998
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,11 @@ script:

##############################################################################

# Running XeLaTeX/LuaLaTeX on travis fails randomly, presumably because they
# consume too much memory. We just don't run them on travis, but we still
# compare the generated tex/html files with the golden files.
- if [ $TEST = "latex-html-test" ]; then
make AGDA_TESTS_OPTIONS="" BUILD_DIR=$BUILD_DIR latex-html-test;
make AGDA_TESTS_OPTIONS="" BUILD_DIR=$BUILD_DIR DONT_RUN_LATEX="Y" latex-html-test;
fi

##############################################################################
Expand Down
6 changes: 5 additions & 1 deletion test/LaTeXAndHTML/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ mkLaTeXOrHTMLTest k agdaBin inp = do
fromMaybe allLaTeXProgs
(readMaybe $ T.unpack $ decodeUtf8 content)
-- run all latex compilers
foldl (runLaTeX outFileName outDir) done latexProgs
rl <- doesEnvContain "DONT_RUN_LATEX"
if rl
then done
else
foldl (runLaTeX outFileName outDir) done latexProgs

runLaTeX :: FilePath -- tex file
-> FilePath -- working dir
Expand Down
16 changes: 9 additions & 7 deletions test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ import Test.Tasty.Silver.Filter (RegexFilter)
import Control.Applicative ((<$>))
#endif

import System.Environment
import System.Exit

import Utils

main :: IO ()
main = do
env <- getEnvironment
case "AGDA_BIN" `lookup` env of
Just _ -> tests >>= TM.defaultMain1 disabledTests
Nothing -> do
putStrLn $ unlines
agdaBin <- doesEnvContain "AGDA_BIN"
if agdaBin
then
tests >>= TM.defaultMain1 disabledTests
else do
putStrLn $ unlines
[ "The AGDA_BIN environment variable is not set. Do not execute"
, "these tests directly using \"cabal test\" or \"cabal install --run-tests\", instead"
, "use the Makefile."
Expand All @@ -36,7 +38,7 @@ main = do
, "The Makefile requries cabal-install 1.20.0.0 or later to work properly."
, "See also Issue 1489 and 1490."
]
exitWith (ExitFailure 1)
exitWith (ExitFailure 1)

tests :: IO TestTree
tests =
Expand Down
2 changes: 2 additions & 0 deletions test/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ agdaExts = S.fromList [".agda", ".lagda"]
getAgdaFilesInDir :: String -> IO [FilePath]
getAgdaFilesInDir dir = map (dir </>) . filter (flip S.member agdaExts . takeExtension) <$> getDirectoryContents dir

doesEnvContain :: String -> IO Bool
doesEnvContain v = isJust <$> getEnvVar v

-- | Replaces all matches of a regex with the given text.
--
Expand Down

0 comments on commit e390998

Please sign in to comment.