Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: test/cctest/test-log.cc

Issue 115123: Return immediately from GetLogLines if logging to memory isn't enabled. (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/log.cc ('K') | « src/log.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of logging functions from log.h 3 // Tests of logging functions from log.h
4 4
5 #ifdef ENABLE_LOGGING_AND_PROFILING 5 #ifdef ENABLE_LOGGING_AND_PROFILING
6 6
7 #include "v8.h" 7 #include "v8.h"
8 8
9 #include "log.h" 9 #include "log.h"
10 10
11 #include "cctest.h" 11 #include "cctest.h"
12 12
13 using v8::internal::Logger; 13 using v8::internal::Logger;
14 14
15 static void SetUp() { 15 static void SetUp() {
16 // Log to memory buffer. 16 // Log to memory buffer.
17 v8::internal::FLAG_logfile = "*"; 17 v8::internal::FLAG_logfile = "*";
18 v8::internal::FLAG_log = true; 18 v8::internal::FLAG_log = true;
19 Logger::Setup(); 19 Logger::Setup();
20 } 20 }
21 21
22 static void TearDown() { 22 static void TearDown() {
23 Logger::TearDown(); 23 Logger::TearDown();
24 } 24 }
25 25
26
26 TEST(EmptyLog) { 27 TEST(EmptyLog) {
27 SetUp(); 28 SetUp();
28 CHECK_EQ(0, Logger::GetLogLines(0, NULL, 0)); 29 CHECK_EQ(0, Logger::GetLogLines(0, NULL, 0));
29 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 0)); 30 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 0));
30 CHECK_EQ(0, Logger::GetLogLines(0, NULL, 100)); 31 CHECK_EQ(0, Logger::GetLogLines(0, NULL, 100));
31 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100)); 32 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100));
32 TearDown(); 33 TearDown();
33 } 34 }
34 35
35 36
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 CHECK_EQ(0, Logger::GetLogLines(all_lines_len, NULL, 100)); 93 CHECK_EQ(0, Logger::GetLogLines(all_lines_len, NULL, 100));
93 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 1, NULL, 1)); 94 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 1, NULL, 1));
94 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 1, NULL, 100)); 95 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 1, NULL, 100));
95 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 100, NULL, 1)); 96 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 100, NULL, 1));
96 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 100, NULL, 100)); 97 CHECK_EQ(0, Logger::GetLogLines(all_lines_len + 100, NULL, 100));
97 CHECK_EQ(0, Logger::GetLogLines(10 * 1024 * 1024, NULL, 1)); 98 CHECK_EQ(0, Logger::GetLogLines(10 * 1024 * 1024, NULL, 1));
98 CHECK_EQ(0, Logger::GetLogLines(10 * 1024 * 1024, NULL, 100)); 99 CHECK_EQ(0, Logger::GetLogLines(10 * 1024 * 1024, NULL, 100));
99 TearDown(); 100 TearDown();
100 } 101 }
101 102
103
104 TEST(MemoryLoggingTurnedOff) {
105 // Log to stdout
106 v8::internal::FLAG_logfile = "-";
107 v8::internal::FLAG_log = true;
108 Logger::Setup();
109 CHECK_EQ(0, Logger::GetLogLines(0, NULL, 0));
110 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 0));
111 CHECK_EQ(0, Logger::GetLogLines(0, NULL, 100));
112 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100));
113 Logger::TearDown();
114 }
115
116
102 #endif // ENABLE_LOGGING_AND_PROFILING 117 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« src/log.cc ('K') | « src/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698