diff options
| author | Tom Cherry <tomcherry@google.com> | 2020-10-06 15:54:26 -0700 |
|---|---|---|
| committer | Tom Cherry <tomcherry@google.com> | 2020-10-06 15:54:26 -0700 |
| commit | cb516a3a7524fa2a9f9ae00e4907ade54d449f5b (patch) | |
| tree | 7a02ee54a1c1fff2532bb9a2168c999ac588b8e3 /logd/SerializedLogChunkTest.cpp | |
| parent | 6eb7c520065dfb300a103fce649f0dbd4aadabcc (diff) | |
logd: fix bad test assumptions
SerializedLogChunk.three_logs assumes that log buffers are
zero-initialized, but they are not. This causes test failures on
host.
Test: this test passes
Change-Id: I0dfa282bdc36eaa4e8e39d85c5227f717b45ec2a
Diffstat (limited to 'logd/SerializedLogChunkTest.cpp')
| -rw-r--r-- | logd/SerializedLogChunkTest.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/logd/SerializedLogChunkTest.cpp b/logd/SerializedLogChunkTest.cpp index 3b451252d4..862c3fe312 100644 --- a/logd/SerializedLogChunkTest.cpp +++ b/logd/SerializedLogChunkTest.cpp @@ -99,13 +99,9 @@ TEST(SerializedLogChunk, three_logs) { "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" // Timestamp "\x0C\x00last message"; // msg_len + message - for (size_t i = 0; i < chunk_size; ++i) { - if (i < sizeof(expected_buffer_data)) { - EXPECT_EQ(static_cast<uint8_t>(expected_buffer_data[i]), chunk.data()[i]) - << "position: " << i; - } else { - EXPECT_EQ(0, chunk.data()[i]) << "position: " << i; - } + for (size_t i = 0; i < sizeof(expected_buffer_data); ++i) { + EXPECT_EQ(static_cast<uint8_t>(expected_buffer_data[i]), chunk.data()[i]) + << "position: " << i; } } |
