Skip to content

Commit

Permalink
deps: add profiler log version test
Browse files Browse the repository at this point in the history
431eb17 had integrated the addition of
V8's version in V8's profiler log files, without backporting the test
that was included in the original change
(https://codereview.chromium.org/806143002). This commit backports this
test.

The newly added test was tested with
nodejs#9208.
  • Loading branch information
Julien Gilli committed Feb 16, 2015
1 parent 1f76c61 commit 54d7188
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion deps/v8/src/log-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void Log::Initialize(const char* log_file_name) {

if (output_handle_ != NULL) {
Log::MessageBuilder msg(this);
msg.Append("v8-version,%d,%d,%d,%d,%d\n", Version::GetMajor(),
msg.Append("v8-version,%d,%d,%d,%d,%d", Version::GetMajor(),
Version::GetMinor(), Version::GetBuild(), Version::GetPatch(),
Version::IsCandidate());
msg.WriteToLogFile();
Expand Down
27 changes: 11 additions & 16 deletions deps/v8/test/cctest/test-log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -496,20 +496,15 @@ TEST(EquivalenceOfLoggingAndTraversal) {
}

TEST(LogVersion) {
v8::Isolate* isolate;
{
ScopedLoggerInitializer initialize_logger;
isolate = initialize_logger.isolate();
bool exists = false;
i::Vector<const char> log(
i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true));
CHECK(exists);
i::EmbeddedVector<char, 100> ref_data;
i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(),
i::Version::GetMinor(), i::Version::GetBuild(),
i::Version::GetPatch(), i::Version::IsCandidate());
CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length()));
log.Dispose();
}
isolate->Dispose();
ScopedLoggerInitializer initialize_logger;
bool exists = false;
i::Vector<const char> log(
i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true));
CHECK(exists);
i::EmbeddedVector<char, 100> ref_data;
i::SNPrintF(ref_data, "v8-version,%d,%d,%d,%d,%d", i::Version::GetMajor(),
i::Version::GetMinor(), i::Version::GetBuild(),
i::Version::GetPatch(), i::Version::IsCandidate());
CHECK_NE(NULL, StrNStr(log.start(), ref_data.start(), log.length()));
log.Dispose();
}

0 comments on commit 54d7188

Please sign in to comment.