lichray updated this revision to Diff 119803.
lichray edited the summary of this revision.
lichray added a comment.

Changed to an warning given @zturner 's comments and experiments.


https://reviews.llvm.org/D39162

Files:
  test/Unit/lit.cfg.py


Index: test/Unit/lit.cfg.py
===================================================================
--- test/Unit/lit.cfg.py
+++ test/Unit/lit.cfg.py
@@ -35,17 +35,23 @@
     if symbolizer in os.environ:
         config.environment[symbolizer] = os.environ[symbolizer]
 
-shlibpath_var = ''
-if platform.system() == 'Linux':
-    shlibpath_var = 'LD_LIBRARY_PATH'
-elif platform.system() == 'Darwin':
-    shlibpath_var = 'DYLD_LIBRARY_PATH'
-elif platform.system() == 'Windows':
-    shlibpath_var = 'PATH'
-
-# in stand-alone builds, shlibdir is clang's build tree
-# while llvm_libs_dir is installed LLVM (and possibly older clang)
-shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir,
-                                 config.environment.get(shlibpath_var,'')))
-
-config.environment[shlibpath_var] = shlibpath
+def find_shlibpath_var():
+    if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
+        yield 'LD_LIBRARY_PATH'
+    elif platform.system() == 'Darwin':
+        yield 'DYLD_LIBRARY_PATH'
+    elif platform.system() == 'Windows':
+        yield 'PATH'
+
+for shlibpath_var in find_shlibpath_var():
+    # in stand-alone builds, shlibdir is clang's build tree
+    # while llvm_libs_dir is installed LLVM (and possibly older clang)
+    shlibpath = os.path.pathsep.join(
+        (config.shlibdir,
+         config.llvm_libs_dir,
+         config.environment.get(shlibpath_var, '')))
+    config.environment[shlibpath_var] = shlibpath
+    break
+else:
+    lit_config.warning("unable to inject shared library path on '{}'"
+                       .format(platform.system()))


Index: test/Unit/lit.cfg.py
===================================================================
--- test/Unit/lit.cfg.py
+++ test/Unit/lit.cfg.py
@@ -35,17 +35,23 @@
     if symbolizer in os.environ:
         config.environment[symbolizer] = os.environ[symbolizer]
 
-shlibpath_var = ''
-if platform.system() == 'Linux':
-    shlibpath_var = 'LD_LIBRARY_PATH'
-elif platform.system() == 'Darwin':
-    shlibpath_var = 'DYLD_LIBRARY_PATH'
-elif platform.system() == 'Windows':
-    shlibpath_var = 'PATH'
-
-# in stand-alone builds, shlibdir is clang's build tree
-# while llvm_libs_dir is installed LLVM (and possibly older clang)
-shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir,
-                                 config.environment.get(shlibpath_var,'')))
-
-config.environment[shlibpath_var] = shlibpath
+def find_shlibpath_var():
+    if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
+        yield 'LD_LIBRARY_PATH'
+    elif platform.system() == 'Darwin':
+        yield 'DYLD_LIBRARY_PATH'
+    elif platform.system() == 'Windows':
+        yield 'PATH'
+
+for shlibpath_var in find_shlibpath_var():
+    # in stand-alone builds, shlibdir is clang's build tree
+    # while llvm_libs_dir is installed LLVM (and possibly older clang)
+    shlibpath = os.path.pathsep.join(
+        (config.shlibdir,
+         config.llvm_libs_dir,
+         config.environment.get(shlibpath_var, '')))
+    config.environment[shlibpath_var] = shlibpath
+    break
+else:
+    lit_config.warning("unable to inject shared library path on '{}'"
+                       .format(platform.system()))
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to