Commit 0449a902 by Jonah Ryan-Davis Committed by Commit Bot

Move gpu_test_expectations from third_party into ANGLE.

1. Copy the code from src/tests/third_party/gpu_test_expectations to src/test/test_expectations, rename .cc files to .cpp. Put these in a new static library and update dEQP to link against it in src/tests/BUILD.gn. 2. Merge the code in angle_config.h into the rest of the expectations parser, this code was added so that the rest of the parser would compile in ANGLE's tree with minimal modification. Still need to follow up with the third step to close the issue. Bug: angleproject:2677 Change-Id: Icf09b4eeed83a6d09b1964ad2adcfa85cabb4b63 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1536312 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 4ae2c12f
...@@ -659,26 +659,34 @@ if (build_angle_deqp_tests && !is_fuchsia) { ...@@ -659,26 +659,34 @@ if (build_angle_deqp_tests && !is_fuchsia) {
} }
} }
config("angle_deqp_gtest_support_config") { config("angle_deqp_test_expectations_config") {
include_dirs = [ "third_party/gpu_test_expectations" ] include_dirs = [ "${angle_root}:angle_common" ]
}
angle_static_library("angle_deqp_test_expectations") {
public_configs += [ ":angle_deqp_test_expectations_config" ]
public_deps = [
"${angle_root}:angle_common",
"${angle_root}:angle_util",
]
sources = deqp_test_expectations_sources
if (is_mac) {
sources += deqp_test_expectations_sources_mac
libs = [ "Cocoa.framework" ]
}
} }
angle_source_set("angle_deqp_gtest_support") { angle_source_set("angle_deqp_gtest_support") {
testonly = true testonly = true
public_deps = [ public_deps = [
":angle_deqp_test_expectations",
":angle_deqp_tests_main", ":angle_deqp_tests_main",
"${angle_root}:angle_common", "${angle_root}:angle_common",
"${angle_root}:angle_util", "${angle_root}:angle_util",
] ]
public_configs += [ ":angle_deqp_gtest_support_config" ] libs = []
sources = deqp_gpu_test_expectations_sources
if (is_mac) {
sources += deqp_gpu_test_expectations_sources_mac
libs = [ "Cocoa.framework" ]
}
if (!is_android) { if (!is_android) {
public_deps += [ "${angle_root}:angle_gpu_info_util" ] public_deps += [ "${angle_root}:angle_gpu_info_util" ]
......
...@@ -1143,15 +1143,15 @@ deqp_libtester_sources_android = [ ...@@ -1143,15 +1143,15 @@ deqp_libtester_sources_android = [
"$_deqp_path/framework/platform/android/tcuAndroidInternals.cpp", "$_deqp_path/framework/platform/android/tcuAndroidInternals.cpp",
"$_deqp_path/framework/platform/android/tcuAndroidInternals.hpp", "$_deqp_path/framework/platform/android/tcuAndroidInternals.hpp",
] ]
deqp_gpu_test_expectations_sources = [ deqp_test_expectations_sources = [
"third_party/gpu_test_expectations/gpu_info.cc", "test_expectations/gpu_info.cpp",
"third_party/gpu_test_expectations/gpu_info.h", "test_expectations/gpu_info.h",
"third_party/gpu_test_expectations/gpu_test_config.cc", "test_expectations/gpu_test_config.cpp",
"third_party/gpu_test_expectations/gpu_test_config.h", "test_expectations/gpu_test_config.h",
"third_party/gpu_test_expectations/gpu_test_expectations_parser.cc", "test_expectations/gpu_test_expectations_parser.cpp",
"third_party/gpu_test_expectations/gpu_test_expectations_parser.h", "test_expectations/gpu_test_expectations_parser.h",
] ]
deqp_gpu_test_expectations_sources_mac = [ deqp_test_expectations_sources_mac = [
"third_party/gpu_test_expectations/gpu_test_config_mac.mm", "test_expectations/gpu_test_config_mac.mm",
"third_party/gpu_test_expectations/gpu_test_config_mac.h", "test_expectations/gpu_test_config_mac.h",
] ]
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include "common/debug.h" #include "common/debug.h"
#include "common/platform.h" #include "common/platform.h"
#include "common/string_utils.h" #include "common/string_utils.h"
#include "gpu_test_expectations_parser.h"
#include "platform/Platform.h" #include "platform/Platform.h"
#include "tests/test_expectations/gpu_test_expectations_parser.h"
#include "util/system_utils.h" #include "util/system_utils.h"
namespace namespace
......
// // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// 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.
//
// angle_config.h:
// Helpers for importing the gpu test expectations package from Chrome.
//
#ifndef ANGLE_GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_ #ifndef ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#define ANGLE_GPU_TEST_EXPECTATIONS_ANGLE_CONFIG_H_ #define ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#include <stdint.h> #include <stdint.h>
#include <iostream> #include <iostream>
#include <string>
#include <vector>
#include "common/debug.h" #include "common/debug.h"
#include "common/string_utils.h" #include "common/string_utils.h"
...@@ -73,4 +69,145 @@ struct DxDiagNode ...@@ -73,4 +69,145 @@ struct DxDiagNode
#endif #endif
// clang-format on // clang-format on
#endif namespace gpu
{
struct GPUInfo;
class GPU_EXPORT GPUTestConfig
{
public:
enum OS
{
kOsUnknown = 0,
kOsWinXP = 1 << 0,
kOsWinVista = 1 << 1,
kOsWin7 = 1 << 2,
kOsWin8 = 1 << 3,
kOsMacLeopard = 1 << 4,
kOsMacSnowLeopard = 1 << 5,
kOsMacLion = 1 << 6,
kOsMacMountainLion = 1 << 7,
kOsMacMavericks = 1 << 8,
kOsMacYosemite = 1 << 9,
kOsMacElCapitan = 1 << 10,
kOsMacSierra = 1 << 11,
kOsMacHighSierra = 1 << 12,
kOsMacMojave = 1 << 13,
kOsMac = kOsMacLeopard | kOsMacSnowLeopard | kOsMacLion | kOsMacMountainLion |
kOsMacMavericks | kOsMacYosemite | kOsMacElCapitan | kOsMacSierra |
kOsMacHighSierra | kOsMacMojave,
kOsLinux = 1 << 14,
kOsChromeOS = 1 << 15,
kOsAndroid = 1 << 16,
kOsWin10 = 1 << 17,
kOsWin = kOsWinXP | kOsWinVista | kOsWin7 | kOsWin8 | kOsWin10,
kOsFuchsia = 1 << 18,
};
enum BuildType
{
kBuildTypeUnknown = 0,
kBuildTypeRelease = 1 << 0,
kBuildTypeDebug = 1 << 1,
};
enum API
{
kAPIUnknown = 0,
kAPID3D9 = 1 << 0,
kAPID3D11 = 1 << 1,
kAPIGLDesktop = 1 << 2,
kAPIGLES = 1 << 3,
kAPIVulkan = 1 << 4,
};
GPUTestConfig();
GPUTestConfig(const GPUTestConfig &other);
virtual ~GPUTestConfig();
void set_os(int32_t os);
void set_gpu_device_id(uint32_t id);
void set_build_type(int32_t build_type);
void set_api(int32_t api);
virtual void AddGPUVendor(uint32_t gpu_vendor);
int32_t os() const { return os_; }
const std::vector<uint32_t> &gpu_vendor() const { return gpu_vendor_; }
uint32_t gpu_device_id() const { return gpu_device_id_; }
int32_t build_type() const { return build_type_; }
int32_t api() const { return api_; }
// Check if the config is valid. For example, if gpu_device_id_ is set, but
// gpu_vendor_ is unknown, then it's invalid.
virtual bool IsValid() const;
// Check if two configs overlap, i.e., if there exists a config that matches
// both configs.
bool OverlapsWith(const GPUTestConfig &config) const;
// Disable validation of GPU vendor and device ids.
void DisableGPUInfoValidation();
protected:
void ClearGPUVendor();
// Indicates that the OS has the notion of a numeric GPU vendor and device id
// and this data should be validated.
bool validate_gpu_info_;
private:
// operating system.
int32_t os_;
// GPU vendor.
std::vector<uint32_t> gpu_vendor_;
// GPU device id (unique to each vendor).
uint32_t gpu_device_id_;
// Release or Debug.
int32_t build_type_;
// Back-end rendering APIs.
int32_t api_;
};
class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig
{
public:
GPUTestBotConfig() = default;
~GPUTestBotConfig() override;
// This should only be called when no gpu_vendor is added.
void AddGPUVendor(uint32_t gpu_vendor) override;
// Return false if gpu_info does not have valid vendor_id and device_id.
bool SetGPUInfo(const GPUInfo &gpu_info);
// Check if the bot config is valid, i.e., if it is one valid test-bot
// environment. For example, if a field is unknown, or if OS is not one
// fully defined OS, then it's valid.
bool IsValid() const override;
// Check if a bot config matches a test config, i.e., the test config is a
// superset of the bot config.
bool Matches(const GPUTestConfig &config) const;
bool Matches(const std::string &config_data) const;
// Setup the config with the current gpu testing environment.
// If gpu_info is nullptr, collect GPUInfo first.
bool LoadCurrentConfig(const GPUInfo *gpu_info);
// Check if this bot's config matches |config_data| or any of the |configs|.
static bool CurrentConfigMatches(const std::string &config_data);
static bool CurrentConfigMatches(const std::vector<std::string> &configs);
// Check if the bot has blacklisted all GPU features.
static bool GpuBlacklistedOnBot();
};
} // namespace gpu
#endif // ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
...@@ -46,4 +46,4 @@ void GetOperatingSystemVersionNumbers(int32_t *major_version, ...@@ -46,4 +46,4 @@ void GetOperatingSystemVersionNumbers(int32_t *major_version,
#endif #endif
} }
} // namespace angle } // namespace angle
...@@ -11,80 +11,80 @@ ...@@ -11,80 +11,80 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "angle_config.h"
#include "gpu_test_config.h" #include "gpu_test_config.h"
namespace gpu { namespace gpu
{
class GPU_EXPORT GPUTestExpectationsParser {
public: class GPU_EXPORT GPUTestExpectationsParser
enum GPUTestExpectation { {
kGpuTestPass = 1 << 0, public:
kGpuTestFail = 1 << 1, enum GPUTestExpectation
kGpuTestFlaky = 1 << 2, {
kGpuTestTimeout = 1 << 3, kGpuTestPass = 1 << 0,
kGpuTestSkip = 1 << 4, kGpuTestFail = 1 << 1,
}; kGpuTestFlaky = 1 << 2,
kGpuTestTimeout = 1 << 3,
GPUTestExpectationsParser(); kGpuTestSkip = 1 << 4,
~GPUTestExpectationsParser(); };
// Parse the text expectations, and if no error is encountered, GPUTestExpectationsParser();
// save all the entries. Otherwise, generate error messages. ~GPUTestExpectationsParser();
// Return true if parsing succeeds.
bool LoadTestExpectations(const std::string& data); // Parse the text expectations, and if no error is encountered,
bool LoadTestExpectationsFromFile(const std::string& path); // save all the entries. Otherwise, generate error messages.
// Return true if parsing succeeds.
// Query error messages from the last LoadTestExpectations() call. bool LoadTestExpectations(const std::string &data);
const std::vector<std::string>& GetErrorMessages() const; bool LoadTestExpectationsFromFile(const std::string &path);
// Get the test expectation of a given test on a given bot. // Query error messages from the last LoadTestExpectations() call.
int32_t GetTestExpectation(const std::string& test_name, const std::vector<std::string> &GetErrorMessages() const;
const GPUTestBotConfig& bot_config) const;
// Get the test expectation of a given test on a given bot.
// Parse a list of config modifiers. If we have a valid entry with no int32_t GetTestExpectation(const std::string &test_name,
// conflicts, | config | stores it, and the function returns true. const GPUTestBotConfig &bot_config) const;
bool ParseConfig(const std::string& config_data, GPUTestConfig* config);
// Parse a list of config modifiers. If we have a valid entry with no
private: // conflicts, | config | stores it, and the function returns true.
struct GPUTestExpectationEntry { bool ParseConfig(const std::string &config_data, GPUTestConfig *config);
GPUTestExpectationEntry();
private:
std::string test_name; struct GPUTestExpectationEntry
GPUTestConfig test_config; {
int32_t test_expectation; GPUTestExpectationEntry();
size_t line_number;
}; std::string test_name;
GPUTestConfig test_config;
// Parse a line of text. If we have a valid entry, save it; otherwise, int32_t test_expectation;
// generate error messages. size_t line_number;
bool ParseLine(const std::string& line_data, size_t line_number); };
// Update OS/GPUVendor/BuildType modifiers. May generate an error message. // Parse a line of text. If we have a valid entry, save it; otherwise,
bool UpdateTestConfig(GPUTestConfig* config, // generate error messages.
int32_t token, bool ParseLine(const std::string &line_data, size_t line_number);
size_t line_number);
// Update OS/GPUVendor/BuildType modifiers. May generate an error message.
// Update GPUDeviceID modifier. May generate an error message. bool UpdateTestConfig(GPUTestConfig *config, int32_t token, size_t line_number);
bool UpdateTestConfig(GPUTestConfig* config,
const std::string & gpu_device_id, // Update GPUDeviceID modifier. May generate an error message.
size_t line_number); bool UpdateTestConfig(GPUTestConfig *config,
const std::string &gpu_device_id,
// Check if two entries' config overlap with each other. May generate an size_t line_number);
// error message.
bool DetectConflictsBetweenEntries(); // Check if two entries' config overlap with each other. May generate an
// error message.
// Save an error message, which can be queried later. bool DetectConflictsBetweenEntries();
void PushErrorMessage(const std::string& message, size_t line_number);
void PushErrorMessage(const std::string& message, // Save an error message, which can be queried later.
size_t entry1_line_number, void PushErrorMessage(const std::string &message, size_t line_number);
size_t entry2_line_number); void PushErrorMessage(const std::string &message,
size_t entry1_line_number,
std::vector<GPUTestExpectationEntry> entries_; size_t entry2_line_number);
std::vector<std::string> error_messages_;
std::vector<GPUTestExpectationEntry> entries_;
std::vector<std::string> error_messages_;
}; };
} // namespace gpu } // namespace gpu
#endif // ANGLE_GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_ #endif // ANGLE_GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
// Copyright (c) 2012 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.
#ifndef ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#define ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "angle_config.h"
namespace gpu {
struct GPUInfo;
class GPU_EXPORT GPUTestConfig {
public:
enum OS {
kOsUnknown = 0,
kOsWinXP = 1 << 0,
kOsWinVista = 1 << 1,
kOsWin7 = 1 << 2,
kOsWin8 = 1 << 3,
kOsMacLeopard = 1 << 4,
kOsMacSnowLeopard = 1 << 5,
kOsMacLion = 1 << 6,
kOsMacMountainLion = 1 << 7,
kOsMacMavericks = 1 << 8,
kOsMacYosemite = 1 << 9,
kOsMacElCapitan = 1 << 10,
kOsMacSierra = 1 << 11,
kOsMacHighSierra = 1 << 12,
kOsMacMojave = 1 << 13,
kOsMac = kOsMacLeopard | kOsMacSnowLeopard | kOsMacLion |
kOsMacMountainLion | kOsMacMavericks | kOsMacYosemite |
kOsMacElCapitan | kOsMacSierra | kOsMacHighSierra | kOsMacMojave,
kOsLinux = 1 << 14,
kOsChromeOS = 1 << 15,
kOsAndroid = 1 << 16,
kOsWin10 = 1 << 17,
kOsWin = kOsWinXP | kOsWinVista | kOsWin7 | kOsWin8 | kOsWin10,
kOsFuchsia = 1 << 18,
};
enum BuildType {
kBuildTypeUnknown = 0,
kBuildTypeRelease = 1 << 0,
kBuildTypeDebug = 1 << 1,
};
enum API {
kAPIUnknown = 0,
kAPID3D9 = 1 << 0,
kAPID3D11 = 1 << 1,
kAPIGLDesktop = 1 << 2,
kAPIGLES = 1 << 3,
kAPIVulkan = 1 << 4,
};
GPUTestConfig();
GPUTestConfig(const GPUTestConfig& other);
virtual ~GPUTestConfig();
void set_os(int32_t os);
void set_gpu_device_id(uint32_t id);
void set_build_type(int32_t build_type);
void set_api(int32_t api);
virtual void AddGPUVendor(uint32_t gpu_vendor);
int32_t os() const { return os_; }
const std::vector<uint32_t>& gpu_vendor() const { return gpu_vendor_; }
uint32_t gpu_device_id() const { return gpu_device_id_; }
int32_t build_type() const { return build_type_; }
int32_t api() const { return api_; }
// Check if the config is valid. For example, if gpu_device_id_ is set, but
// gpu_vendor_ is unknown, then it's invalid.
virtual bool IsValid() const;
// Check if two configs overlap, i.e., if there exists a config that matches
// both configs.
bool OverlapsWith(const GPUTestConfig& config) const;
// Disable validation of GPU vendor and device ids.
void DisableGPUInfoValidation();
protected:
void ClearGPUVendor();
// Indicates that the OS has the notion of a numeric GPU vendor and device id
// and this data should be validated.
bool validate_gpu_info_;
private:
// operating system.
int32_t os_;
// GPU vendor.
std::vector<uint32_t> gpu_vendor_;
// GPU device id (unique to each vendor).
uint32_t gpu_device_id_;
// Release or Debug.
int32_t build_type_;
// Back-end rendering APIs.
int32_t api_;
};
class GPU_EXPORT GPUTestBotConfig : public GPUTestConfig {
public:
GPUTestBotConfig() = default;
~GPUTestBotConfig() override;
// This should only be called when no gpu_vendor is added.
void AddGPUVendor(uint32_t gpu_vendor) override;
// Return false if gpu_info does not have valid vendor_id and device_id.
bool SetGPUInfo(const GPUInfo& gpu_info);
// Check if the bot config is valid, i.e., if it is one valid test-bot
// environment. For example, if a field is unknown, or if OS is not one
// fully defined OS, then it's valid.
bool IsValid() const override;
// Check if a bot config matches a test config, i.e., the test config is a
// superset of the bot config.
bool Matches(const GPUTestConfig& config) const;
bool Matches(const std::string& config_data) const;
// Setup the config with the current gpu testing environment.
// If gpu_info is nullptr, collect GPUInfo first.
bool LoadCurrentConfig(const GPUInfo* gpu_info);
// Check if this bot's config matches |config_data| or any of the |configs|.
static bool CurrentConfigMatches(const std::string& config_data);
static bool CurrentConfigMatches(const std::vector<std::string>& configs);
// Check if the bot has blacklisted all GPU features.
static bool GpuBlacklistedOnBot();
};
} // namespace gpu
#endif // ANGLE_GPU_CONFIG_GPU_TEST_CONFIG_H_
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