aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-12-07 15:05:30 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-12-07 15:05:30 +0100
commit65c0e527f83b200956eea1b31321f2a28e7cd548 (patch)
tree27359da280ce3ce9a04abf252ec37acf5ec664fb /tests
parent0e9c96d28a6303265a409c77385bb112156db134 (diff)
downloadpandoc-65c0e527f83b200956eea1b31321f2a28e7cd548.tar.gz
Fixed tests with dynamic linking.
Closes #2709.
Diffstat (limited to 'tests')
-rw-r--r--tests/Tests/Old.hs15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/Tests/Old.hs b/tests/Tests/Old.hs
index b2600a9c5..ef21990ba 100644
--- a/tests/Tests/Old.hs
+++ b/tests/Tests/Old.hs
@@ -6,7 +6,8 @@ import Test.HUnit ( assertBool )
import System.Environment.Executable (getExecutablePath)
import System.IO ( openTempFile, stderr )
import System.Process ( runProcess, waitForProcess )
-import System.FilePath ( (</>), (<.>), takeDirectory, splitDirectories, joinPath )
+import System.FilePath ( (</>), (<.>), takeDirectory, splitDirectories,
+ joinPath )
import System.Directory
import System.Exit
import Data.Algorithm.Diff
@@ -260,9 +261,17 @@ testWithNormalize normalizer testname opts inp norm = testCase testname $ do
let normPath = norm
let options = ["--data-dir", ".." </> "data"] ++ [inpPath] ++ opts
let cmd = pandocPath ++ " " ++ unwords options
+ let findDynlibDir [] = Nothing
+ findDynlibDir ("build":xs) = Just $ joinPath (reverse xs) </> "build"
+ findDynlibDir (_:xs) = findDynlibDir xs
+ let mbDynlibDir = findDynlibDir (reverse $ splitDirectories pandocPath)
+ let dynlibEnv = case mbDynlibDir of
+ Nothing -> []
+ Just d -> [("DYLD_LIBRARY_PATH", d),
+ ("LD_LIBRARY_PATH", d)]
+ let env = dynlibEnv ++ [("TMP","."),("LANG","en_US.UTF-8"),("HOME", "./")]
ph <- runProcess pandocPath options Nothing
- (Just [("TMP","."),("LANG","en_US.UTF-8"),("HOME", "./")]) Nothing (Just hOut)
- (Just stderr)
+ (Just env) Nothing (Just hOut) (Just stderr)
ec <- waitForProcess ph
result <- if ec == ExitSuccess
then do