[PATCH] D62005: [libunwind] [test] Fix inferring source paths

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 16 05:39:33 PDT 2019


mgorny created this revision.
mgorny added reviewers: jroelofs, krytarowski.
Herald added subscribers: libcxx-commits, ldionne, christof.

Fix two issues that caused libcxx source path not to be inferred
correctly when not specified explicitly:

1. get_lit_conf() uses default value only if the lit variable is set to None.  Due to the mehod of substituting lit.site.cfg, they were "" rather than None when unset, effectively causing the default never to apply.  Instead, use 'or' construct to use the default whenever get_lit_conf() returns a false value.

2. If os.path.join() is given a component starting with '/', it takes it to be an absolute path and ignores everything preceding it. Remove the slash to correctly append subdirectory.

With these two fixes, libunwind tests start working on NetBSD buildbot
again.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D62005

Files:
  libunwind/test/libunwind/test/config.py


Index: libunwind/test/libunwind/test/config.py
===================================================================
--- libunwind/test/libunwind/test/config.py
+++ libunwind/test/libunwind/test/config.py
@@ -21,12 +21,10 @@
         self.libcxx_src_root = None
 
     def configure_src_root(self):
-        self.libunwind_src_root = self.get_lit_conf(
-            'libunwind_src_root',
-            os.path.dirname(self.config.test_source_root))
-        self.libcxx_src_root = self.get_lit_conf(
-            'libcxx_src_root',
-            os.path.join(self.libunwind_src_root, '/../libcxx'))
+        self.libunwind_src_root = (self.get_lit_conf('libunwind_src_root')
+            or os.path.dirname(self.config.test_source_root))
+        self.libcxx_src_root = (self.get_lit_conf('libcxx_src_root')
+            or os.path.join(self.libunwind_src_root, '../libcxx'))
 
     def configure_obj_root(self):
         self.libunwind_obj_root = self.get_lit_conf('libunwind_obj_root')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62005.199799.patch
Type: text/x-patch
Size: 984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190516/5f9d1497/attachment.bin>


More information about the cfe-commits mailing list