git.iko.soy/typeable/pandoc
on master help sign in
Fixed tests with dynamic linking.

Closes #2709.

commit65c0e527f83b200956eea1b31321f2a28e7cd548 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 7 Dec 2016, 15:05 (10 years ago) parent0e9c96d
1 file changed+12−3
tests/Tests/Old.hs+12−3
tests/Tests/Old.hs+12−3
@@ -6,7 +6,8 @@ import Test.HUnit ( assertBool )
66import System.Environment.Executable (getExecutablePath)
77import System.IO ( openTempFile, stderr )
88import System.Process ( runProcess, waitForProcess )
9−import System.FilePath ( (</>), (<.>), takeDirectory, splitDirectories, joinPath )
9+import System.FilePath ( (</>), (<.>), takeDirectory, splitDirectories,
10+ joinPath )
1011import System.Directory
1112import System.Exit
1213import Data.Algorithm.Diff
@@ -260,9 +261,17 @@ testWithNormalize normalizer testname opts inp norm = testCase testname $ do
260261 let normPath = norm
261262 let options = ["--data-dir", ".." </> "data"] ++ [inpPath] ++ opts
262263 let cmd = pandocPath ++ " " ++ unwords options
264+ let findDynlibDir [] = Nothing
265+ findDynlibDir ("build":xs) = Just $ joinPath (reverse xs) </> "build"
266+ findDynlibDir (_:xs) = findDynlibDir xs
267+ let mbDynlibDir = findDynlibDir (reverse $ splitDirectories pandocPath)
268+ let dynlibEnv = case mbDynlibDir of
269+ Nothing -> []
270+ Just d -> [("DYLD_LIBRARY_PATH", d),
271+ ("LD_LIBRARY_PATH", d)]
272+ let env = dynlibEnv ++ [("TMP","."),("LANG","en_US.UTF-8"),("HOME", "./")]
263273 ph <- runProcess pandocPath options Nothing
264− (Just [("TMP","."),("LANG","en_US.UTF-8"),("HOME", "./")]) Nothing (Just hOut)
265− (Just stderr)
274+ (Just env) Nothing (Just hOut) (Just stderr)
266275 ec <- waitForProcess ph
267276 result <- if ec == ExitSuccess
268277 then do