This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Test] Fix ASan/TSan workaround for Xcode Python 3
ClosedPublic

Authored by JDevlieghere on Jun 11 2020, 4:03 PM.

Details

Summary

The Python 3 interpreter in Xcode has a relative RPATH and dyld fails to load it when we copy it into the build directory. Provide a workaround for the workaround...

dyld: Library not loaded: @executable_path/../../../../Python3
  Referenced from: /Users/jonas/llvm/build-tsan/lldb-test-build.noindex/copied-python
  Reason: image not found

Diff Detail

Repository
rLLDB LLDB

Event Timeline

JDevlieghere created this revision.Jun 11 2020, 4:03 PM

Avoid a race that would result in another test finding the copied python before it has been tested.

Move work out of LLDBTest so we only have to compute it once.

vsk added inline comments.Jun 11 2020, 5:18 PM
lldb/test/API/lit.cfg.py
56 ↗(On Diff #270262)

This isn't relevant for the unit or shell tests because the API tests are the only ones that are executed within a python process, right?

58 ↗(On Diff #270262)

Is the part about synchronization still applicable? Maybe it is, if you run llvm-lit test/API from two different directories?

102 ↗(On Diff #270262)

What does setting python_executable do? I looked this up in llvm and found:

test/lit.cfg.py:    ('%llvm-locstats', "'%s' %s" % (config.python_executable, llvm_locstats_tool)))
test/lit.site.cfg.py.in:config.python_executable = "@PYTHON_EXECUTABLE@"
test/tools/UpdateTestChecks/lit.local.cfg:            config.python_executable, script_path, extra_args)))

Am I missing something, or does something here translate into a lit directive to run python files under python_interpreter?

JDevlieghere marked 6 inline comments as done.Jun 11 2020, 6:20 PM
JDevlieghere added inline comments.
lldb/test/API/lit.cfg.py
56 ↗(On Diff #270262)

Correct.

58 ↗(On Diff #270262)

I guess it is, but not something I'd optimize for. I'll remove the comment.

102 ↗(On Diff #270262)

test/lit.site.cfg.py.in will be configured with the path to the real python executable in the build dir.

JDevlieghere marked 3 inline comments as done.
vsk accepted this revision.Jun 11 2020, 6:55 PM

Lgtm, thanks.

lldb/test/API/lit.cfg.py
102 ↗(On Diff #270262)

This is what I was missing: lldb/test/API/lldbtest.py: executable = test.config.python_executable.

lldb/test/API/lldbtest.py
102

.. so by the time this is reached, executable should point to a known-good python binary.

This revision is now accepted and ready to land.Jun 11 2020, 6:55 PM
JDevlieghere marked 2 inline comments as done.Jun 11 2020, 7:18 PM
JDevlieghere added inline comments.
lldb/test/API/lldbtest.py
102

Yep!

This revision was automatically updated to reflect the committed changes.
JDevlieghere marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2020, 7:48 PM