From 0de52e92dcbe00729a0e0d00380a26708e79d08e Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Thu, 3 Oct 2019 07:27:58 -0700 Subject: [PATCH] liblog: use EXPECTED_STREQ for strings These tests are flaky, but we're not seeing what the failure strings are. Bug: 142041379 Test: force a failure and see the right error message Change-Id: Icd7777e5c309cac3b98ce65925980965a3cc3753 --- liblog/tests/liblog_test.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp index 34fb909eb..d8b0ced4f 100644 --- a/liblog/tests/liblog_test.cpp +++ b/liblog/tests/liblog_test.cpp @@ -2664,8 +2664,7 @@ static void create_android_logger(const char* (*fn)(uint32_t tag, print_barrier(); } EXPECT_EQ(0, buffer_to_string); - EXPECT_EQ(strlen(expected_string), strlen(msgBuf)); - EXPECT_EQ(0, strcmp(expected_string, msgBuf)); + EXPECT_STREQ(expected_string, msgBuf); } EXPECT_EQ(1, count); @@ -2858,7 +2857,7 @@ static ssize_t __pmsg_fn(log_id_t logId, char prio, const char* filename, EXPECT_EQ(ANDROID_LOG_VERBOSE, prio); EXPECT_FALSE(NULL == strstr(__pmsg_file, filename)); EXPECT_EQ(len, sizeof(max_payload_buf)); - EXPECT_EQ(0, strcmp(max_payload_buf, buf)); + EXPECT_STREQ(max_payload_buf, buf); ++signaled; if ((len != sizeof(max_payload_buf)) || strcmp(max_payload_buf, buf)) {