| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/format_macros.h" | 5 #include "base/format_macros.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "gpu/config/gpu_test_expectations_parser.h" | 8 #include "gpu/config/gpu_test_expectations_parser.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace gpu { | 11 namespace gpu { |
| 12 | 12 |
| 13 struct TestOSEntry { | 13 struct TestOSEntry { |
| 14 const char* name; | 14 const char* name; |
| 15 GPUTestConfig::OS os; | 15 GPUTestConfig::OS os; |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 static const TestOSEntry kOsFamilyWin = { "WIN", GPUTestConfig::kOsWin }; | 18 static const TestOSEntry kOsFamilyWin = { "WIN", GPUTestConfig::kOsWin }; |
| 19 static const TestOSEntry kOsFamilyMac = { "MAC", GPUTestConfig::kOsMac }; | 19 static const TestOSEntry kOsFamilyMac = { "MAC", GPUTestConfig::kOsMac }; |
| 20 | 20 |
| 21 static const struct TestOsWithFamily { | 21 static const struct TestOsWithFamily { |
| 22 TestOSEntry version; | 22 TestOSEntry version; |
| 23 TestOSEntry family; | 23 TestOSEntry family; |
| 24 } kOSVersionsWithFamily[] = { | 24 } kOSVersionsWithFamily[] = { |
| 25 { { "XP", GPUTestConfig::kOsWinXP }, kOsFamilyWin }, | 25 { { "XP", GPUTestConfig::kOsWinXP }, kOsFamilyWin }, |
| 26 { { "VISTA", GPUTestConfig::kOsWinVista }, kOsFamilyWin }, | 26 { { "VISTA", GPUTestConfig::kOsWinVista }, kOsFamilyWin }, |
| 27 { { "WIN7", GPUTestConfig::kOsWin7 }, kOsFamilyWin }, | 27 { { "WIN7", GPUTestConfig::kOsWin7 }, kOsFamilyWin }, |
| 28 { { "WIN8", GPUTestConfig::kOsWin8 }, kOsFamilyWin }, | 28 { { "WIN8", GPUTestConfig::kOsWin8 }, kOsFamilyWin }, |
| 29 { { "WIN10", GPUTestConfig::kOsWin10 }, kOsFamilyWin }, |
| 29 { { "LEOPARD", GPUTestConfig::kOsMacLeopard }, kOsFamilyMac }, | 30 { { "LEOPARD", GPUTestConfig::kOsMacLeopard }, kOsFamilyMac }, |
| 30 { { "SNOWLEOPARD", GPUTestConfig::kOsMacSnowLeopard }, kOsFamilyMac }, | 31 { { "SNOWLEOPARD", GPUTestConfig::kOsMacSnowLeopard }, kOsFamilyMac }, |
| 31 { { "LION", GPUTestConfig::kOsMacLion }, kOsFamilyMac }, | 32 { { "LION", GPUTestConfig::kOsMacLion }, kOsFamilyMac }, |
| 32 { { "MOUNTAINLION", GPUTestConfig::kOsMacMountainLion }, kOsFamilyMac }, | 33 { { "MOUNTAINLION", GPUTestConfig::kOsMacMountainLion }, kOsFamilyMac }, |
| 33 { { "MAVERICKS", GPUTestConfig::kOsMacMavericks }, kOsFamilyMac }, | 34 { { "MAVERICKS", GPUTestConfig::kOsMacMavericks }, kOsFamilyMac }, |
| 34 { { "YOSEMITE", GPUTestConfig::kOsMacYosemite }, kOsFamilyMac }, | 35 { { "YOSEMITE", GPUTestConfig::kOsMacYosemite }, kOsFamilyMac }, |
| 35 { { "LINUX", GPUTestConfig::kOsLinux }, | 36 { { "LINUX", GPUTestConfig::kOsLinux }, |
| 36 { "LINUX", GPUTestConfig::kOsLinux } }, | 37 { "LINUX", GPUTestConfig::kOsLinux } }, |
| 37 { { "CHROMEOS", GPUTestConfig::kOsChromeOS }, | 38 { { "CHROMEOS", GPUTestConfig::kOsChromeOS }, |
| 38 { "CHROMEOS", GPUTestConfig::kOsChromeOS } }, | 39 { "CHROMEOS", GPUTestConfig::kOsChromeOS } }, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 159 |
| 159 GPUTestExpectationsParser parser; | 160 GPUTestExpectationsParser parser; |
| 160 EXPECT_TRUE(parser.LoadTestExpectations(text)); | 161 EXPECT_TRUE(parser.LoadTestExpectations(text)); |
| 161 EXPECT_EQ(0u, parser.GetErrorMessages().size()); | 162 EXPECT_EQ(0u, parser.GetErrorMessages().size()); |
| 162 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass, | 163 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass, |
| 163 parser.GetTestExpectation("MyTest", bot_config())); | 164 parser.GetTestExpectation("MyTest", bot_config())); |
| 164 } | 165 } |
| 165 | 166 |
| 166 TEST_F(GPUTestExpectationsParserTest, AllModifiers) { | 167 TEST_F(GPUTestExpectationsParserTest, AllModifiers) { |
| 167 const std::string text = | 168 const std::string text = |
| 168 "BUG12345 XP VISTA WIN7 WIN8 LEOPARD SNOWLEOPARD LION MOUNTAINLION " | 169 "BUG12345 XP VISTA WIN7 WIN8 WIN10 LEOPARD SNOWLEOPARD LION MOUNTAINLION " |
| 169 "MAVERICKS LINUX CHROMEOS ANDROID " | 170 "MAVERICKS LINUX CHROMEOS ANDROID " |
| 170 "NVIDIA INTEL AMD VMWARE RELEASE DEBUG : MyTest = " | 171 "NVIDIA INTEL AMD VMWARE RELEASE DEBUG : MyTest = " |
| 171 "PASS FAIL FLAKY TIMEOUT SKIP"; | 172 "PASS FAIL FLAKY TIMEOUT SKIP"; |
| 172 | 173 |
| 173 GPUTestExpectationsParser parser; | 174 GPUTestExpectationsParser parser; |
| 174 EXPECT_TRUE(parser.LoadTestExpectations(text)); | 175 EXPECT_TRUE(parser.LoadTestExpectations(text)); |
| 175 EXPECT_EQ(0u, parser.GetErrorMessages().size()); | 176 EXPECT_EQ(0u, parser.GetErrorMessages().size()); |
| 176 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass | | 177 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass | |
| 177 GPUTestExpectationsParser::kGpuTestFail | | 178 GPUTestExpectationsParser::kGpuTestFail | |
| 178 GPUTestExpectationsParser::kGpuTestFlaky | | 179 GPUTestExpectationsParser::kGpuTestFlaky | |
| 179 GPUTestExpectationsParser::kGpuTestTimeout | | 180 GPUTestExpectationsParser::kGpuTestTimeout | |
| 180 GPUTestExpectationsParser::kGpuTestSkip, | 181 GPUTestExpectationsParser::kGpuTestSkip, |
| 181 parser.GetTestExpectation("MyTest", bot_config())); | 182 parser.GetTestExpectation("MyTest", bot_config())); |
| 182 } | 183 } |
| 183 | 184 |
| 184 TEST_P(GPUTestExpectationsParserParamTest, DuplicateModifiers) { | 185 TEST_P(GPUTestExpectationsParserParamTest, DuplicateModifiers) { |
| 185 const std::string text = base::StringPrintf( | 186 const std::string text = base::StringPrintf( |
| 186 "BUG12345 %s %s RELEASE NVIDIA 0x0640 : MyTest = FAIL", | 187 "BUG12345 %s %s RELEASE NVIDIA 0x0640 : MyTest = FAIL", |
| 187 GetParam().version.name, | 188 GetParam().version.name, |
| 188 GetParam().version.name); | 189 GetParam().version.name); |
| 189 | 190 |
| 190 GPUTestExpectationsParser parser; | 191 GPUTestExpectationsParser parser; |
| 191 EXPECT_FALSE(parser.LoadTestExpectations(text)); | 192 EXPECT_FALSE(parser.LoadTestExpectations(text)); |
| 192 EXPECT_NE(0u, parser.GetErrorMessages().size()); | 193 EXPECT_NE(0u, parser.GetErrorMessages().size()); |
| 193 } | 194 } |
| 194 | 195 |
| 195 TEST_F(GPUTestExpectationsParserTest, AllModifiersLowerCase) { | 196 TEST_F(GPUTestExpectationsParserTest, AllModifiersLowerCase) { |
| 196 const std::string text = | 197 const std::string text = |
| 197 "BUG12345 xp vista win7 leopard snowleopard lion linux chromeos android " | 198 "BUG12345 xp vista win7 win8 win10 leopard snowleopard lion linux " |
| 198 "nvidia intel amd vmware release debug : MyTest = " | 199 "chromeos android nvidia intel amd vmware release debug : MyTest = " |
| 199 "pass fail flaky timeout skip"; | 200 "pass fail flaky timeout skip"; |
| 200 | 201 |
| 201 GPUTestExpectationsParser parser; | 202 GPUTestExpectationsParser parser; |
| 202 EXPECT_TRUE(parser.LoadTestExpectations(text)); | 203 EXPECT_TRUE(parser.LoadTestExpectations(text)); |
| 203 EXPECT_EQ(0u, parser.GetErrorMessages().size()); | 204 EXPECT_EQ(0u, parser.GetErrorMessages().size()); |
| 204 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass | | 205 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass | |
| 205 GPUTestExpectationsParser::kGpuTestFail | | 206 GPUTestExpectationsParser::kGpuTestFail | |
| 206 GPUTestExpectationsParser::kGpuTestFlaky | | 207 GPUTestExpectationsParser::kGpuTestFlaky | |
| 207 GPUTestExpectationsParser::kGpuTestTimeout | | 208 GPUTestExpectationsParser::kGpuTestTimeout | |
| 208 GPUTestExpectationsParser::kGpuTestSkip, | 209 GPUTestExpectationsParser::kGpuTestSkip, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass, | 320 EXPECT_EQ(GPUTestExpectationsParser::kGpuTestPass, |
| 320 parser.GetTestExpectation("OtherTest", bot_config())); | 321 parser.GetTestExpectation("OtherTest", bot_config())); |
| 321 } | 322 } |
| 322 | 323 |
| 323 INSTANTIATE_TEST_CASE_P(GPUTestExpectationsParser, | 324 INSTANTIATE_TEST_CASE_P(GPUTestExpectationsParser, |
| 324 GPUTestExpectationsParserParamTest, | 325 GPUTestExpectationsParserParamTest, |
| 325 ::testing::ValuesIn(kOSVersionsWithFamily)); | 326 ::testing::ValuesIn(kOSVersionsWithFamily)); |
| 326 | 327 |
| 327 } // namespace gpu | 328 } // namespace gpu |
| 328 | 329 |
| OLD | NEW |