[all-commits] [llvm/llvm-project] e0dbd0: [lldb/test] Make TestLoadUnload compatible with wi...

Pavel Labath via All-commits all-commits at lists.llvm.org
Tue Apr 14 02:11:32 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e0dbd025131c4d77d8a5050a91d391d950529a8c
      https://github.com/llvm/llvm-project/commit/e0dbd025131c4d77d8a5050a91d391d950529a8c
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-04-14 (Tue, 14 Apr 2020)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
    M lldb/packages/Python/lldbsuite/test/make/Makefile.rules
    A lldb/packages/Python/lldbsuite/test/make/dylib.h
    M lldb/packages/Python/lldbsuite/test/make/test_common.h
    M lldb/test/API/functionalities/load_unload/Makefile
    M lldb/test/API/functionalities/load_unload/TestLoadUnload.py
    M lldb/test/API/functionalities/load_unload/a.cpp
    M lldb/test/API/functionalities/load_unload/b.cpp
    M lldb/test/API/functionalities/load_unload/d.cpp
    M lldb/test/API/functionalities/load_unload/main.cpp

  Log Message:
  -----------
  [lldb/test] Make TestLoadUnload compatible with windows

Summary:
This patch introduces a header "dylib.h" which can be used in tests to
handle shared libraries semi-portably. The shared library APIs on
windows and posix systems look very different, but their underlying
functionality is relatively similar, so the mapping is not difficult.

It also introduces two new macros to wrap the functinality necessary to
export/import function across the dll boundary on windows. Previously we
had the LLDB_TEST_API macro for this purpose, which automagically
changed meaning depending on whether we were building the shared library
or the executable. While convenient for simple cases, this approach was
not sufficient for the more complicated setups where one deals with
multiple shared libraries.

Lastly it rewrites TestLoadUnload, to make use of the new APIs. The
trickiest aspect there is the handling of DYLD_LIBRARY_PATH on macos --
previously setting this variable was not needed as the test used
@executable_path-relative dlopens, but the new generic api does not
support that. Other systems do not support such dlopens either so the
test already contained support for setting the appropriate path
variable, and this patch just makes that logic more generic. In doesn't
seem that the purpose of this test was to exercise @executable_path
imports, so this should not be a problem.

These changes are sufficient to make some of the TestLoadUnload tests
pass on windows. Two other tests will start to pass once D77287 lands.

Reviewers: amccarth, jingham, JDevlieghere, compnerd

Subscribers: lldb-commits

Tags: #lldb

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




More information about the All-commits mailing list