summaryrefslogtreecommitdiff
path: root/libunwindstack/tests/MemoryRemoteTest.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2017-10-18 11:44:51 -0700
committerJosh Gao <jmgao@google.com>2017-11-15 15:38:13 -0800
commitef35aa5d40b6404baf702a58527f1cd3a9f42f19 (patch)
tree99f7797b05c934a10fdcb058b025a0304ca2b6f5 /libunwindstack/tests/MemoryRemoteTest.cpp
parent29c5378e91720b7befabc91fbab0f25d59a23bf1 (diff)
unwindstack: rename Memory::Read to ReadFully.
Rename Memory::Read to ReadFully to match its semantics with that of android::base. ReadPartially will be renamed to Read in a follow up commit, kept intentionally separate so that there aren't any callers accidentally switched from ReadFully to Read. Test: treehugger Change-Id: I7d845ac5244c3025d92c8512e960e5d0d1da05af
Diffstat (limited to 'libunwindstack/tests/MemoryRemoteTest.cpp')
-rw-r--r--libunwindstack/tests/MemoryRemoteTest.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/libunwindstack/tests/MemoryRemoteTest.cpp b/libunwindstack/tests/MemoryRemoteTest.cpp
index 8ab806819..73cace319 100644
--- a/libunwindstack/tests/MemoryRemoteTest.cpp
+++ b/libunwindstack/tests/MemoryRemoteTest.cpp
@@ -71,7 +71,7 @@ TEST_F(MemoryRemoteTest, read) {
MemoryRemote remote(pid);
std::vector<uint8_t> dst(1024);
- ASSERT_TRUE(remote.Read(reinterpret_cast<uint64_t>(src.data()), dst.data(), 1024));
+ ASSERT_TRUE(remote.ReadFully(reinterpret_cast<uint64_t>(src.data()), dst.data(), 1024));
for (size_t i = 0; i < 1024; i++) {
ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
}
@@ -90,7 +90,8 @@ TEST_F(MemoryRemoteTest, ReadPartially) {
pid_t pid;
if ((pid = fork()) == 0) {
- while (true);
+ while (true)
+ ;
exit(1);
}
ASSERT_LT(0, pid);
@@ -133,17 +134,17 @@ TEST_F(MemoryRemoteTest, read_fail) {
MemoryRemote remote(pid);
std::vector<uint8_t> dst(pagesize);
- ASSERT_TRUE(remote.Read(reinterpret_cast<uint64_t>(src), dst.data(), pagesize));
+ ASSERT_TRUE(remote.ReadFully(reinterpret_cast<uint64_t>(src), dst.data(), pagesize));
for (size_t i = 0; i < 1024; i++) {
ASSERT_EQ(0x4cU, dst[i]) << "Failed at byte " << i;
}
- ASSERT_FALSE(remote.Read(reinterpret_cast<uint64_t>(src) + pagesize, dst.data(), 1));
- ASSERT_TRUE(remote.Read(reinterpret_cast<uint64_t>(src) + pagesize - 1, dst.data(), 1));
- ASSERT_FALSE(remote.Read(reinterpret_cast<uint64_t>(src) + pagesize - 4, dst.data(), 8));
+ ASSERT_FALSE(remote.ReadFully(reinterpret_cast<uint64_t>(src) + pagesize, dst.data(), 1));
+ ASSERT_TRUE(remote.ReadFully(reinterpret_cast<uint64_t>(src) + pagesize - 1, dst.data(), 1));
+ ASSERT_FALSE(remote.ReadFully(reinterpret_cast<uint64_t>(src) + pagesize - 4, dst.data(), 8));
// Check overflow condition is caught properly.
- ASSERT_FALSE(remote.Read(UINT64_MAX - 100, dst.data(), 200));
+ ASSERT_FALSE(remote.ReadFully(UINT64_MAX - 100, dst.data(), 200));
ASSERT_EQ(0, munmap(src, pagesize));
@@ -153,7 +154,8 @@ TEST_F(MemoryRemoteTest, read_fail) {
TEST_F(MemoryRemoteTest, read_overflow) {
pid_t pid;
if ((pid = fork()) == 0) {
- while (true);
+ while (true)
+ ;
exit(1);
}
ASSERT_LT(0, pid);
@@ -165,7 +167,7 @@ TEST_F(MemoryRemoteTest, read_overflow) {
// Check overflow condition is caught properly.
std::vector<uint8_t> dst(200);
- ASSERT_FALSE(remote.Read(UINT64_MAX - 100, dst.data(), 200));
+ ASSERT_FALSE(remote.ReadFully(UINT64_MAX - 100, dst.data(), 200));
ASSERT_TRUE(Detach(pid));
}
@@ -184,8 +186,8 @@ TEST_F(MemoryRemoteTest, read_illegal) {
MemoryRemote remote(pid);
std::vector<uint8_t> dst(100);
- ASSERT_FALSE(remote.Read(0, dst.data(), 1));
- ASSERT_FALSE(remote.Read(0, dst.data(), 100));
+ ASSERT_FALSE(remote.ReadFully(0, dst.data(), 1));
+ ASSERT_FALSE(remote.ReadFully(0, dst.data(), 100));
ASSERT_TRUE(Detach(pid));
}