Add cleanup call in renode .so library test. PiperOrigin-RevId: 675187665 Change-Id: I5ef7c348d90a3bda446147a5b36ad16b82e2bf4a
diff --git a/riscv/test/librenode_mpact_riscv32_so_test.cc b/riscv/test/librenode_mpact_riscv32_so_test.cc index 9924ccd..38694c4 100644 --- a/riscv/test/librenode_mpact_riscv32_so_test.cc +++ b/riscv/test/librenode_mpact_riscv32_so_test.cc
@@ -104,6 +104,7 @@ using GetRegInfoSize = int32_t (*)(int32_t); using GetRegInfo = int32_t (*)(int32_t, int32_t, char *name, void *info); using WriteRegisterType = void (*)(int32_t, int32_t, uint64_t); +using DestructType = void (*)(int32_t); TEST_F(LibRenodeMpactRiscV32SoTest, RunProgram) { absl::LeakCheckDisabler disabler; @@ -120,6 +121,8 @@ reinterpret_cast<GetRegInfo>(dlsym(lib_, "get_reg_info")); WriteRegisterType write_register = reinterpret_cast<WriteRegisterType>(dlsym(lib_, "write_register")); + DestructType destruct = + reinterpret_cast<DestructType>(dlsym(lib_, "destruct")); // Verify that the function pointers are valid. CHECK_NE(construct, nullptr); CHECK_NE(step, nullptr); @@ -174,6 +177,7 @@ total_stepped += num_stepped; } while (num_stepped > 10'000 && status == 0 && total_stepped < 100'000); EXPECT_EQ("Hello World! 5\n", testing::internal::GetCapturedStdout()); + destruct(id); } } // namespace