[Lldb-commits] [lldb] r354556 - testsuite: Fix TestCompDirSymLink and TestSourceManager on Linux with symlinked build dir

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 21 01:05:28 PST 2019


Author: jankratochvil
Date: Thu Feb 21 01:05:27 2019
New Revision: 354556

URL: http://llvm.org/viewvc/llvm-project?rev=354556&view=rev
Log:
testsuite: Fix TestCompDirSymLink and TestSourceManager on Linux with symlinked build dir

Getting failure when building in a directory which is symlinked elsewhere:

Failing Tests (1):
    lldb-Suite :: functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
    lldb-Suite :: source-manager/TestSourceManager.py

For TestCompDirSymLink:
------------------------------------------------------------------------------
runCmd: file .../lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/CompDirSymLink
output: Current executable set to '.../lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/CompDirSymLink' (x86_64).
runCmd: settings set plugin.symbol-file.dwarf.comp-dir-symlink-paths /proc/self/cwd
output: None
runCmd: breakpoint set -f ".../lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/relative.cpp" -l 11
output: Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.

It is because /proc/self/cwd (used above for plugin.symbol-file.dwarf.comp-dir-symlink-paths) points to an already resolved directory:

(cd /tmp;mkdir real;ln -s real symlink;cd symlink;ls -l /proc/self/cwd)
lrwxrwxrwx 1 jkratoch jkratoch 0 Feb 20 19:55 /proc/self/cwd -> /tmp/real/
------------------------------------------------------------------------------

For TestSourceManager the resolving is done by 'make -C' as found by Pavel Labath.

Differential Revision: https://reviews.llvm.org/D58465

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
    lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py?rev=354556&r1=354555&r2=354556&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py Thu Feb 21 01:05:27 2019
@@ -48,6 +48,8 @@ class CompDirSymLinkTestCase(TestBase):
             "settings set %s %s" %
             (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
         src_path = self.getBuildArtifact(_SRC_FILE)
+        # /proc/self/cwd points to a realpath form of current directory.
+        src_path = os.path.realpath(src_path)
         lldbutil.run_break_set_by_file_and_line(self, src_path, self.line)
 
     @skipIf(hostoslist=["windows"])

Modified: lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py?rev=354556&r1=354555&r2=354556&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py Thu Feb 21 01:05:27 2019
@@ -158,12 +158,15 @@ class SourceManagerTestCase(TestBase):
             error=True,
             substrs=['''error: the replacement path doesn't exist: "/q/r/s/t/u"'''])
 
+        # 'make -C' has resolved current directory to its realpath form.
+        builddir_real = os.path.realpath(self.getBuildDir())
+        hidden_real = os.path.realpath(hidden)
         # Set target.source-map settings.
         self.runCmd("settings set target.source-map %s %s" %
-                    (self.getBuildDir(), hidden))
+                    (builddir_real, hidden_real))
         # And verify that the settings work.
         self.expect("settings show target.source-map",
-                    substrs=[self.getBuildDir(), hidden])
+                    substrs=[builddir_real, hidden_real])
 
         # Display main() and verify that the source mapping has been kicked in.
         self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
@@ -238,11 +241,14 @@ class SourceManagerTestCase(TestBase):
         self.build()
         hidden = self.getBuildArtifact("hidden")
         lldbutil.mkdir_p(hidden)
+        # 'make -C' has resolved current directory to its realpath form.
+        builddir_real = os.path.realpath(self.getBuildDir())
+        hidden_real = os.path.realpath(hidden)
         self.runCmd("settings set target.source-map %s %s" %
-                    (self.getBuildDir(), hidden))
+                    (builddir_real, hidden_real))
 
         exe = self.getBuildArtifact("a.out")
-        main = os.path.join(self.getBuildDir(), "hidden", "main-copy.c")
+        main = os.path.join(builddir_real, "hidden", "main-copy.c")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
         lldbutil.run_break_set_by_file_and_line(




More information about the lldb-commits mailing list