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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 const char* line_1 = "aaa,\"bbb\"\n"; | 50 const char* line_1 = "aaa,\"bbb\"\n"; |
51 const int line_1_len = strlen(line_1); | 51 const int line_1_len = strlen(line_1); |
52 // Still smaller than log message length. | 52 // Still smaller than log message length. |
53 CHECK_EQ(0, Logger::GetLogLines(0, log_lines, line_1_len - 1)); | 53 CHECK_EQ(0, Logger::GetLogLines(0, log_lines, line_1_len - 1)); |
54 // The exact size. | 54 // The exact size. |
55 CHECK_EQ(line_1_len, Logger::GetLogLines(0, log_lines, line_1_len)); | 55 CHECK_EQ(line_1_len, Logger::GetLogLines(0, log_lines, line_1_len)); |
56 CHECK_EQ(line_1, log_lines); | 56 CHECK_EQ(line_1, log_lines); |
57 memset(log_lines, 0, sizeof(log_lines)); | 57 memset(log_lines, 0, sizeof(log_lines)); |
58 // A bit more than the first line length. | 58 // A bit more than the first line length. |
59 CHECK_EQ(line_1_len, Logger::GetLogLines(0, log_lines, line_1_len + 3)); | 59 CHECK_EQ(line_1_len, Logger::GetLogLines(0, log_lines, line_1_len + 3)); |
| 60 log_lines[line_1_len] = '\0'; |
60 CHECK_EQ(line_1, log_lines); | 61 CHECK_EQ(line_1, log_lines); |
61 memset(log_lines, 0, sizeof(log_lines)); | 62 memset(log_lines, 0, sizeof(log_lines)); |
62 const char* line_2 = "cccc,\"dddd\"\n"; | 63 const char* line_2 = "cccc,\"dddd\"\n"; |
63 const int line_2_len = strlen(line_2); | 64 const int line_2_len = strlen(line_2); |
64 // Now start with line_2 beginning. | 65 // Now start with line_2 beginning. |
65 CHECK_EQ(0, Logger::GetLogLines(line_1_len, log_lines, 0)); | 66 CHECK_EQ(0, Logger::GetLogLines(line_1_len, log_lines, 0)); |
66 CHECK_EQ(0, Logger::GetLogLines(line_1_len, log_lines, 3)); | 67 CHECK_EQ(0, Logger::GetLogLines(line_1_len, log_lines, 3)); |
67 CHECK_EQ(0, Logger::GetLogLines(line_1_len, log_lines, line_2_len - 1)); | 68 CHECK_EQ(0, Logger::GetLogLines(line_1_len, log_lines, line_2_len - 1)); |
68 CHECK_EQ(line_2_len, Logger::GetLogLines(line_1_len, log_lines, line_2_len)); | 69 CHECK_EQ(line_2_len, Logger::GetLogLines(line_1_len, log_lines, line_2_len)); |
69 CHECK_EQ(line_2, log_lines); | 70 CHECK_EQ(line_2, log_lines); |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // Make sure that all log data is written prior crash due to CHECK failure. | 699 // Make sure that all log data is written prior crash due to CHECK failure. |
699 fflush(stdout); | 700 fflush(stdout); |
700 CHECK(results_equal); | 701 CHECK(results_equal); |
701 | 702 |
702 env->Exit(); | 703 env->Exit(); |
703 Logger::TearDown(); | 704 Logger::TearDown(); |
704 i::FLAG_always_compact = saved_always_compact; | 705 i::FLAG_always_compact = saved_always_compact; |
705 } | 706 } |
706 | 707 |
707 #endif // ENABLE_LOGGING_AND_PROFILING | 708 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |