tests: workaround for DYLD_LIBRARY_PATH on Apple MacOSX
authorAlexander Alekhin <alexander.alekhin@intel.com>
Wed, 17 Apr 2019 12:19:33 +0000 (15:19 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Wed, 17 Apr 2019 12:19:33 +0000 (15:19 +0300)
modules/java/test/pure_test/build.xml
modules/ts/misc/run_utils.py

index 7729b41..870dd44 100644 (file)
@@ -41,6 +41,7 @@
     <junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="true" logfailedtests="true" maxmemory="256m">
       <sysproperty key="java.library.path" path="${opencv.lib.path}"/>
       <env key="PATH" path="${opencv.lib.path}:${env.PATH}:${env.Path}"/>
+      <env key="DYLD_LIBRARY_PATH" path="${env.OPENCV_SAVED_DYLD_LIBRARY_PATH}"/>  <!-- https://github.com/opencv/opencv/issues/14353 -->
       <classpath refid="master-classpath"/>
       <classpath>
         <pathelement location="build/classes"/>
index 4fc84cc..8c942ba 100644 (file)
@@ -37,6 +37,13 @@ def execute(cmd, silent=False, cwd=".", env=None):
             new_env = os.environ.copy()
             new_env.update(env)
             env = new_env
+
+        if sys.platform == 'darwin':  # https://github.com/opencv/opencv/issues/14351
+            if env is None:
+                env = os.environ.copy()
+            if 'DYLD_LIBRARY_PATH' in env:
+                env['OPENCV_SAVED_DYLD_LIBRARY_PATH'] = env['DYLD_LIBRARY_PATH']
+
         if silent:
             return check_output(cmd, stderr=STDOUT, cwd=cwd, env=env).decode("latin-1")
         else: