upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/loader_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/test/loader_test.cpp')
-rw-r--r--runtime/test/loader_test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/test/loader_test.cpp b/runtime/test/loader_test.cpp
index 71a5ede73..58aae185b 100644
--- a/runtime/test/loader_test.cpp
+++ b/runtime/test/loader_test.cpp
@@ -468,6 +468,23 @@ void test_imports() {
468 dir.Size = sizeof(IMAGE_IMPORT_DESCRIPTOR); 468 dir.Size = sizeof(IMAGE_IMPORT_DESCRIPTOR);
469 expect_rejects("an import thunk table that runs past the image", img); 469 expect_rejects("an import thunk table that runs past the image", img);
470 } 470 }
471 for (const char* dll : {"TestShim", "testshim.dll."}) {
472 // LoadLibrary's file-name rule keys these the same as testshim.dll; without that normalisation the
473 // shim lookup misses while a real host namesake would still bind.
474 const std::string what = std::string("an import naming ") + dll + " resolves to testshim.dll's shim";
475 auto importer = write_image_as(make_import_image(dll, "F"), "importer_key.exe");
476 try {
477 rt::Loader loader(g_dir);
478 rt::Module& m = loader.load(importer);
479 if (m.imports.size() != 1 || m.imports[0].binding != rt::Binding::Shim)
480 return failed(what.c_str(), "the import did not bind as a shim");
481 if (*reinterpret_cast<void**>(m.base + 0x1180) != reinterpret_cast<void*>(&test_shim_function))
482 return failed(what.c_str(), "the address table does not hold the shim function");
483 pass(what.c_str());
484 } catch (const std::exception& e) {
485 failed(what.c_str(), e.what());
486 }
487 }
471} 488}
472 489
473void test_import_name_rvas() { 490void test_import_name_rvas() {