Commit 57cdc69c by Jamie Madill

Revert "dEQP: Extend GoogleTest support."

Causing runhooks failures: gyp: Undefined variable deqp_path in C:\b\build\slave\GPU_Win_Builder\build\src\third_party\angle\src\tests\tests.gyp BUG=angleproject:998 BUG=500736 This reverts commit 8edd75d1. Change-Id: I8cd83bb5871dea81abea61554b182825145298e6 Reviewed-on: https://chromium-review.googlesource.com/281208Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent d0071dd9
......@@ -6,10 +6,7 @@
'includes': [ 'common_defines.gypi', ],
'variables':
{
'angle_path': '<(DEPTH)',
'deqp_path': '<(angle_path)/src/tests/third_party/deqp',
'libpng_path': '<(angle_path)/src/tests/third_party/libpng',
'zlib_path': '<(angle_path)/src/tests/third_party/zlib',
'angle_path%': '<(DEPTH)',
'angle_build_winrt%': '0',
'angle_build_winphone%': '0',
'angle_build_winrt_app_type_revision%': '8.1',
......
......@@ -63,8 +63,6 @@ bool DebugAnnotationsActive();
#define ANGLE_TRACE_ENABLED
#endif
#define ANGLE_EMPTY_STATEMENT for (;;) break
// A macro to output a trace of a function call and its arguments to the debugging log
#if defined(ANGLE_TRACE_ENABLED)
#define TRACE(message, ...) gl::trace(true, gl::MESSAGE_TRACE, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
......@@ -103,11 +101,11 @@ bool DebugAnnotationsActive();
// A macro asserting a condition and outputting failures to the debug log
#if !defined(NDEBUG)
#define ASSERT(expression) { \
#define ASSERT(expression) do { \
if(!(expression)) \
ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
assert(expression); \
} ANGLE_EMPTY_STATEMENT
} while(0)
#define UNUSED_ASSERTION_VARIABLE(variable)
#else
#define ASSERT(expression) (void(0))
......@@ -133,20 +131,20 @@ bool DebugAnnotationsActive();
#endif
#if !defined(NDEBUG)
#define UNIMPLEMENTED() { \
#define UNIMPLEMENTED() do { \
FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(NOASSERT_UNIMPLEMENTED); \
} ANGLE_EMPTY_STATEMENT
} while(0)
#else
#define UNIMPLEMENTED() FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
// A macro for code which is not expected to be reached under valid assumptions
#if !defined(NDEBUG)
#define UNREACHABLE() { \
#define UNREACHABLE() do { \
ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__); \
assert(false); \
} ANGLE_EMPTY_STATEMENT
} while(0)
#else
#define UNREACHABLE() ERR("\t! Unreachable reached: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
......
......@@ -7,16 +7,17 @@
// dEQP and GoogleTest integration logic. Calls through to the random
// order executor.
#include <gtest/gtest.h>
#include <stdint.h>
#include <zlib.h>
#include <gtest/gtest.h>
#include <algorithm>
#include <fstream>
#include "angle_deqp_libtester.h"
#include "common/angleutils.h"
#include "common/debug.h"
#include "gpu_test_expectations_parser.h"
#include "system_utils.h"
namespace
{
......@@ -24,7 +25,7 @@ namespace
class dEQPCaseList
{
public:
dEQPCaseList(const std::string &caseListPath, const std::string &testExpectationsPath);
dEQPCaseList(const char *caseListPath, const char *testExpectationsPath);
struct CaseInfo
{
......@@ -72,10 +73,8 @@ dEQPCaseList *dEQPCaseList::GetInstance()
{
if (mInstance == nullptr)
{
std::string exeDir = angle::GetExecutableDirectory();
std::string caseListPath = exeDir + "/deqp_support/dEQP-GLES2-cases.txt.gz";
std::string testExpectationsPath = exeDir + "/deqp_support/deqp_test_expectations.txt";
mInstance = new dEQPCaseList(caseListPath, testExpectationsPath);
mInstance = new dEQPCaseList("deqp_support/dEQP-GLES2-cases.txt.gz",
"deqp_support/deqp_test_expectations.txt");
}
return mInstance;
}
......@@ -87,9 +86,9 @@ void dEQPCaseList::FreeInstance()
SafeDelete(mInstance);
}
dEQPCaseList::dEQPCaseList(const std::string &caseListPath, const std::string &testExpectationsPath)
dEQPCaseList::dEQPCaseList(const char *caseListPath, const char *testExpectationsPath)
{
if (!mTestExpectationsParser.LoadTestExpectationsFromFile(testExpectationsPath))
if (!mTestExpectationsParser.LoadTestExpectationsFromFile(std::string(testExpectationsPath)))
{
std::cerr << "Failed to load test expectations." << std::endl;
for (const auto &message : mTestExpectationsParser.GetErrorMessages())
......@@ -108,7 +107,7 @@ dEQPCaseList::dEQPCaseList(const std::string &caseListPath, const std::string &t
std::stringstream caseListStream;
std::vector<char> buf(1024 * 1024 * 16);
gzFile *fi = static_cast<gzFile *>(gzopen(caseListPath.c_str(), "rb"));
gzFile *fi = static_cast<gzFile *>(gzopen(caseListPath, "rb"));
if (fi == nullptr)
{
......
......@@ -12,6 +12,7 @@
int main(int argc, char **argv)
{
deqp_libtester_init_platform(argc, argv, ANGLE_DEQP_DIR "/data");
testing::InitGoogleTest(&argc, argv);
int rt = RUN_ALL_TESTS();
deqp_libtester_shutdown_platform();
......
......@@ -28,6 +28,7 @@
// Exported to the tester app.
ANGLE_LIBTESTER_EXPORT int deqp_libtester_main(int argc, const char *argv[]);
ANGLE_LIBTESTER_EXPORT void deqp_libtester_init_platform(int argc, char **argv, const char *deqpDataDir);
ANGLE_LIBTESTER_EXPORT void deqp_libtester_shutdown_platform();
ANGLE_LIBTESTER_EXPORT bool deqp_libtester_run(const char *caseName);
......
......@@ -9,7 +9,6 @@
#include <iostream>
#include "angle_deqp_libtester.h"
#include "common/angleutils.h"
#include "deMath.h"
#include "deUniquePtr.hpp"
#include "tcuApp.hpp"
......@@ -20,10 +19,6 @@
#include "tcuResource.hpp"
#include "tcuTestLog.hpp"
#if (DE_OS == DE_OS_WIN32)
#include <Windows.h>
#endif
// Located in tcuMain.cc in dEQP's sources.
int main(int argc, const char* argv[]);
tcu::Platform *createPlatform();
......@@ -39,48 +34,15 @@ tcu::TestContext *g_testCtx = nullptr;
tcu::TestPackageRoot *g_root = nullptr;
tcu::RandomOrderExecutor *g_executor = nullptr;
const char *g_dEQPDataSearchDirs[] =
{
"data",
"third_party/deqp/data",
"../third_party/deqp/src/data",
"deqp_support/data",
"third_party/deqp/src/data",
"../../third_party/deqp/src/data"
};
// TODO(jmadill): upstream to dEQP?
#if (DE_OS == DE_OS_WIN32)
deBool deIsDir(const char *filename)
{
DWORD attribs = GetFileAttributesA(filename);
return (attribs != INVALID_FILE_ATTRIBUTES) &&
((attribs & FILE_ATTRIBUTE_DIRECTORY) > 0);
}
#else
#error TODO(jmadill): support other platforms
//deBool deIsDir(const char *filename)
//{
// struct stat st;
// int result = stat(filename, &st);
// return result == 0 && ((st.st_mode & S_IFDIR) == S_IFDIR);
//}
#endif
const char *FindDataDir()
// Exported to the tester app.
ANGLE_LIBTESTER_EXPORT int deqp_libtester_main(int argc, const char *argv[])
{
for (size_t dirIndex = 0; dirIndex < ArraySize(g_dEQPDataSearchDirs); ++dirIndex)
{
if (deIsDir(g_dEQPDataSearchDirs[dirIndex]))
{
return g_dEQPDataSearchDirs[dirIndex];
}
}
return nullptr;
return main(argc, argv);
}
bool InitPlatform()
ANGLE_LIBTESTER_EXPORT void deqp_libtester_init_platform(int argc, char **argv, const char *deqpDataDir)
{
try
{
......@@ -92,21 +54,11 @@ bool InitPlatform()
if (!deSetRoundingMode(DE_ROUNDINGMODE_TO_NEAREST))
{
std::cout << "Failed to set floating point rounding mode." << std::endl;
return false;
}
const char *deqpDataDir = FindDataDir();
if (deqpDataDir == nullptr)
{
std::cout << "Failed to find dEQP data directory." << std::endl;
return false;
throw std::runtime_error("Failed to set floating point rounding mode.");
}
// TODO(jmadill): filter arguments
const char *emptyString = "";
g_cmdLine = new tcu::CommandLine(1, &emptyString);
g_cmdLine = new tcu::CommandLine(1, argv);
g_archive = new tcu::DirArchive(deqpDataDir);
g_log = new tcu::TestLog(g_cmdLine->getLogFileName(), g_cmdLine->getLogFlags());
g_testCtx = new tcu::TestContext(*g_platform, *g_archive, *g_log, *g_cmdLine, DE_NULL);
......@@ -116,18 +68,7 @@ bool InitPlatform()
catch (const std::exception& e)
{
tcu::die("%s", e.what());
return false;
}
return true;
}
} // anonymous namespace
// Exported to the tester app.
ANGLE_LIBTESTER_EXPORT int deqp_libtester_main(int argc, const char *argv[])
{
return main(argc, argv);
}
ANGLE_LIBTESTER_EXPORT void deqp_libtester_shutdown_platform()
......@@ -143,9 +84,9 @@ ANGLE_LIBTESTER_EXPORT void deqp_libtester_shutdown_platform()
ANGLE_LIBTESTER_EXPORT bool deqp_libtester_run(const char *caseName)
{
if (g_platform == nullptr && !InitPlatform())
if (!g_platform)
{
tcu::die("Failed to initialize platform.");
return false;
}
try
......
......@@ -19,7 +19,7 @@
#define DCHECK_EQ(A,B) ASSERT((A) == (B))
#define DCHECK_NE(A,B) ASSERT((A) != (B))
#define DCHECK(X) ASSERT(X)
#define DCHECK ASSERT
#define LOG(X) std::cerr
#define StringPrintf FormatString
......
......@@ -51,10 +51,10 @@ CollectInfoResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
*device_id = 0;
// Taken from http://developer.nvidia.com/object/device_ids.html
DISPLAY_DEVICEA dd;
dd.cb = sizeof(DISPLAY_DEVICEA);
DISPLAY_DEVICE dd;
dd.cb = sizeof(DISPLAY_DEVICE);
std::string id;
for (int i = 0; EnumDisplayDevicesA(NULL, i, &dd, 0); ++i) {
for (int i = 0; EnumDisplayDevices(NULL, i, &dd, 0); ++i) {
if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
id = dd.DeviceID;
break;
......
......@@ -182,10 +182,10 @@ bool NamesMatching(const std::string& ref, const std::string& test_name) {
GPUTestExpectationsParser::GPUTestExpectationsParser() {
// Some sanity check.
static_assert(static_cast<unsigned int>(kNumberOfExactMatchTokens) ==
sizeof(kTokenData) / sizeof(kTokenData[0]), "sanity check");
static_assert(static_cast<unsigned int>(kNumberOfErrors) ==
sizeof(kErrorMessage) / sizeof(kErrorMessage[0]), "sanity check");
DCHECK_EQ(static_cast<unsigned int>(kNumberOfExactMatchTokens),
sizeof(kTokenData) / sizeof(kTokenData[0]));
DCHECK_EQ(static_cast<unsigned int>(kNumberOfErrors),
sizeof(kErrorMessage) / sizeof(kErrorMessage[0]));
}
GPUTestExpectationsParser::~GPUTestExpectationsParser() {
......@@ -391,7 +391,7 @@ bool GPUTestExpectationsParser::ParseLine(
stage++;
break;
default:
UNREACHABLE();
DCHECK(false);
break;
}
}
......@@ -467,7 +467,7 @@ bool GPUTestExpectationsParser::UpdateTestConfig(
config->build_type() | kTokenData[token].flag);
break;
default:
UNREACHABLE();
DCHECK(false);
break;
}
return true;
......
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