OLD | NEW |
1 // Copyright (c) 2015 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2015 The Native Client 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include "native_client/src/include/nacl_assert.h" | 8 #include "native_client/src/include/nacl_assert.h" |
9 #include "native_client/src/untrusted/pll_loader/pll_loader.h" | 9 #include "native_client/src/untrusted/pll_loader/pll_loader.h" |
10 #include "native_client/src/untrusted/pll_loader/pll_root.h" | 10 #include "native_client/src/untrusted/pll_loader/pll_root.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 pll_root->bloom_filter_maskwords_bitmask, 0); | 166 pll_root->bloom_filter_maskwords_bitmask, 0); |
167 | 167 |
168 return pll_root; | 168 return pll_root; |
169 } | 169 } |
170 | 170 |
171 void TestCoreFunctionality(const char *test_dso_file) { | 171 void TestCoreFunctionality(const char *test_dso_file) { |
172 const PLLRoot *pll_root = LoadTranslatedPLL(test_dso_file); | 172 const PLLRoot *pll_root = LoadTranslatedPLL(test_dso_file); |
173 | 173 |
174 // Test dependencies. | 174 // Test dependencies. |
175 ASSERT_EQ(pll_root->dependencies_count, 2); | 175 ASSERT_EQ(pll_root->dependencies_count, 2); |
176 ASSERT_EQ(strcmp(pll_root->dependencies_list, "libfoo.so"), 0); | 176 ASSERT_EQ(strcmp(pll_root->dependencies_list, "test_pll_a.so"), 0); |
177 ASSERT_EQ(strcmp(pll_root->dependencies_list + strlen("libfoo.so") + 1, | 177 ASSERT_EQ(strcmp(pll_root->dependencies_list + strlen("test_pll_a.so") + 1, |
178 "libbar.so"), 0); | 178 "test_pll_b.so"), 0); |
179 | 179 |
180 // Test exports. | 180 // Test exports. |
181 | 181 |
182 DumpExportedSymbols(pll_root); | 182 DumpExportedSymbols(pll_root); |
183 | 183 |
184 ASSERT_EQ(GetExportedSym(pll_root, "does_not_exist"), NULL); | 184 ASSERT_EQ(GetExportedSym(pll_root, "does_not_exist"), NULL); |
185 | 185 |
186 int *var = (int *) GetExportedSym(pll_root, "var"); | 186 int *var = (int *) GetExportedSym(pll_root, "var"); |
187 ASSERT_NE(var, NULL); | 187 ASSERT_NE(var, NULL); |
188 ASSERT_EQ(*var, 2345); | 188 ASSERT_EQ(*var, 2345); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 if (argc != 3) { | 325 if (argc != 3) { |
326 fprintf(stderr, "Usage: pll_symbols_test <ELF file> <ELF file>\n"); | 326 fprintf(stderr, "Usage: pll_symbols_test <ELF file> <ELF file>\n"); |
327 return 1; | 327 return 1; |
328 } | 328 } |
329 | 329 |
330 TestCoreFunctionality(argv[1]); | 330 TestCoreFunctionality(argv[1]); |
331 TestTLS(argv[2]); | 331 TestTLS(argv[2]); |
332 | 332 |
333 return 0; | 333 return 0; |
334 } | 334 } |
OLD | NEW |