Windows: Write test name in debug log.

This helps isolate particular debug log messages to specific tests.

BUG=angleproject:667

Change-Id: I6be37d50cc41a13abbceb395e6e9b603bd44c7bd
Reviewed-on: https://chromium-review.googlesource.com/316611
Tryjob-Request: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2015-12-08 11:26:14 -05:00
Родитель 1e928bc0cc
Коммит 508a5b7d7d
5 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -1,6 +1,16 @@
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ANGLETest:
// Implementation of common ANGLE testing fixture.
//
#include "ANGLETest.h"
#include "EGLWindow.h"
#include "OSWindow.h"
#include "system_utils.h"
ANGLETest::ANGLETest()
: mEGLWindow(nullptr),
@ -47,10 +57,16 @@ void ANGLETest::SetUp()
// taking OpenGL traces can guess the size of the default framebuffer and show it
// in their UIs
glViewport(0, 0, mWidth, mHeight);
const auto &info = testing::UnitTest::GetInstance()->current_test_info();
angle::WriteDebugMessage("Entering %s.%s\n", info->test_case_name(), info->name());
}
void ANGLETest::TearDown()
{
const auto &info = testing::UnitTest::GetInstance()->current_test_info();
angle::WriteDebugMessage("Exiting %s.%s\n", info->test_case_name(), info->name());
swapBuffers();
mOSWindow->messageLoop();

Просмотреть файл

@ -3,6 +3,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ANGLETest:
// Implementation of common ANGLE testing fixture.
//
#ifndef ANGLE_TESTS_ANGLE_TEST_H_
#define ANGLE_TESTS_ANGLE_TEST_H_

Просмотреть файл

@ -41,4 +41,9 @@ void SetLowPriorityProcess()
setpriority(PRIO_PROCESS, getpid(), 10);
}
void WriteDebugMessage(const char *format, ...)
{
// TODO(jmadill): Implement this
}
} // namespace angle

Просмотреть файл

@ -22,6 +22,9 @@ void Sleep(unsigned int milliseconds);
void SetLowPriorityProcess();
// Write a debug message, either to a standard output or Debug window.
void WriteDebugMessage(const char *format, ...);
} // namespace angle
#endif // SAMPLE_UTIL_PATH_UTILS_H

Просмотреть файл

@ -8,8 +8,10 @@
#include "system_utils.h"
#include <stdarg.h>
#include <windows.h>
#include <array>
#include <vector>
namespace angle
{
@ -34,4 +36,19 @@ void Sleep(unsigned int milliseconds)
::Sleep(static_cast<DWORD>(milliseconds));
}
void WriteDebugMessage(const char *format, ...)
{
va_list args;
va_start(args, format);
int size = vsnprintf(nullptr, 0, format, args);
va_end(args);
std::vector<char> buffer(size + 2);
va_start(args, format);
vsnprintf(buffer.data(), size + 1, format, args);
va_end(args);
OutputDebugStringA(buffer.data());
}
} // namespace angle