jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <gtest/gtest.h> |
| 18 | |
| 19 | #include <dlfcn.h> |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 20 | #include <libgen.h> |
| 21 | #include <limits.h> |
| 22 | #include <stdio.h> |
| 23 | #include <stdint.h> |
| 24 | |
| 25 | #include <string> |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 26 | |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 27 | #define ASSERT_SUBSTR(needle, haystack) \ |
| 28 | ASSERT_PRED_FORMAT2(::testing::IsSubstring, needle, haystack) |
| 29 | |
Elliott Hughes | 1728b23 | 2014-05-14 10:02:03 -0700 | [diff] [blame] | 30 | static bool g_called = false; |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 31 | extern "C" void DlSymTestFunction() { |
Elliott Hughes | 1728b23 | 2014-05-14 10:02:03 -0700 | [diff] [blame] | 32 | g_called = true; |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 33 | } |
| 34 | |
Dmitriy Ivanov | f8846a4 | 2014-07-08 21:21:34 -0700 | [diff] [blame] | 35 | static int g_ctor_function_called = 0; |
| 36 | |
| 37 | extern "C" void ctor_function() __attribute__ ((constructor)); |
| 38 | |
| 39 | extern "C" void ctor_function() { |
| 40 | g_ctor_function_called = 17; |
| 41 | } |
| 42 | |
| 43 | TEST(dlfcn, ctor_function_call) { |
| 44 | ASSERT_EQ(17, g_ctor_function_called); |
| 45 | } |
| 46 | |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 47 | TEST(dlfcn, dlsym_in_self) { |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 48 | dlerror(); // Clear any pending errors. |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 49 | void* self = dlopen(NULL, RTLD_NOW); |
| 50 | ASSERT_TRUE(self != NULL); |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 51 | ASSERT_TRUE(dlerror() == NULL); |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 52 | |
| 53 | void* sym = dlsym(self, "DlSymTestFunction"); |
| 54 | ASSERT_TRUE(sym != NULL); |
| 55 | |
| 56 | void (*function)() = reinterpret_cast<void(*)()>(sym); |
| 57 | |
Elliott Hughes | 1728b23 | 2014-05-14 10:02:03 -0700 | [diff] [blame] | 58 | g_called = false; |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 59 | function(); |
Elliott Hughes | 1728b23 | 2014-05-14 10:02:03 -0700 | [diff] [blame] | 60 | ASSERT_TRUE(g_called); |
Elliott Hughes | 1a69616 | 2012-11-01 13:49:32 -0700 | [diff] [blame] | 61 | |
| 62 | ASSERT_EQ(0, dlclose(self)); |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 63 | } |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 64 | |
Dmitriy Ivanov | ce0ba3c | 2014-07-01 19:09:49 -0700 | [diff] [blame] | 65 | #if !defined(__LP64__) |
| 66 | // Current compiler/static linker used for aarch64 |
| 67 | // platform optimizes LOCAL PROTECTED symbol |
| 68 | // in libtest_local_symbol.so out of existence |
Dmitriy Ivanov | d97e9f5 | 2014-06-29 12:28:37 -0700 | [diff] [blame] | 69 | TEST(dlfcn, dlsym_local_symbol) { |
| 70 | void* handle = dlopen("libtest_local_symbol.so", RTLD_NOW); |
| 71 | ASSERT_TRUE(handle != NULL); |
| 72 | dlerror(); |
| 73 | void* sym = dlsym(handle, "private_taxicab_number"); |
| 74 | ASSERT_TRUE(sym == NULL); |
| 75 | ASSERT_STREQ("undefined symbol: private_taxicab_number", dlerror()); |
| 76 | |
| 77 | uint32_t (*f)(void); |
| 78 | f = reinterpret_cast<uint32_t (*)(void)>(dlsym(handle, "dlsym_local_symbol_get_taxicab_number_using_dlsym")); |
| 79 | ASSERT_TRUE(f != NULL); |
Elliott Hughes | d06ee1d | 2014-07-01 17:17:46 -0700 | [diff] [blame] | 80 | ASSERT_EQ(1729U, f()); |
Dmitriy Ivanov | d97e9f5 | 2014-06-29 12:28:37 -0700 | [diff] [blame] | 81 | } |
Dmitriy Ivanov | ce0ba3c | 2014-07-01 19:09:49 -0700 | [diff] [blame] | 82 | #endif |
Dmitriy Ivanov | d97e9f5 | 2014-06-29 12:28:37 -0700 | [diff] [blame] | 83 | |
Dmitriy Ivanov | b648a8a | 2014-05-19 15:06:58 -0700 | [diff] [blame] | 84 | TEST(dlfcn, dlopen_noload) { |
| 85 | void* handle = dlopen("libtest_simple.so", RTLD_NOW | RTLD_NOLOAD); |
| 86 | ASSERT_TRUE(handle == NULL); |
| 87 | handle = dlopen("libtest_simple.so", RTLD_NOW); |
| 88 | void* handle2 = dlopen("libtest_simple.so", RTLD_NOW | RTLD_NOLOAD); |
| 89 | ASSERT_TRUE(handle != NULL); |
| 90 | ASSERT_TRUE(handle2 != NULL); |
| 91 | ASSERT_TRUE(handle == handle2); |
| 92 | ASSERT_EQ(0, dlclose(handle)); |
| 93 | ASSERT_EQ(0, dlclose(handle2)); |
| 94 | } |
| 95 | |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 96 | TEST(dlfcn, dlopen_failure) { |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 97 | void* self = dlopen("/does/not/exist", RTLD_NOW); |
| 98 | ASSERT_TRUE(self == NULL); |
Elliott Hughes | 063525c | 2014-05-13 11:19:57 -0700 | [diff] [blame] | 99 | #if defined(__BIONIC__) |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 100 | ASSERT_STREQ("dlopen failed: library \"/does/not/exist\" not found", dlerror()); |
| 101 | #else |
| 102 | ASSERT_STREQ("/does/not/exist: cannot open shared object file: No such file or directory", dlerror()); |
| 103 | #endif |
| 104 | } |
| 105 | |
Elliott Hughes | ad88a08 | 2012-10-24 18:37:21 -0700 | [diff] [blame] | 106 | static void* ConcurrentDlErrorFn(void*) { |
Elliott Hughes | 5419b94 | 2012-10-16 15:54:46 -0700 | [diff] [blame] | 107 | dlopen("/child/thread", RTLD_NOW); |
| 108 | return reinterpret_cast<void*>(strdup(dlerror())); |
| 109 | } |
| 110 | |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 111 | TEST(dlfcn, dlerror_concurrent) { |
Elliott Hughes | 5419b94 | 2012-10-16 15:54:46 -0700 | [diff] [blame] | 112 | dlopen("/main/thread", RTLD_NOW); |
| 113 | const char* main_thread_error = dlerror(); |
| 114 | ASSERT_SUBSTR("/main/thread", main_thread_error); |
| 115 | |
| 116 | pthread_t t; |
| 117 | ASSERT_EQ(0, pthread_create(&t, NULL, ConcurrentDlErrorFn, NULL)); |
| 118 | void* result; |
| 119 | ASSERT_EQ(0, pthread_join(t, &result)); |
| 120 | char* child_thread_error = static_cast<char*>(result); |
| 121 | ASSERT_SUBSTR("/child/thread", child_thread_error); |
| 122 | free(child_thread_error); |
| 123 | |
| 124 | ASSERT_SUBSTR("/main/thread", main_thread_error); |
| 125 | } |
| 126 | |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 127 | TEST(dlfcn, dlsym_failures) { |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 128 | dlerror(); // Clear any pending errors. |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 129 | void* self = dlopen(NULL, RTLD_NOW); |
| 130 | ASSERT_TRUE(self != NULL); |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 131 | ASSERT_TRUE(dlerror() == NULL); |
| 132 | |
| 133 | void* sym; |
| 134 | |
Dmitriy Ivanov | 44adf93 | 2014-05-22 09:49:24 -0700 | [diff] [blame] | 135 | #if defined(__BIONIC__) && !defined(__LP64__) |
| 136 | // RTLD_DEFAULT in lp32 bionic is not (void*)0 |
| 137 | // so it can be distinguished from the NULL handle. |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 138 | sym = dlsym(NULL, "test"); |
| 139 | ASSERT_TRUE(sym == NULL); |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 140 | ASSERT_SUBSTR("dlsym library handle is null", dlerror()); |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 141 | #endif |
| 142 | |
| 143 | // NULL symbol name. |
Elliott Hughes | 063525c | 2014-05-13 11:19:57 -0700 | [diff] [blame] | 144 | #if defined(__BIONIC__) |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 145 | // glibc marks this parameter non-null and SEGVs if you cheat. |
| 146 | sym = dlsym(self, NULL); |
| 147 | ASSERT_TRUE(sym == NULL); |
| 148 | ASSERT_SUBSTR("", dlerror()); |
| 149 | #endif |
| 150 | |
| 151 | // Symbol that doesn't exist. |
| 152 | sym = dlsym(self, "ThisSymbolDoesNotExist"); |
| 153 | ASSERT_TRUE(sym == NULL); |
| 154 | ASSERT_SUBSTR("undefined symbol: ThisSymbolDoesNotExist", dlerror()); |
Elliott Hughes | 1a69616 | 2012-11-01 13:49:32 -0700 | [diff] [blame] | 155 | |
| 156 | ASSERT_EQ(0, dlclose(self)); |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 157 | } |
| 158 | |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 159 | TEST(dlfcn, dladdr) { |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 160 | dlerror(); // Clear any pending errors. |
| 161 | void* self = dlopen(NULL, RTLD_NOW); |
| 162 | ASSERT_TRUE(self != NULL); |
| 163 | ASSERT_TRUE(dlerror() == NULL); |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 164 | |
| 165 | void* sym = dlsym(self, "DlSymTestFunction"); |
| 166 | ASSERT_TRUE(sym != NULL); |
| 167 | |
| 168 | // Deliberately ask dladdr for an address inside a symbol, rather than the symbol base address. |
| 169 | void* addr = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(sym) + 2); |
| 170 | |
| 171 | Dl_info info; |
| 172 | int rc = dladdr(addr, &info); |
| 173 | ASSERT_NE(rc, 0); // Zero on error, non-zero on success. |
| 174 | |
| 175 | // Get the name of this executable. |
| 176 | char executable_path[PATH_MAX]; |
| 177 | rc = readlink("/proc/self/exe", executable_path, sizeof(executable_path)); |
| 178 | ASSERT_NE(rc, -1); |
| 179 | executable_path[rc] = '\0'; |
| 180 | std::string executable_name(basename(executable_path)); |
| 181 | |
| 182 | // The filename should be that of this executable. |
| 183 | // Note that we don't know whether or not we have the full path, so we want an "ends_with" test. |
| 184 | std::string dli_fname(info.dli_fname); |
| 185 | dli_fname = basename(&dli_fname[0]); |
| 186 | ASSERT_EQ(dli_fname, executable_name); |
| 187 | |
| 188 | // The symbol name should be the symbol we looked up. |
| 189 | ASSERT_STREQ(info.dli_sname, "DlSymTestFunction"); |
| 190 | |
| 191 | // The address should be the exact address of the symbol. |
| 192 | ASSERT_EQ(info.dli_saddr, sym); |
| 193 | |
| 194 | // Look in /proc/pid/maps to find out what address we were loaded at. |
| 195 | // TODO: factor /proc/pid/maps parsing out into a class and reuse all over bionic. |
| 196 | void* base_address = NULL; |
| 197 | char path[PATH_MAX]; |
| 198 | snprintf(path, sizeof(path), "/proc/%d/maps", getpid()); |
| 199 | char line[BUFSIZ]; |
| 200 | FILE* fp = fopen(path, "r"); |
| 201 | ASSERT_TRUE(fp != NULL); |
| 202 | while (fgets(line, sizeof(line), fp) != NULL) { |
| 203 | uintptr_t start = strtoul(line, 0, 16); |
| 204 | line[strlen(line) - 1] = '\0'; // Chomp the '\n'. |
| 205 | char* path = strchr(line, '/'); |
Elliott Hughes | 156da96 | 2012-10-09 17:14:56 -0700 | [diff] [blame] | 206 | if (path != NULL && strcmp(executable_path, path) == 0) { |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 207 | base_address = reinterpret_cast<void*>(start); |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | fclose(fp); |
| 212 | |
| 213 | // The base address should be the address we were loaded at. |
| 214 | ASSERT_EQ(info.dli_fbase, base_address); |
Elliott Hughes | 1a69616 | 2012-11-01 13:49:32 -0700 | [diff] [blame] | 215 | |
| 216 | ASSERT_EQ(0, dlclose(self)); |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 217 | } |
| 218 | |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 219 | TEST(dlfcn, dladdr_invalid) { |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 220 | Dl_info info; |
| 221 | |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 222 | dlerror(); // Clear any pending errors. |
| 223 | |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 224 | // No symbol corresponding to NULL. |
| 225 | ASSERT_EQ(dladdr(NULL, &info), 0); // Zero on error, non-zero on success. |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 226 | ASSERT_TRUE(dlerror() == NULL); // dladdr(3) doesn't set dlerror(3). |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 227 | |
| 228 | // No symbol corresponding to a stack address. |
| 229 | ASSERT_EQ(dladdr(&info, &info), 0); // Zero on error, non-zero on success. |
Elliott Hughes | 3b297c4 | 2012-10-11 16:08:51 -0700 | [diff] [blame] | 230 | ASSERT_TRUE(dlerror() == NULL); // dladdr(3) doesn't set dlerror(3). |
Elliott Hughes | 8e15b08 | 2012-09-26 11:44:01 -0700 | [diff] [blame] | 231 | } |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 232 | |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 233 | // Our dynamic linker doesn't support GNU hash tables. |
Elliott Hughes | a43e906 | 2013-01-07 14:18:22 -0800 | [diff] [blame] | 234 | #if defined(__BIONIC__) |
| 235 | // GNU-style ELF hash tables are incompatible with the MIPS ABI. |
| 236 | // MIPS requires .dynsym to be sorted to match the GOT but GNU-style requires sorting by hash code. |
| 237 | #if !defined(__mips__) |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 238 | TEST(dlfcn, dlopen_library_with_only_gnu_hash) { |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 239 | dlerror(); // Clear any pending errors. |
Elliott Hughes | 6e33b02 | 2012-11-07 18:16:02 -0800 | [diff] [blame] | 240 | void* handle = dlopen("no-elf-hash-table-library.so", RTLD_NOW); |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 241 | ASSERT_TRUE(handle == NULL); |
Elliott Hughes | 6e33b02 | 2012-11-07 18:16:02 -0800 | [diff] [blame] | 242 | ASSERT_STREQ("dlopen failed: empty/missing DT_HASH in \"no-elf-hash-table-library.so\" (built with --hash-style=gnu?)", dlerror()); |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 243 | } |
| 244 | #endif |
Elliott Hughes | a43e906 | 2013-01-07 14:18:22 -0800 | [diff] [blame] | 245 | #endif |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 246 | |
| 247 | TEST(dlfcn, dlopen_bad_flags) { |
| 248 | dlerror(); // Clear any pending errors. |
| 249 | void* handle; |
| 250 | |
Elliott Hughes | 063525c | 2014-05-13 11:19:57 -0700 | [diff] [blame] | 251 | #if defined(__GLIBC__) |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 252 | // glibc was smart enough not to define RTLD_NOW as 0, so it can detect missing flags. |
| 253 | handle = dlopen(NULL, 0); |
| 254 | ASSERT_TRUE(handle == NULL); |
| 255 | ASSERT_SUBSTR("invalid", dlerror()); |
| 256 | #endif |
| 257 | |
| 258 | handle = dlopen(NULL, 0xffffffff); |
| 259 | ASSERT_TRUE(handle == NULL); |
| 260 | ASSERT_SUBSTR("invalid", dlerror()); |
| 261 | |
| 262 | // glibc actually allows you to choose both RTLD_NOW and RTLD_LAZY at the same time, and so do we. |
| 263 | handle = dlopen(NULL, RTLD_NOW|RTLD_LAZY); |
| 264 | ASSERT_TRUE(handle != NULL); |
| 265 | ASSERT_SUBSTR(NULL, dlerror()); |
| 266 | } |
Sergey Melnikov | ebd506c | 2013-10-31 18:02:12 +0400 | [diff] [blame] | 267 | |
| 268 | TEST(dlfcn, rtld_default_unknown_symbol) { |
Elliott Hughes | 2ed7109 | 2013-11-11 15:48:06 -0800 | [diff] [blame] | 269 | void* addr = dlsym(RTLD_DEFAULT, "ANY_UNKNOWN_SYMBOL_NAME"); |
Sergey Melnikov | ebd506c | 2013-10-31 18:02:12 +0400 | [diff] [blame] | 270 | ASSERT_TRUE(addr == NULL); |
| 271 | } |
| 272 | |
| 273 | TEST(dlfcn, rtld_default_known_symbol) { |
Elliott Hughes | 2ed7109 | 2013-11-11 15:48:06 -0800 | [diff] [blame] | 274 | void* addr = dlsym(RTLD_DEFAULT, "fopen"); |
| 275 | ASSERT_TRUE(addr != NULL); |
| 276 | } |
| 277 | |
| 278 | TEST(dlfcn, rtld_next_unknown_symbol) { |
| 279 | void* addr = dlsym(RTLD_NEXT, "ANY_UNKNOWN_SYMBOL_NAME"); |
| 280 | ASSERT_TRUE(addr == NULL); |
| 281 | } |
| 282 | |
| 283 | TEST(dlfcn, rtld_next_known_symbol) { |
| 284 | void* addr = dlsym(RTLD_NEXT, "fopen"); |
Sergey Melnikov | ebd506c | 2013-10-31 18:02:12 +0400 | [diff] [blame] | 285 | ASSERT_TRUE(addr != NULL); |
| 286 | } |
Dmitriy Ivanov | 7db1809 | 2014-05-08 12:27:25 -0700 | [diff] [blame] | 287 | |
Dmitriy Ivanov | ce44166 | 2014-06-17 15:56:38 -0700 | [diff] [blame] | 288 | TEST(dlfcn, dlsym_weak_func) { |
| 289 | dlerror(); |
| 290 | void* handle = dlopen("libtest_dlsym_weak_func.so",RTLD_NOW); |
| 291 | ASSERT_TRUE(handle != NULL); |
| 292 | |
| 293 | int (*weak_func)(); |
| 294 | weak_func = reinterpret_cast<int (*)()>(dlsym(handle, "weak_func")); |
| 295 | ASSERT_TRUE(weak_func != NULL) << "dlerror: " << dlerror(); |
| 296 | EXPECT_EQ(42, weak_func()); |
| 297 | dlclose(handle); |
| 298 | } |
| 299 | |
Dmitriy Ivanov | 7db1809 | 2014-05-08 12:27:25 -0700 | [diff] [blame] | 300 | TEST(dlfcn, dlopen_symlink) { |
| 301 | void* handle1 = dlopen("libdlext_test.so", RTLD_NOW); |
| 302 | void* handle2 = dlopen("libdlext_test_v2.so", RTLD_NOW); |
| 303 | ASSERT_TRUE(handle1 != NULL); |
| 304 | ASSERT_TRUE(handle2 != NULL); |
| 305 | ASSERT_EQ(handle1, handle2); |
| 306 | } |