Commit 508a5b7d by Jamie Madill

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: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 1e928bc0
//
// 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 "ANGLETest.h"
#include "EGLWindow.h" #include "EGLWindow.h"
#include "OSWindow.h" #include "OSWindow.h"
#include "system_utils.h"
ANGLETest::ANGLETest() ANGLETest::ANGLETest()
: mEGLWindow(nullptr), : mEGLWindow(nullptr),
...@@ -47,10 +57,16 @@ void ANGLETest::SetUp() ...@@ -47,10 +57,16 @@ void ANGLETest::SetUp()
// taking OpenGL traces can guess the size of the default framebuffer and show it // taking OpenGL traces can guess the size of the default framebuffer and show it
// in their UIs // in their UIs
glViewport(0, 0, mWidth, mHeight); 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() 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(); swapBuffers();
mOSWindow->messageLoop(); mOSWindow->messageLoop();
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// ANGLETest:
// Implementation of common ANGLE testing fixture.
//
#ifndef ANGLE_TESTS_ANGLE_TEST_H_ #ifndef ANGLE_TESTS_ANGLE_TEST_H_
#define ANGLE_TESTS_ANGLE_TEST_H_ #define ANGLE_TESTS_ANGLE_TEST_H_
......
...@@ -41,4 +41,9 @@ void SetLowPriorityProcess() ...@@ -41,4 +41,9 @@ void SetLowPriorityProcess()
setpriority(PRIO_PROCESS, getpid(), 10); setpriority(PRIO_PROCESS, getpid(), 10);
} }
void WriteDebugMessage(const char *format, ...)
{
// TODO(jmadill): Implement this
}
} // namespace angle } // namespace angle
...@@ -22,6 +22,9 @@ void Sleep(unsigned int milliseconds); ...@@ -22,6 +22,9 @@ void Sleep(unsigned int milliseconds);
void SetLowPriorityProcess(); void SetLowPriorityProcess();
// Write a debug message, either to a standard output or Debug window.
void WriteDebugMessage(const char *format, ...);
} // namespace angle } // namespace angle
#endif // SAMPLE_UTIL_PATH_UTILS_H #endif // SAMPLE_UTIL_PATH_UTILS_H
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
#include "system_utils.h" #include "system_utils.h"
#include <stdarg.h>
#include <windows.h> #include <windows.h>
#include <array> #include <array>
#include <vector>
namespace angle namespace angle
{ {
...@@ -34,4 +36,19 @@ void Sleep(unsigned int milliseconds) ...@@ -34,4 +36,19 @@ void Sleep(unsigned int milliseconds)
::Sleep(static_cast<DWORD>(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 } // namespace angle
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment