Skip to content

Commit

Permalink
[Clank SSM]: Define base_profiler_test_support_library as a loadable …
Browse files Browse the repository at this point in the history
…module.

Android doesn't support shared_library (see native_library_unittest.cc).
base_profiler_test_support_library is defined as a loadable_module for
upcoming support for android in stack_sampling_profiler_test
https://chromium-review.googlesource.com/c/chromium/src/+/2055743/20

Bug: 989102
Change-Id: Iac0f2764f5177820436db93cc4966782a879308d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2075158
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Mike Wittman <wittman@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744851}
  • Loading branch information
Etienne Pierre-doray authored and Commit Bot committed Feb 27, 2020
1 parent 7c2b6c4 commit 5172af8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,8 @@ if (is_win) {
if (is_win || is_mac) {
if (current_cpu == "x64" || (current_cpu == "arm64" && is_win)) {
# Must be a shared library so that it can be unloaded during testing.
shared_library("base_profiler_test_support_library") {
loadable_module("base_profiler_test_support_library") {
testonly = true
sources = [ "profiler/test_support_library.cc" ]
}
}
Expand Down Expand Up @@ -3014,7 +3015,7 @@ test("base_unittests") {
"Foundation.framework",
]
if (current_cpu == "x64") {
data_deps += [ ":base_profiler_test_support_library" ]
deps += [ ":base_profiler_test_support_library" ]
}
}

Expand Down Expand Up @@ -3101,7 +3102,7 @@ test("base_unittests") {
deps += [ "//base:scoped_handle_test_dll" ]
if (current_cpu == "x64" || current_cpu == "arm64") {
sources += [ "profiler/win32_stack_frame_unwinder_unittest.cc" ]
data_deps += [ ":base_profiler_test_support_library" ]
deps += [ ":base_profiler_test_support_library" ]
}
sources += [ "files/os_validation_win_unittest.cc" ]
}
Expand Down
4 changes: 2 additions & 2 deletions base/profiler/stack_sampling_profiler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ NativeLibrary LoadOtherLibrary() {
// macros in a function returning non-null.
const auto load = [](NativeLibrary* library) {
FilePath other_library_path;
ASSERT_TRUE(PathService::Get(DIR_EXE, &other_library_path));
ASSERT_TRUE(PathService::Get(DIR_MODULE, &other_library_path));
other_library_path = other_library_path.AppendASCII(
GetNativeLibraryName("base_profiler_test_support_library"));
GetLoadableModuleName("base_profiler_test_support_library"));
NativeLibraryLoadError load_error;
*library = LoadNativeLibrary(other_library_path, &load_error);
ASSERT_TRUE(*library) << "error loading " << other_library_path.value()
Expand Down
6 changes: 4 additions & 2 deletions base/profiler/test_support_library.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
// Note: there is intentionally no header file associated with this library so
// we don't risk implicitly demand loading it by accessing a symbol.

#if defined(WIN32)
#include "build/build_config.h"

#if defined(OS_WIN)
#define BASE_PROFILER_TEST_SUPPORT_LIBRARY_EXPORT __declspec(dllexport)
#else // defined(WIN32)
#else // defined(OS_WIN)
#define BASE_PROFILER_TEST_SUPPORT_LIBRARY_EXPORT __attribute__((visibility("default")))
#endif

Expand Down

0 comments on commit 5172af8

Please sign in to comment.