From a5e2429f09295dd94b0ae2125e380cfb3b02ab04 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Thu, 18 Sep 2014 10:25:38 -0700 Subject: [PATCH] logcat: tests: deal with -v threadtime default - specify -v brief where necessary to preserve tests - fix an occasional issue for logrotate and device block size Change-Id: I09b02cc0359dc351a89311abc3ee762a0f23582c --- logcat/tests/logcat_test.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp index 85756d5b0..321eaeb9d 100644 --- a/logcat/tests/logcat_test.cpp +++ b/logcat/tests/logcat_test.cpp @@ -243,7 +243,7 @@ TEST(logcat, End_to_End) { FILE *fp; ASSERT_TRUE(NULL != (fp = popen( - "logcat -b events -t 100 2>/dev/null", + "logcat -v brief -b events -t 100 2>/dev/null", "r"))); char buffer[5120]; @@ -275,7 +275,7 @@ TEST(logcat, get_size) { // NB: crash log only available in user space ASSERT_TRUE(NULL != (fp = popen( - "logcat -b radio -b events -b system -b main -g 2>/dev/null", + "logcat -v brief -b radio -b events -b system -b main -g 2>/dev/null", "r"))); char buffer[5120]; @@ -364,7 +364,7 @@ TEST(logcat, blocking) { ASSERT_TRUE(NULL != (fp = popen( "( trap exit HUP QUIT INT PIPE KILL ; sleep 6; echo DONE )&" - " logcat -b events 2>&1", + " logcat -v brief -b events 2>&1", "r"))); char buffer[5120]; @@ -433,7 +433,7 @@ TEST(logcat, blocking_tail) { ASSERT_TRUE(NULL != (fp = popen( "( trap exit HUP QUIT INT PIPE KILL ; sleep 6; echo DONE )&" - " logcat -b events -T 5 2>&1", + " logcat -v brief -b events -T 5 2>&1", "r"))); char buffer[5120]; @@ -503,10 +503,14 @@ TEST(logcat, logrotate) { int count = 0; while (fgets(buffer, sizeof(buffer), fp)) { - static const char match[] = "4 log.txt"; + static const char match_1[] = "4 log.txt"; + static const char match_2[] = "8 log.txt"; + static const char match_3[] = "16 log.txt"; static const char total[] = "total "; - if (!strncmp(buffer, match, sizeof(match) - 1)) { + if (!strncmp(buffer, match_1, sizeof(match_1) - 1) + || !strncmp(buffer, match_2, sizeof(match_2) - 1) + || !strncmp(buffer, match_3, sizeof(match_3) - 1)) { ++count; } else if (strncmp(buffer, total, sizeof(total) - 1)) { fprintf(stderr, "WARNING: Parse error: %s", buffer); @@ -542,7 +546,7 @@ TEST(logcat, blocking_clear) { ASSERT_TRUE(NULL != (fp = popen( "( trap exit HUP QUIT INT PIPE KILL ; sleep 6; echo DONE )&" " logcat -b events -c 2>&1 ;" - " logcat -b events 2>&1", + " logcat -v brief -b events 2>&1", "r"))); char buffer[5120];