No public description PiperOrigin-RevId: 641333713 Change-Id: I6b832555ed1da79783e9180d680b9ed36c59d08d
diff --git a/cheriot/BUILD b/cheriot/BUILD index 0193342..4e700d1 100644 --- a/cheriot/BUILD +++ b/cheriot/BUILD
@@ -291,7 +291,7 @@ deps = [ ":cheriot_top", ":debug_command_shell", - "@com_github_serge1_elfio//:elfio", + "//third_party/elfio", "@com_google_absl//absl/container:btree", "@com_google_absl//absl/functional:any_invocable", "@com_google_absl//absl/log",
diff --git a/cheriot/profiler.cc b/cheriot/profiler.cc index c20bdc8..9e90cec 100644 --- a/cheriot/profiler.cc +++ b/cheriot/profiler.cc
@@ -23,7 +23,7 @@ #include "absl/numeric/bits.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" -#include "elfio/elf_types.hpp" +#include "third_party/elfio/elfio/elf_types.hpp" namespace mpact::sim::cheriot {
diff --git a/cheriot/test/BUILD b/cheriot/test/BUILD index 08d716c..a7894ae 100644 --- a/cheriot/test/BUILD +++ b/cheriot/test/BUILD
@@ -30,6 +30,7 @@ "@com_google_absl//absl/random", "@com_google_absl//absl/strings", "@com_google_absl//absl/types:span", + "@com_google_googletest//:gtest_for_library_testonly", "@com_google_mpact-riscv//riscv:riscv_state", "@com_google_mpact-sim//mpact/sim/generic:instruction", "@com_google_mpact-sim//mpact/sim/util/memory", @@ -214,3 +215,17 @@ "@com_google_mpact-sim//mpact/sim/generic:core", ], ) + +cc_test( + name = "librenode_mpact_cheriot.so_test", + size = "small", + srcs = ["librenode_mpact_cheriot_so_test.cc"], + data = [ + "//cheriot:renode_mpact_cheriot", + ], + deps = [ + "@com_google_absl//absl/debugging:leak_check", + "@com_google_absl//absl/strings", + "@com_google_googletest//:gtest_main", + ], +)
diff --git a/cheriot/test/librenode_mpact_cheriot_so_test.cc b/cheriot/test/librenode_mpact_cheriot_so_test.cc new file mode 100644 index 0000000..38a3522 --- /dev/null +++ b/cheriot/test/librenode_mpact_cheriot_so_test.cc
@@ -0,0 +1,92 @@ +#include <dlfcn.h> + +#include <string> + +#include "absl/debugging/leak_check.h" +#include "absl/strings/str_cat.h" +#include "googlemock/include/gmock/gmock.h" + +namespace { + +constexpr char kFileName[] = "librenode_mpact_cheriot.so"; + +constexpr char kDepotPath[] = "cheriot/"; + +class LibRenodeMpactCheriotSoTest : public ::testing::Test { + protected: + LibRenodeMpactCheriotSoTest() { + std::string path = absl::StrCat(kDepotPath, kFileName); + absl::LeakCheckDisabler disabler; // Ignore leaks from dlopen. + lib_ = dlopen(path.c_str(), RTLD_LAZY); + } + + ~LibRenodeMpactCheriotSoTest() { dlclose(lib_); } + + void *lib_ = nullptr; +}; + +TEST_F(LibRenodeMpactCheriotSoTest, Construct) { + EXPECT_NE(dlsym(lib_, "construct"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, ConstructWithSysbus) { + EXPECT_NE(dlsym(lib_, "construct_with_sysbus"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, Connect) { + EXPECT_NE(dlsym(lib_, "connect"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, ConnectWithSysbus) { + EXPECT_NE(dlsym(lib_, "connect_with_sysbus"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, Destruct) { + EXPECT_NE(dlsym(lib_, "destruct"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, GetRegInfoSize) { + EXPECT_NE(dlsym(lib_, "get_reg_info_size"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, GetRegInfo) { + EXPECT_NE(dlsym(lib_, "get_reg_info"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, LoadElf) { + EXPECT_NE(dlsym(lib_, "load_elf"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, ReadRegister) { + EXPECT_NE(dlsym(lib_, "read_register"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, WriteRegister) { + EXPECT_NE(dlsym(lib_, "write_register"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, ReadMemory) { + EXPECT_NE(dlsym(lib_, "read_memory"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, WriteMemory) { + EXPECT_NE(dlsym(lib_, "write_memory"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, Reset) { + EXPECT_NE(dlsym(lib_, "reset"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, Step) { + EXPECT_NE(dlsym(lib_, "step"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, SetConfig) { + EXPECT_NE(dlsym(lib_, "set_config"), nullptr); +} + +TEST_F(LibRenodeMpactCheriotSoTest, SetIrqValue) { + EXPECT_NE(dlsym(lib_, "set_irq_value"), nullptr); +} + +} // namespace