Commit 93150a73 authored by oshima@chromium.org's avatar oshima@chromium.org

Revert 289067 "Use RE string pattern matching for blacklist stri..."

Reason for revert: uninitialize memory access

http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Mac%20%28valgrind%29%282%29/builds/29469/steps/memory%20test%3A%20content/logs/stdio

> Use RE string pattern matching for blacklist strings.
> 
> Including cpu_brand, gl_vendor, gl_renderer, gl_extension, driver_vendor,
> and machine_model_name.
> 
> BUG=396578
> TBR=piman@chromium.org
> TEST=gpu_unittests
> 
> Review URL: https://codereview.chromium.org/452293002

TBR=zmo@chromium.org

Review URL: https://codereview.chromium.org/465163002

Cr-Commit-Position: refs/heads/master@{#289154}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289154 0039d316-1c4b-4281-b951-d872f2087c98
parent 017dbda0
...@@ -158,7 +158,10 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuSideBlacklisting) { ...@@ -158,7 +158,10 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuSideBlacklisting) {
}, },
{ {
"id": 2, "id": 2,
"gl_renderer": ".*GeForce.*", "gl_renderer": {
"op": "contains",
"value": "GeForce"
},
"features": [ "features": [
"accelerated_2d_canvas" "accelerated_2d_canvas"
] ]
...@@ -202,7 +205,10 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuSideExceptions) { ...@@ -202,7 +205,10 @@ TEST_F(GpuDataManagerImplPrivateTest, GpuSideExceptions) {
"id": 1, "id": 1,
"exceptions": [ "exceptions": [
{ {
"gl_renderer": ".*GeForce.*" "gl_renderer": {
"op": "contains",
"value": "GeForce"
}
} }
], ],
"features": [ "features": [
......
...@@ -209,6 +209,7 @@ test("gpu_unittests") { ...@@ -209,6 +209,7 @@ test("gpu_unittests") {
"config/gpu_control_list_entry_unittest.cc", "config/gpu_control_list_entry_unittest.cc",
"config/gpu_control_list_number_info_unittest.cc", "config/gpu_control_list_number_info_unittest.cc",
"config/gpu_control_list_os_info_unittest.cc", "config/gpu_control_list_os_info_unittest.cc",
"config/gpu_control_list_string_info_unittest.cc",
"config/gpu_control_list_unittest.cc", "config/gpu_control_list_unittest.cc",
"config/gpu_control_list_version_info_unittest.cc", "config/gpu_control_list_version_info_unittest.cc",
"config/gpu_driver_bug_list_unittest.cc", "config/gpu_driver_bug_list_unittest.cc",
......
This diff is collapsed.
...@@ -192,6 +192,32 @@ class GPU_EXPORT GpuControlList { ...@@ -192,6 +192,32 @@ class GPU_EXPORT GpuControlList {
scoped_ptr<VersionInfo> version_info_; scoped_ptr<VersionInfo> version_info_;
}; };
class GPU_EXPORT StringInfo {
public:
StringInfo(const std::string& string_op, const std::string& string_value);
// Determines if a given string is included in the StringInfo.
bool Contains(const std::string& value) const;
// Determines if the StringInfo contains valid information.
bool IsValid() const;
private:
enum Op {
kContains,
kBeginWith,
kEndWith,
kEQ, // =
kUnknown // Indicates StringInfo data is invalid.
};
// Maps string to Op; returns kUnknown if it's not a valid Op.
static Op StringToOp(const std::string& string_op);
Op op_;
std::string value_;
};
class GPU_EXPORT FloatInfo { class GPU_EXPORT FloatInfo {
public: public:
FloatInfo(const std::string& float_op, FloatInfo(const std::string& float_op,
...@@ -344,7 +370,8 @@ class GPU_EXPORT GpuControlList { ...@@ -344,7 +370,8 @@ class GPU_EXPORT GpuControlList {
bool SetGLType(const std::string& gl_type_string); bool SetGLType(const std::string& gl_type_string);
bool SetDriverVendorInfo(const std::string& vendor_value); bool SetDriverVendorInfo(const std::string& vendor_op,
const std::string& vendor_value);
bool SetDriverVersionInfo(const std::string& version_op, bool SetDriverVersionInfo(const std::string& version_op,
const std::string& version_style, const std::string& version_style,
...@@ -359,17 +386,21 @@ class GPU_EXPORT GpuControlList { ...@@ -359,17 +386,21 @@ class GPU_EXPORT GpuControlList {
const std::string& version_string, const std::string& version_string,
const std::string& version_string2); const std::string& version_string2);
bool SetGLVendorInfo(const std::string& vendor_value); bool SetGLVendorInfo(const std::string& vendor_op,
const std::string& vendor_value);
bool SetGLRendererInfo(const std::string& renderer_value); bool SetGLRendererInfo(const std::string& renderer_op,
const std::string& renderer_value);
bool SetGLExtensionsInfo(const std::string& extensions_value); bool SetGLExtensionsInfo(const std::string& extensions_op,
const std::string& extensions_value);
bool SetGLResetNotificationStrategyInfo(const std::string& op, bool SetGLResetNotificationStrategyInfo(const std::string& op,
const std::string& int_string, const std::string& int_string,
const std::string& int_string2); const std::string& int_string2);
bool SetCpuBrand(const std::string& cpu_value); bool SetCpuBrand(const std::string& cpu_op,
const std::string& cpu_value);
bool SetPerfGraphicsInfo(const std::string& op, bool SetPerfGraphicsInfo(const std::string& op,
const std::string& float_string, const std::string& float_string,
...@@ -433,15 +464,15 @@ class GPU_EXPORT GpuControlList { ...@@ -433,15 +464,15 @@ class GPU_EXPORT GpuControlList {
MultiGpuStyle multi_gpu_style_; MultiGpuStyle multi_gpu_style_;
MultiGpuCategory multi_gpu_category_; MultiGpuCategory multi_gpu_category_;
GLType gl_type_; GLType gl_type_;
std::string driver_vendor_info_; scoped_ptr<StringInfo> driver_vendor_info_;
scoped_ptr<VersionInfo> driver_version_info_; scoped_ptr<VersionInfo> driver_version_info_;
scoped_ptr<VersionInfo> driver_date_info_; scoped_ptr<VersionInfo> driver_date_info_;
scoped_ptr<VersionInfo> gl_version_info_; scoped_ptr<VersionInfo> gl_version_info_;
std::string gl_vendor_info_; scoped_ptr<StringInfo> gl_vendor_info_;
std::string gl_renderer_info_; scoped_ptr<StringInfo> gl_renderer_info_;
std::string gl_extensions_info_; scoped_ptr<StringInfo> gl_extensions_info_;
scoped_ptr<IntInfo> gl_reset_notification_strategy_info_; scoped_ptr<IntInfo> gl_reset_notification_strategy_info_;
std::string cpu_brand_; scoped_ptr<StringInfo> cpu_brand_;
scoped_ptr<FloatInfo> perf_graphics_info_; scoped_ptr<FloatInfo> perf_graphics_info_;
scoped_ptr<FloatInfo> perf_gaming_info_; scoped_ptr<FloatInfo> perf_gaming_info_;
scoped_ptr<FloatInfo> perf_overall_info_; scoped_ptr<FloatInfo> perf_overall_info_;
......
...@@ -470,98 +470,14 @@ TEST_F(GpuControlListEntryTest, GlVersionGLEntry) { ...@@ -470,98 +470,14 @@ TEST_F(GpuControlListEntryTest, GlVersionGLEntry) {
EXPECT_FALSE(entry->Contains(GpuControlList::kOsWin, "6.1", gpu_info)); EXPECT_FALSE(entry->Contains(GpuControlList::kOsWin, "6.1", gpu_info));
} }
TEST_F(GpuControlListEntryTest, GlVendorEqual) { TEST_F(GpuControlListEntryTest, GlVendorEntry) {
const std::string json = LONG_STRING_CONST( const std::string json = LONG_STRING_CONST(
{ {
"id": 1, "id": 1,
"gl_vendor": "NVIDIA", "gl_vendor": {
"features": [ "op": "beginwith",
"test_feature_0" "value": "NVIDIA"
] },
}
);
ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL);
GPUInfo gpu_info;
gpu_info.gl_vendor = "NVIDIA";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
// Case sensitive.
gpu_info.gl_vendor = "NVidia";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
gpu_info.gl_vendor = "NVIDIA-x";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
}
TEST_F(GpuControlListEntryTest, GlVendorWithDot) {
const std::string json = LONG_STRING_CONST(
{
"id": 1,
"gl_vendor": "X\\.Org.*",
"features": [
"test_feature_0"
]
}
);
ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL);
GPUInfo gpu_info;
gpu_info.gl_vendor = "X.Org R300 Project";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsLinux, "", gpu_info));
gpu_info.gl_vendor = "X.Org";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsLinux, "", gpu_info));
}
TEST_F(GpuControlListEntryTest, GlRendererContains) {
const std::string json = LONG_STRING_CONST(
{
"id": 1,
"gl_renderer": ".*GeForce.*",
"features": [
"test_feature_0"
]
}
);
ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL);
GPUInfo gpu_info;
gpu_info.gl_renderer = "NVIDIA GeForce GT 120 OpenGL Engine";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
// Case sensitive.
gpu_info.gl_renderer = "NVIDIA GEFORCE GT 120 OpenGL Engine";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
gpu_info.gl_renderer = "GeForce GT 120 OpenGL Engine";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
gpu_info.gl_renderer = "NVIDIA GeForce";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
gpu_info.gl_renderer = "NVIDIA Ge Force";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
}
TEST_F(GpuControlListEntryTest, GlRendererCaseInsensitive) {
const std::string json = LONG_STRING_CONST(
{
"id": 1,
"gl_renderer": "(?i).*software.*",
"features": [ "features": [
"test_feature_0" "test_feature_0"
] ]
...@@ -570,21 +486,25 @@ TEST_F(GpuControlListEntryTest, GlRendererCaseInsensitive) { ...@@ -570,21 +486,25 @@ TEST_F(GpuControlListEntryTest, GlRendererCaseInsensitive) {
ScopedEntry entry(GetEntryFromString(json)); ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL); EXPECT_TRUE(entry.get() != NULL);
GPUInfo gpu_info; const GpuControlList::OsType os_type[] = {
gpu_info.gl_renderer = "software rasterizer"; GpuControlList::kOsMacosx,
EXPECT_TRUE(entry->Contains( GpuControlList::kOsWin,
GpuControlList::kOsMacosx, "10.9", gpu_info)); GpuControlList::kOsLinux,
GpuControlList::kOsChromeOS,
gpu_info.gl_renderer = "Software Rasterizer"; GpuControlList::kOsAndroid
EXPECT_TRUE(entry->Contains( };
GpuControlList::kOsMacosx, "10.9", gpu_info)); for (size_t i = 0; i < arraysize(os_type); ++i)
EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
} }
TEST_F(GpuControlListEntryTest, GlExtensionsEndWith) { TEST_F(GpuControlListEntryTest, GlRendererEntry) {
const std::string json = LONG_STRING_CONST( const std::string json = LONG_STRING_CONST(
{ {
"id": 1, "id": 1,
"gl_extensions": ".*GL_SUN_slice_accum", "gl_renderer": {
"op": "contains",
"value": "GeForce"
},
"features": [ "features": [
"test_feature_0" "test_feature_0"
] ]
...@@ -593,18 +513,15 @@ TEST_F(GpuControlListEntryTest, GlExtensionsEndWith) { ...@@ -593,18 +513,15 @@ TEST_F(GpuControlListEntryTest, GlExtensionsEndWith) {
ScopedEntry entry(GetEntryFromString(json)); ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL); EXPECT_TRUE(entry.get() != NULL);
GPUInfo gpu_info; const GpuControlList::OsType os_type[] = {
gpu_info.gl_extensions = "GL_SGIS_generate_mipmap " GpuControlList::kOsMacosx,
"GL_SGIX_shadow " GpuControlList::kOsWin,
"GL_SUN_slice_accum"; GpuControlList::kOsLinux,
EXPECT_TRUE(entry->Contains( GpuControlList::kOsChromeOS,
GpuControlList::kOsMacosx, "10.9", gpu_info)); GpuControlList::kOsAndroid
};
gpu_info.gl_extensions = "GL_SGIS_generate_mipmap " for (size_t i = 0; i < arraysize(os_type); ++i)
"GL_SUN_slice_accum " EXPECT_TRUE(entry->Contains(os_type[i], "10.6", gpu_info()));
"GL_SGIX_shadow";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
} }
TEST_F(GpuControlListEntryTest, PerfGraphicsEntry) { TEST_F(GpuControlListEntryTest, PerfGraphicsEntry) {
...@@ -723,38 +640,6 @@ TEST_F(GpuControlListEntryTest, AMDSwitchableEntry) { ...@@ -723,38 +640,6 @@ TEST_F(GpuControlListEntryTest, AMDSwitchableEntry) {
GpuControlList::kOsMacosx, "10.6", gpu_info)); GpuControlList::kOsMacosx, "10.6", gpu_info));
} }
TEST_F(GpuControlListEntryTest, DriverVendorBeginWith) {
const std::string json = LONG_STRING_CONST(
{
"id": 1,
"driver_vendor": "NVIDIA.*",
"features": [
"test_feature_0"
]
}
);
ScopedEntry entry(GetEntryFromString(json));
EXPECT_TRUE(entry.get() != NULL);
GPUInfo gpu_info;
gpu_info.driver_vendor = "NVIDIA Corporation";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
// Case sensitive.
gpu_info.driver_vendor = "NVidia Corporation";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
gpu_info.driver_vendor = "NVIDIA";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
gpu_info.driver_vendor = "USA NVIDIA";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsMacosx, "10.9", gpu_info));
}
TEST_F(GpuControlListEntryTest, LexicalDriverVersionEntry) { TEST_F(GpuControlListEntryTest, LexicalDriverVersionEntry) {
const std::string json = LONG_STRING_CONST( const std::string json = LONG_STRING_CONST(
{ {
...@@ -825,7 +710,10 @@ TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) { ...@@ -825,7 +710,10 @@ TEST_F(GpuControlListEntryTest, NeedsMoreInfoForExceptionsEntry) {
"vendor_id": "0x8086", "vendor_id": "0x8086",
"exceptions": [ "exceptions": [
{ {
"gl_renderer": ".*mesa.*" "gl_renderer": {
"op": "contains",
"value": "mesa"
}
} }
], ],
"features": [ "features": [
...@@ -919,9 +807,7 @@ TEST_F(GpuControlListEntryTest, MachineModelName) { ...@@ -919,9 +807,7 @@ TEST_F(GpuControlListEntryTest, MachineModelName) {
"os": { "os": {
"type": "android" "type": "android"
}, },
"machine_model_name": [ "machine_model_name": ["Nexus 4", "XT1032"],
"Nexus 4", "XT1032", "GT-.*", "SCH-.*"
],
"features": [ "features": [
"test_feature_0" "test_feature_0"
] ]
...@@ -955,18 +841,6 @@ TEST_F(GpuControlListEntryTest, MachineModelName) { ...@@ -955,18 +841,6 @@ TEST_F(GpuControlListEntryTest, MachineModelName) {
gpu_info.machine_model_name = ""; gpu_info.machine_model_name = "";
EXPECT_FALSE(entry->Contains( EXPECT_FALSE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info)); GpuControlList::kOsAndroid, "4.1", gpu_info));
gpu_info.machine_model_name = "GT-N7100";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info));
gpu_info.machine_model_name = "GT-I9300";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info));
gpu_info.machine_model_name = "SCH-I545";
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info));
} }
TEST_F(GpuControlListEntryTest, MachineModelNameException) { TEST_F(GpuControlListEntryTest, MachineModelNameException) {
...@@ -978,7 +852,7 @@ TEST_F(GpuControlListEntryTest, MachineModelNameException) { ...@@ -978,7 +852,7 @@ TEST_F(GpuControlListEntryTest, MachineModelNameException) {
"os": { "os": {
"type": "android" "type": "android"
}, },
"machine_model_name": ["Nexus.*"] "machine_model_name": ["Nexus 4"]
} }
], ],
"features": [ "features": [
...@@ -997,12 +871,6 @@ TEST_F(GpuControlListEntryTest, MachineModelNameException) { ...@@ -997,12 +871,6 @@ TEST_F(GpuControlListEntryTest, MachineModelNameException) {
EXPECT_TRUE(entry->Contains( EXPECT_TRUE(entry->Contains(
GpuControlList::kOsLinux, "4.1", gpu_info)); GpuControlList::kOsLinux, "4.1", gpu_info));
gpu_info.machine_model_name = "Nexus 7";
EXPECT_FALSE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info));
EXPECT_TRUE(entry->Contains(
GpuControlList::kOsLinux, "4.1", gpu_info));
gpu_info.machine_model_name = ""; gpu_info.machine_model_name = "";
EXPECT_TRUE(entry->Contains( EXPECT_TRUE(entry->Contains(
GpuControlList::kOsAndroid, "4.1", gpu_info)); GpuControlList::kOsAndroid, "4.1", gpu_info));
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
// 6. "multi_gpu_category" is a string, valid values include "any", "primary", // 6. "multi_gpu_category" is a string, valid values include "any", "primary",
// "secondary", and "active". If unspecified, the default value is "primary". // "secondary", and "active". If unspecified, the default value is "primary".
// See gpu_control_list.h for more details on the meanings of the strings. // See gpu_control_list.h for more details on the meanings of the strings.
// 7. "driver_vendor" is a string pattern. // 7. "driver_vendor" is a STRING structure (defined below).
// 8. "driver_version" is a VERSION structure (defined below). // 8. "driver_version" is a VERSION structure (defined below).
// 9. "driver_date" is a VERSION structure (defined below). // 9. "driver_date" is a VERSION structure (defined below).
// The version is interpreted as "year.month.day". // The version is interpreted as "year.month.day".
...@@ -41,16 +41,17 @@ ...@@ -41,16 +41,17 @@
// The default value on Android is "gles", on Windows is "angle", on other // The default value on Android is "gles", on Windows is "angle", on other
// platforms is "gl". // platforms is "gl".
// 11. "gl_version" is a VERSION structure (defined below). // 11. "gl_version" is a VERSION structure (defined below).
// 12. "gl_vendor" is a string pattern. // 12. "gl_vendor" is a STRING structure (defined below).
// 13. "gl_renderer" is a string pattern. // 13. "gl_renderer" is a STRING structure (defined below).
// 14. "gl_extensions" is a string pattern. // 14. "gl_extensions" is a STRING structure (defined below).
// 15. "perf_graphics" is a FLOAT structure (defined below). // 15. "perf_graphics" is a FLOAT structure (defined below).
// 16. "perf_gaming" is a FLOAT structure (defined below). // 16. "perf_gaming" is a FLOAT structure (defined below).
// 17. "perf_overall" is a FLOAT structure (defined below). // 17. "perf_overall" is a FLOAT structure (defined below).
// 18. "machine_model_name" is an array of string patterns. // 18. "machine_model_name" is an array of strings. The strings can contain
// any characters.
// 19. "machine_model_version" is a VERSION structure (defined below). // 19. "machine_model_version" is a VERSION structure (defined below).
// 20. "gpu_count" is a INT structure (defined below). // 20. "gpu_count" is a INT structure (defined below).
// 21 "cpu_info" is a string pattern. // 21 "cpu_info" is a STRING structure (defined below).
// 22. "exceptions" is a list of entries. // 22. "exceptions" is a list of entries.
// 23. "features" is a list of gpu control list options, which can be // 23. "features" is a list of gpu control list options, which can be
// configured by a specific list. See its *_json.cc file for a list of // configured by a specific list. See its *_json.cc file for a list of
...@@ -73,11 +74,12 @@ ...@@ -73,11 +74,12 @@
// Only "driver_version" supports lexical style if the format is major.minor; // Only "driver_version" supports lexical style if the format is major.minor;
// in that case, major is still numerical, but minor is lexical. // in that case, major is still numerical, but minor is lexical.
// //
// STRING includes "op" and "value". "op" can be any of the following values:
// "contains", "beginwith", "endwith", "=". "value" is a string.
//
// FLOAT includes "op" "value", and "value2". "op" can be any of the // FLOAT includes "op" "value", and "value2". "op" can be any of the
// following values: "=", "<", "<=", ">", ">=", "any", "between". "value2" is // following values: "=", "<", "<=", ">", ">=", "any", "between". "value2" is
// only used if "op" is "between". "value" is used for all "op" values except // only used if "op" is "between". "value" is used for all "op" values except
// "any". "value" and "value2" are valid float numbers. // "any". "value" and "value2" are valid float numbers.
// INT is very much like FLOAT, except that the values need to be integers. // INT is very much like FLOAT, except that the values need to be integers.
//
// String pattern syntax can be found at
// https://code.google.com/p/re2/wiki/Syntax.
// Copyright (c) 2013 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/config/gpu_control_list.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gpu {
class StringInfoTest : public testing::Test {
public:
StringInfoTest() { }
virtual ~StringInfoTest() { }
typedef GpuControlList::StringInfo StringInfo;
};
TEST_F(StringInfoTest, ValidStringInfo) {
const std::string op[] = {
"contains",
"beginwith",
"endwith",
"="
};
for (size_t i = 0; i < arraysize(op); ++i) {
{
StringInfo info(op[i], std::string());
EXPECT_TRUE(info.IsValid());
}
{
StringInfo info(op[i], "hello");
EXPECT_TRUE(info.IsValid());
}
}
}
TEST_F(StringInfoTest, InvalidStringInfo) {
const std::string op[] = {
"Contains",
"BeginWith",
"EndWith",
" =",
"= "
};
for (size_t i = 0; i < arraysize(op); ++i) {
StringInfo info(op[i], "hello");
EXPECT_FALSE(info.IsValid());
}
}
TEST_F(StringInfoTest, StringComparison) {
{
StringInfo info("contains", "happy");
EXPECT_TRUE(info.Contains("unhappy"));
EXPECT_TRUE(info.Contains("happy1"));
EXPECT_TRUE(info.Contains("happy"));
EXPECT_TRUE(info.Contains("a happy dog"));
EXPECT_TRUE(info.Contains("Happy"));
EXPECT_TRUE(info.Contains("HAPPY"));
EXPECT_FALSE(info.Contains("ha-ppy"));
}
{
StringInfo info("beginwith", "happy");
EXPECT_FALSE(info.Contains("unhappy"));
EXPECT_TRUE(info.Contains("happy1"));
EXPECT_TRUE(info.Contains("happy"));
EXPECT_FALSE(info.Contains("a happy dog"));
EXPECT_TRUE(info.Contains("Happy"));
EXPECT_TRUE(info.Contains("HAPPY"));
EXPECT_FALSE(info.Contains("ha-ppy"));
}
{
StringInfo info("endwith", "happy");
EXPECT_TRUE(info.Contains("unhappy"));
EXPECT_FALSE(info.Contains("happy1"));
EXPECT_TRUE(info.Contains("happy"));
EXPECT_FALSE(info.Contains("a happy dog"));
EXPECT_TRUE(info.Contains("Happy"));
EXPECT_TRUE(info.Contains("HAPPY"));
EXPECT_FALSE(info.Contains("ha-ppy"));
}
{
StringInfo info("=", "happy");
EXPECT_FALSE(info.Contains("unhappy"));
EXPECT_FALSE(info.Contains("happy1"));
EXPECT_TRUE(info.Contains("happy"));
EXPECT_FALSE(info.Contains("a happy dog"));
EXPECT_TRUE(info.Contains("Happy"));
EXPECT_TRUE(info.Contains("HAPPY"));
EXPECT_FALSE(info.Contains("ha-ppy"));
EXPECT_FALSE(info.Contains("ha ppy"));
EXPECT_FALSE(info.Contains(" happy"));
EXPECT_FALSE(info.Contains("happy "));
}
}
} // namespace gpu
...@@ -303,7 +303,10 @@ TEST_F(GpuControlListTest, NeedsMoreInfoForExceptions) { ...@@ -303,7 +303,10 @@ TEST_F(GpuControlListTest, NeedsMoreInfoForExceptions) {
"vendor_id": "0x8086", "vendor_id": "0x8086",
"exceptions": [ "exceptions": [
{ {
"gl_renderer": ".*mesa.*" "gl_renderer": {
"op": "contains",
"value": "mesa"
}
} }
], ],
"features": [ "features": [
......
This diff is collapsed.
...@@ -18,7 +18,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -18,7 +18,7 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
{ {
"name": "software rendering list", "name": "software rendering list",
// Please update the version number whenever you change this file. // Please update the version number whenever you change this file.
"version": "9.0", "version": "8.10",
"entries": [ "entries": [
{ {
"id": 1, "id": 1,
...@@ -42,7 +42,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -42,7 +42,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "linux" "type": "linux"
}, },
"gl_renderer": "(?i).*software.*", "gl_renderer": {
"op": "contains",
"value": "software"
},
"features": [ "features": [
"all" "all"
] ]
...@@ -73,7 +76,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -73,7 +76,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"vendor_id": "0x1002", "vendor_id": "0x1002",
"exceptions": [ "exceptions": [
{ {
"driver_vendor": ".*AMD.*", "driver_vendor": {
"op": "contains",
"value": "AMD"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"style": "lexical", "style": "lexical",
...@@ -81,7 +87,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -81,7 +87,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
} }
}, },
{ {
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"value": "10.0.4" "value": "10.0.4"
...@@ -141,7 +150,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -141,7 +150,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
} }
}, },
{ {
"driver_vendor": "osmesa" "driver_vendor": {
"op": "=",
"value": "osmesa"
}
}, },
{ {
"vendor_id": "0x1414", "vendor_id": "0x1414",
...@@ -160,7 +172,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -160,7 +172,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"type": "linux" "type": "linux"
}, },
"vendor_id": "0x8086", "vendor_id": "0x8086",
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": "<", "op": "<",
"value": "10.1" "value": "10.1"
...@@ -225,14 +240,20 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -225,14 +240,20 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "linux" "type": "linux"
}, },
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": "<", "op": "<",
"value": "7.11" "value": "7.11"
}, },
"exceptions": [ "exceptions": [
{ {
"driver_vendor": "osmesa" "driver_vendor": {
"op": "=",
"value": "osmesa"
}
} }
], ],
"features": [ "features": [
...@@ -256,10 +277,16 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -256,10 +277,16 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "linux" "type": "linux"
}, },
"gl_vendor": "ATI.*", "gl_vendor": {
"op": "beginwith",
"value": "ATI"
},
"exceptions": [ "exceptions": [
{ {
"driver_vendor": ".*AMD.*", "driver_vendor": {
"op": "contains",
"value": "AMD"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"style": "lexical", "style": "lexical",
...@@ -267,7 +294,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -267,7 +294,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
} }
}, },
{ {
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"value": "10.0.4" "value": "10.0.4"
...@@ -285,11 +315,20 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -285,11 +315,20 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "linux" "type": "linux"
}, },
"gl_vendor": "X\\.Org.*", "gl_vendor": {
"gl_renderer": ".*AMD.*", "op": "beginwith",
"value": "X.Org"
},
"gl_renderer": {
"op": "contains",
"value": "AMD"
},
"exceptions": [ "exceptions": [
{ {
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"value": "10.0.4" "value": "10.0.4"
...@@ -307,11 +346,20 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -307,11 +346,20 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "linux" "type": "linux"
}, },
"gl_vendor": "X\\.Org.*", "gl_vendor": {
"gl_renderer": ".*ATI.*", "op": "beginwith",
"value": "X.Org"
},
"gl_renderer": {
"op": "contains",
"value": "ATI"
},
"exceptions": [ "exceptions": [
{ {
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"value": "10.0.4" "value": "10.0.4"
...@@ -330,7 +378,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -330,7 +378,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"type": "linux" "type": "linux"
}, },
"vendor_id": "0x10de", "vendor_id": "0x10de",
"gl_vendor": "(?i)nouveau.*", "gl_vendor": {
"op": "beginwith",
"value": "nouveau"
},
"features": [ "features": [
"all" "all"
] ]
...@@ -354,7 +405,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -354,7 +405,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
} }
}, },
{ {
"cpu_info": "(?i).*Atom.*" "cpu_info": {
"op": "contains",
"value": "Atom"
}
} }
], ],
"features": [ "features": [
...@@ -395,12 +449,18 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -395,12 +449,18 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"multi_gpu_style": "optimus", "multi_gpu_style": "optimus",
"exceptions": [ "exceptions": [
{ {
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"value": "10.1" "value": "10.1"
}, },
"gl_vendor": "Intel.*" "gl_vendor": {
"op": "beginwith",
"value": "Intel"
}
} }
], ],
"features": [ "features": [
...@@ -497,7 +557,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -497,7 +557,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"type": "linux" "type": "linux"
}, },
"vendor_id": "0x10de", "vendor_id": "0x10de",
"driver_vendor": "NVIDIA", "driver_vendor": {
"op": "=",
"value": "NVIDIA"
},
"driver_version": { "driver_version": {
"op": "<", "op": "<",
"value": "295" "value": "295"
...@@ -558,15 +621,24 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -558,15 +621,24 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "linux" "type": "linux"
}, },
"gl_vendor": "VMware.*", "gl_vendor": {
"op": "beginwith",
"value": "VMware"
},
"exceptions": [ "exceptions": [
{ {
"driver_vendor": "Mesa", "driver_vendor": {
"op": "=",
"value": "Mesa"
},
"driver_version": { "driver_version": {
"op": ">=", "op": ">=",
"value": "9.2.1" "value": "9.2.1"
}, },
"gl_renderer": ".*SVGA3D.*" "gl_renderer": {
"op": "contains",
"value": "SVGA3D"
}
} }
], ],
"features": [ "features": [
...@@ -591,7 +663,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -591,7 +663,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"type": "linux" "type": "linux"
}, },
"vendor_id": "0x10de", "vendor_id": "0x10de",
"driver_vendor": "NVIDIA", "driver_vendor": {
"op": "=",
"value": "NVIDIA"
},
"features": [ "features": [
"accelerated_video_decode", "accelerated_video_decode",
"flash_3d", "flash_3d",
...@@ -641,7 +716,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -641,7 +716,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "android" "type": "android"
}, },
"gl_renderer": ".*Adreno.*", "gl_renderer": {
"op": "contains",
"value": "Adreno"
},
"driver_version": { "driver_version": {
"op": "<", "op": "<",
"value": "4.1" "value": "4.1"
...@@ -770,7 +848,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST( ...@@ -770,7 +848,10 @@ const char kSoftwareRenderingListJson[] = LONG_STRING_CONST(
"os": { "os": {
"type": "win" "type": "win"
}, },
"driver_vendor": "Microsoft", "driver_vendor": {
"op": "=",
"value": "Microsoft"
},
"exceptions": [ "exceptions": [
{ {
"vendor_id": "0x1414", "vendor_id": "0x1414",
...@@ -1031,7 +1112,10 @@ LONG_STRING_CONST( ...@@ -1031,7 +1112,10 @@ LONG_STRING_CONST(
"type": "linux" "type": "linux"
}, },
"vendor_id": "0x1002", "vendor_id": "0x1002",
"driver_vendor": ".*AMD.*", "driver_vendor": {
"op": "contains",
"value": "AMD"
},
"driver_version": { "driver_version": {
"op": "=", "op": "=",
"value": "13.101" "value": "13.101"
......
...@@ -276,6 +276,7 @@ ...@@ -276,6 +276,7 @@
'config/gpu_control_list_entry_unittest.cc', 'config/gpu_control_list_entry_unittest.cc',
'config/gpu_control_list_number_info_unittest.cc', 'config/gpu_control_list_number_info_unittest.cc',
'config/gpu_control_list_os_info_unittest.cc', 'config/gpu_control_list_os_info_unittest.cc',
'config/gpu_control_list_string_info_unittest.cc',
'config/gpu_control_list_unittest.cc', 'config/gpu_control_list_unittest.cc',
'config/gpu_control_list_version_info_unittest.cc', 'config/gpu_control_list_version_info_unittest.cc',
'config/gpu_driver_bug_list_unittest.cc', 'config/gpu_driver_bug_list_unittest.cc',
......
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