Chromium Code Reviews| Index: gpu/khronos_glcts_support/khronos_glcts_test.cc |
| diff --git a/gpu/gles2_conform_support/gles2_conform_test.cc b/gpu/khronos_glcts_support/khronos_glcts_test.cc |
| similarity index 56% |
| copy from gpu/gles2_conform_support/gles2_conform_test.cc |
| copy to gpu/khronos_glcts_support/khronos_glcts_test.cc |
| index 9b714462626fd46e2cc35ed2c829f6b39000fe33..3cf16520ca69fce10467c69ef85246737ff46a61 100644 |
| --- a/gpu/gles2_conform_support/gles2_conform_test.cc |
| +++ b/gpu/khronos_glcts_support/khronos_glcts_test.cc |
| @@ -1,8 +1,8 @@ |
| -// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "gpu/gles2_conform_support/gles2_conform_test.h" |
| +#include "gpu/khronos_glcts_support/khronos_glcts_test.h" |
| #include <string> |
| @@ -12,9 +12,6 @@ |
| #include "base/file_util.h" |
| #include "base/files/file_path.h" |
| #include "base/logging.h" |
| -#if defined(OS_MACOSX) |
| -#include "base/mac/scoped_nsautorelease_pool.h" |
| -#endif |
| #include "base/path_service.h" |
| #include "base/process/launch.h" |
| #include "base/strings/string_util.h" |
| @@ -22,21 +19,23 @@ |
| #include "gpu/config/gpu_test_expectations_parser.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| -bool RunGLES2ConformTest(const char* path) { |
| +base::FilePath g_deqp_log_dir; |
| + |
| +bool RunKhronosGLCTSTest(const char* test_name) { |
| // Load test expectations, and return early if a test is marked as FAIL. |
| base::FilePath src_path; |
| PathService::Get(base::DIR_SOURCE_ROOT, &src_path); |
| base::FilePath test_expectations_path = |
| src_path.Append(FILE_PATH_LITERAL("gpu")). |
| - Append(FILE_PATH_LITERAL("gles2_conform_support")). |
| - Append(FILE_PATH_LITERAL("gles2_conform_test_expectations.txt")); |
| + Append(FILE_PATH_LITERAL("khronos_glcts_support")). |
| + Append(FILE_PATH_LITERAL("khronos_glcts_test_expectations.txt")); |
| if (!base::PathExists(test_expectations_path)) { |
| - LOG(ERROR) << "Fail to locate gles2_conform_test_expectations.txt"; |
| + LOG(ERROR) << "Fail to locate khronos_glcts_test_expectations.txt"; |
| return false; |
| } |
| gpu::GPUTestExpectationsParser test_expectations; |
| if (!test_expectations.LoadTestExpectations(test_expectations_path)) { |
| - LOG(ERROR) << "Fail to load gles2_conform_test_expectations.txt"; |
| + LOG(ERROR) << "Fail to load khronos_glcts_test_expectations.txt"; |
| return false; |
| } |
| gpu::GPUTestBotConfig bot_config; |
| @@ -48,32 +47,36 @@ bool RunGLES2ConformTest(const char* path) { |
| LOG(ERROR) << "Invalid bot configuration"; |
| return false; |
| } |
| - std::string path_string(path); |
| - std::string test_name; |
| - base::ReplaceChars(path_string, "\\/.", "_", &test_name); |
| + |
| + const ::testing::TestInfo* const test_info = |
| + ::testing::UnitTest::GetInstance()->current_test_info(); |
| int32 expectation = |
| - test_expectations.GetTestExpectation(test_name, bot_config); |
| + test_expectations.GetTestExpectation(test_info->name(), bot_config); |
| if (expectation != gpu::GPUTestExpectationsParser::kGpuTestPass) { |
| - LOG(WARNING) << "Test " << test_name << " is bypassed"; |
| + LOG(WARNING) << "Test " << test_info->name() << " is bypassed"; |
| return true; |
| } |
| base::FilePath test_path; |
| PathService::Get(base::DIR_EXE, &test_path); |
| + base::FilePath archive(test_path.Append(FILE_PATH_LITERAL( |
| + "khronos_glcts_data"))); |
| base::FilePath program(test_path.Append(FILE_PATH_LITERAL( |
| - "gles2_conform_test_windowless"))); |
| + "khronos_glcts_test_windowless"))); |
| + base::FilePath log(g_deqp_log_dir.Append(FILE_PATH_LITERAL( |
| + std::string(test_info->name()) + ".log"))); |
| - CommandLine* currentCmdLine = CommandLine::ForCurrentProcess(); |
| CommandLine cmdline(program); |
| - cmdline.AppendArguments(*currentCmdLine, false); |
| - cmdline.AppendSwitch(std::string("--")); |
| - cmdline.AppendArg(std::string("-run=") + path); |
| + cmdline.AppendSwitch("--deqp-log-filename=" + log.value()); |
| + cmdline.AppendSwitch("--deqp-archive-dir=" + archive.value()); |
|
Ken Russell (switch to Gerrit)
2014/09/11 23:06:00
Are you sure these are correct? See the switch fro
U. Artie Eoff
2014/09/11 23:57:12
Hmm... yes this could be problematic if the values
|
| + cmdline.AppendSwitch("--deqp-gl-config-id=-1"); |
| + cmdline.AppendSwitch(std::string("--deqp-case=") + test_name); |
|
U. Artie Eoff
2014/09/11 23:57:12
This --deqp-case concerns me, however, which is wh
|
| std::string output; |
| bool success = base::GetAppOutput(cmdline, &output); |
|
U. Artie Eoff
2014/09/11 23:57:12
...I assume this return value is true iif the comm
|
| if (success) { |
| - size_t success_index = output.find("Conformance PASSED all"); |
| - size_t failed_index = output.find("FAILED"); |
| + size_t success_index = output.find("Pass (Pass)"); |
| + size_t failed_index = output.find("Fail (Fail)"); |
| success = (success_index != std::string::npos) && |
| (failed_index == std::string::npos); |
|
U. Artie Eoff
2014/09/11 23:57:12
...and, if there is an early-out success (i.e. suc
|
| } |
| @@ -83,15 +86,18 @@ bool RunGLES2ConformTest(const char* path) { |
| return success; |
| } |
| -int main(int argc, char** argv) { |
| - base::AtExitManager exit_manager; |
| - CommandLine::Init(argc, argv); |
| -#if defined(OS_MACOSX) |
| - base::mac::ScopedNSAutoreleasePool pool; |
| -#endif |
| +int main(int argc, char *argv[]) { |
| + base::AtExitManager at_exit; |
| + |
| ::testing::InitGoogleTest(&argc, argv); |
| - return RUN_ALL_TESTS(); |
| -} |
| + if (argc == 2) { |
| + g_deqp_log_dir = base::FilePath(argv[1]); |
| + } |
| + else { |
| + base::GetTempDir(&g_deqp_log_dir); |
| + } |
| + return RUN_ALL_TESTS(); |
| +} |