OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/native_library.h" | 7 #include "base/native_library.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/test/native_library_test_utils.h" | 9 #include "base/test/native_library_test_utils.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Verifies that we can load a native library and resolve its exported symbols. | 93 // Verifies that we can load a native library and resolve its exported symbols. |
94 TEST(NativeLibraryTest, LoadLibrary) { | 94 TEST(NativeLibraryTest, LoadLibrary) { |
95 TestLibrary library; | 95 TestLibrary library; |
96 EXPECT_EQ(5, library.Call<int>("GetSimpleTestValue")); | 96 EXPECT_EQ(5, library.Call<int>("GetSimpleTestValue")); |
97 } | 97 } |
98 | 98 |
99 #endif // !defined(OS_ANDROID) | 99 #endif // !defined(OS_ANDROID) |
100 | 100 |
101 // Android dlopen() requires further investigation, as it might vary across | 101 // Android dlopen() requires further investigation, as it might vary across |
102 // versions with respect to symbol resolution scope. | 102 // versions with respect to symbol resolution scope. |
103 // TSan errors out on RTLD_DEEPBIND, https://crbug.com/705255 | 103 // TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255 |
104 #if !defined(OS_ANDROID) && !defined(THREAD_SANITIZER) | 104 #if !defined(OS_ANDROID) && !defined(THREAD_SANITIZER) && \ |
| 105 !defined(MEMORY_SANITIZER) |
105 | 106 |
106 // Verifies that the |prefer_own_symbols| option satisfies its guarantee that | 107 // Verifies that the |prefer_own_symbols| option satisfies its guarantee that |
107 // a loaded library will always prefer local symbol resolution before | 108 // a loaded library will always prefer local symbol resolution before |
108 // considering global symbols. | 109 // considering global symbols. |
109 TEST(NativeLibraryTest, LoadLibraryPreferOwnSymbols) { | 110 TEST(NativeLibraryTest, LoadLibraryPreferOwnSymbols) { |
110 NativeLibraryOptions options; | 111 NativeLibraryOptions options; |
111 options.prefer_own_symbols = true; | 112 options.prefer_own_symbols = true; |
112 TestLibrary library(options); | 113 TestLibrary library(options); |
113 | 114 |
114 // Verify that this binary and the DSO use different storage for | 115 // Verify that this binary and the DSO use different storage for |
(...skipping 22 matching lines...) Expand all Loading... |
137 EXPECT_EQ(4, library.Call<int>("NativeLibraryTestIncrement")); | 138 EXPECT_EQ(4, library.Call<int>("NativeLibraryTestIncrement")); |
138 EXPECT_EQ(2, NativeLibraryTestIncrement()); | 139 EXPECT_EQ(2, NativeLibraryTestIncrement()); |
139 EXPECT_EQ(3, NativeLibraryTestIncrement()); | 140 EXPECT_EQ(3, NativeLibraryTestIncrement()); |
140 } | 141 } |
141 | 142 |
142 #endif // !defined(OS_ANDROID) | 143 #endif // !defined(OS_ANDROID) |
143 | 144 |
144 #endif // !defined(OS_IOS) && !defined(ADDRESS_SANITIZER) | 145 #endif // !defined(OS_IOS) && !defined(ADDRESS_SANITIZER) |
145 | 146 |
146 } // namespace base | 147 } // namespace base |
OLD | NEW |