OLD | NEW |
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 #include "cctest.h" | 10 #include "cctest.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100)); | 122 CHECK_EQ(0, Logger::GetLogLines(100, NULL, 100)); |
123 Logger::TearDown(); | 123 Logger::TearDown(); |
124 } | 124 } |
125 | 125 |
126 | 126 |
127 static void CompileAndRunScript(const char *src) { | 127 static void CompileAndRunScript(const char *src) { |
128 v8::Script::Compile(v8::String::New(src))->Run(); | 128 v8::Script::Compile(v8::String::New(src))->Run(); |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 // Exclude the following test from ARM because profiling can | |
133 // malfunction there. | |
134 // TODO(mikhail.naganov): Fix it. | |
135 #ifndef V8_TARGET_ARCH_ARM | |
136 | |
137 namespace v8 { | 132 namespace v8 { |
138 namespace internal { | 133 namespace internal { |
139 | 134 |
140 class LoggerTestHelper : public AllStatic { | 135 class LoggerTestHelper : public AllStatic { |
141 public: | 136 public: |
142 static bool IsSamplerActive() { return Logger::IsProfilerSamplerActive(); } | 137 static bool IsSamplerActive() { return Logger::IsProfilerSamplerActive(); } |
143 }; | 138 }; |
144 | 139 |
145 } // namespace v8::internal | 140 } // namespace v8::internal |
146 } // namespace v8 | 141 } // namespace v8 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // Check that profiling can be resumed again. | 231 // Check that profiling can be resumed again. |
237 CheckThatProfilerWorks(log_pos); | 232 CheckThatProfilerWorks(log_pos); |
238 | 233 |
239 env->Exit(); | 234 env->Exit(); |
240 Logger::TearDown(); | 235 Logger::TearDown(); |
241 i::FLAG_prof_lazy = saved_prof_lazy; | 236 i::FLAG_prof_lazy = saved_prof_lazy; |
242 i::FLAG_prof = saved_prof; | 237 i::FLAG_prof = saved_prof; |
243 i::FLAG_prof_auto = saved_prof_auto; | 238 i::FLAG_prof_auto = saved_prof_auto; |
244 } | 239 } |
245 | 240 |
246 #endif // V8_TARGET_ARCH_ARM | |
247 | |
248 | 241 |
249 static inline bool IsStringEqualTo(const char* r, const char* s) { | 242 static inline bool IsStringEqualTo(const char* r, const char* s) { |
250 return strncmp(r, s, strlen(r)) == 0; | 243 return strncmp(r, s, strlen(r)) == 0; |
251 } | 244 } |
252 | 245 |
253 | 246 |
254 static bool Consume(const char* str, char** buf) { | 247 static bool Consume(const char* str, char** buf) { |
255 if (IsStringEqualTo(str, *buf)) { | 248 if (IsStringEqualTo(str, *buf)) { |
256 *buf += strlen(str); | 249 *buf += strlen(str); |
257 return true; | 250 return true; |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 // Make sure that all log data is written prior crash due to CHECK failure. | 698 // Make sure that all log data is written prior crash due to CHECK failure. |
706 fflush(stdout); | 699 fflush(stdout); |
707 CHECK(results_equal); | 700 CHECK(results_equal); |
708 | 701 |
709 env->Exit(); | 702 env->Exit(); |
710 Logger::TearDown(); | 703 Logger::TearDown(); |
711 i::FLAG_always_compact = saved_always_compact; | 704 i::FLAG_always_compact = saved_always_compact; |
712 } | 705 } |
713 | 706 |
714 #endif // ENABLE_LOGGING_AND_PROFILING | 707 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |