summaryrefslogtreecommitdiffstats
path: root/logcat/tests/logcat_test.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2016-04-29 11:28:03 -0700
committerMark Salyzyn <salyzyn@google.com>2016-04-29 11:33:26 -0700
commite7e5f1b6aede24e47e49d3a668f5d386814ab02a (patch)
treede6a6f7b10c9655e3e4fbec1dc57248dfa350db7 /logcat/tests/logcat_test.cpp
parent17f3b1bad76925c327a6572f6058b32651499d3c (diff)
downloadcore-e7e5f1b6aede24e47e49d3a668f5d386814ab02a.tar.gz
core-e7e5f1b6aede24e47e49d3a668f5d386814ab02a.tar.bz2
core-e7e5f1b6aede24e47e49d3a668f5d386814ab02a.zip
logcat: confirm -g result after -c
Bug: 28451229 Change-Id: I43a1721ae991cc1316335ba4b3b868b904926d42
Diffstat (limited to 'logcat/tests/logcat_test.cpp')
-rw-r--r--logcat/tests/logcat_test.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp
index 997e68213..920d50447 100644
--- a/logcat/tests/logcat_test.cpp
+++ b/logcat/tests/logcat_test.cpp
@@ -810,12 +810,14 @@ 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 -g 2>&1 ;"
" logcat -v brief -b events 2>&1",
"r")));
char buffer[BIG_BUFFER];
int count = 0;
+ int minus_g = 0;
int signals = 0;
@@ -833,6 +835,50 @@ TEST(logcat, blocking_clear) {
break;
}
+ int size, consumed, max, payload;
+ char size_mult[3], consumed_mult[3];
+ size = consumed = max = payload = 0;
+ if (6 == sscanf(buffer, "events: ring buffer is %d%2s (%d%2s consumed),"
+ " max entry is %db, max payload is %db",
+ &size, size_mult, &consumed, consumed_mult,
+ &max, &payload)) {
+ long full_size = size, full_consumed = consumed;
+
+ switch(size_mult[0]) {
+ case 'G':
+ full_size *= 1024;
+ /* FALLTHRU */
+ case 'M':
+ full_size *= 1024;
+ /* FALLTHRU */
+ case 'K':
+ full_size *= 1024;
+ /* FALLTHRU */
+ case 'b':
+ break;
+ }
+ switch(consumed_mult[0]) {
+ case 'G':
+ full_consumed *= 1024;
+ /* FALLTHRU */
+ case 'M':
+ full_consumed *= 1024;
+ /* FALLTHRU */
+ case 'K':
+ full_consumed *= 1024;
+ /* FALLTHRU */
+ case 'b':
+ break;
+ }
+ EXPECT_GT(full_size, full_consumed);
+ EXPECT_GT(full_size, max);
+ EXPECT_GT(max, payload);
+ EXPECT_GT(max, full_consumed);
+
+ ++minus_g;
+ continue;
+ }
+
++count;
int p;
@@ -861,6 +907,7 @@ TEST(logcat, blocking_clear) {
pclose(fp);
EXPECT_LE(1, count);
+ EXPECT_EQ(1, minus_g);
EXPECT_EQ(1, signals);
}