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 __linux__ | 5 #ifdef __linux__ |
6 #include <math.h> | 6 #include <math.h> |
7 #include <pthread.h> | 7 #include <pthread.h> |
8 #include <signal.h> | 8 #include <signal.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #endif // __linux__ | 10 #endif // __linux__ |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); | 390 i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true)); |
391 CHECK(exists); | 391 CHECK(exists); |
392 | 392 |
393 i::EmbeddedVector<char, 100> ref_data; | 393 i::EmbeddedVector<char, 100> ref_data; |
394 i::OS::SNPrintF(ref_data, | 394 i::OS::SNPrintF(ref_data, |
395 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"method1\"\0", | 395 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"method1\"\0", |
396 ObjMethod1); | 396 ObjMethod1); |
397 | 397 |
398 CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length())); | 398 CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length())); |
399 | 399 |
400 obj.Dispose(); | 400 obj.Dispose(v8::Isolate::GetCurrent()); |
401 } | 401 } |
402 | 402 |
403 | 403 |
404 static v8::Handle<v8::Value> Prop1Getter(v8::Local<v8::String> property, | 404 static v8::Handle<v8::Value> Prop1Getter(v8::Local<v8::String> property, |
405 const v8::AccessorInfo& info) { | 405 const v8::AccessorInfo& info) { |
406 return v8::Handle<v8::Value>(); | 406 return v8::Handle<v8::Value>(); |
407 } | 407 } |
408 | 408 |
409 static void Prop1Setter(v8::Local<v8::String> property, | 409 static void Prop1Setter(v8::Local<v8::String> property, |
410 v8::Local<v8::Value> value, | 410 v8::Local<v8::Value> value, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 CHECK_NE(NULL, | 447 CHECK_NE(NULL, |
448 StrNStr(log.start(), prop1_setter_record.start(), log.length())); | 448 StrNStr(log.start(), prop1_setter_record.start(), log.length())); |
449 | 449 |
450 EmbeddedVector<char, 100> prop2_getter_record; | 450 EmbeddedVector<char, 100> prop2_getter_record; |
451 i::OS::SNPrintF(prop2_getter_record, | 451 i::OS::SNPrintF(prop2_getter_record, |
452 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"get prop2\"", | 452 "code-creation,Callback,-3,0x%" V8PRIxPTR ",1,\"get prop2\"", |
453 Prop2Getter); | 453 Prop2Getter); |
454 CHECK_NE(NULL, | 454 CHECK_NE(NULL, |
455 StrNStr(log.start(), prop2_getter_record.start(), log.length())); | 455 StrNStr(log.start(), prop2_getter_record.start(), log.length())); |
456 | 456 |
457 obj.Dispose(); | 457 obj.Dispose(v8::Isolate::GetCurrent()); |
458 } | 458 } |
459 | 459 |
460 | 460 |
461 TEST(IsLoggingPreserved) { | 461 TEST(IsLoggingPreserved) { |
462 ScopedLoggerInitializer initialize_logger(false); | 462 ScopedLoggerInitializer initialize_logger(false); |
463 | 463 |
464 CHECK(LOGGER->is_logging()); | 464 CHECK(LOGGER->is_logging()); |
465 LOGGER->ResumeProfiler(); | 465 LOGGER->ResumeProfiler(); |
466 CHECK(LOGGER->is_logging()); | 466 CHECK(LOGGER->is_logging()); |
467 LOGGER->PauseProfiler(); | 467 LOGGER->PauseProfiler(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 v8::Local<v8::String> s = result->ToString(); | 529 v8::Local<v8::String> s = result->ToString(); |
530 i::ScopedVector<char> data(s->Length() + 1); | 530 i::ScopedVector<char> data(s->Length() + 1); |
531 CHECK_NE(NULL, data.start()); | 531 CHECK_NE(NULL, data.start()); |
532 s->WriteAscii(data.start()); | 532 s->WriteAscii(data.start()); |
533 printf("%s\n", data.start()); | 533 printf("%s\n", data.start()); |
534 // Make sure that our output is written prior crash due to CHECK failure. | 534 // Make sure that our output is written prior crash due to CHECK failure. |
535 fflush(stdout); | 535 fflush(stdout); |
536 CHECK(false); | 536 CHECK(false); |
537 } | 537 } |
538 } | 538 } |
OLD | NEW |