webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
gpu_test_expectations_parser.h
Go to the documentation of this file.
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
3 // found in the LICENSE file.
4 
5 #ifndef GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
6 #define GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
7 
8 #include <string>
9 #include <vector>
10 
11 #include "angle_config.h"
12 #include "gpu_test_config.h"
13 
14 namespace gpu {
15 
17  public:
19  kGpuTestPass = 1 << 0,
20  kGpuTestFail = 1 << 1,
21  kGpuTestFlaky = 1 << 2,
22  kGpuTestTimeout = 1 << 3,
23  kGpuTestSkip = 1 << 4,
24  };
25 
28 
29  // Parse the text expectations, and if no error is encountered,
30  // save all the entries. Otherwise, generate error messages.
31  // Return true if parsing succeeds.
32  bool LoadTestExpectations(const std::string& data);
33  bool LoadTestExpectationsFromFile(const std::string& path);
34 
35  // Query error messages from the last LoadTestExpectations() call.
36  const std::vector<std::string>& GetErrorMessages() const;
37 
38  // Get the test expectation of a given test on a given bot.
39  int32 GetTestExpectation(const std::string& test_name,
40  const GPUTestBotConfig& bot_config) const;
41 
42  // Parse a list of config modifiers. If we have a valid entry with no
43  // conflicts, | config | stores it, and the function returns true.
44  bool ParseConfig(const std::string& config_data, GPUTestConfig* config);
45 
46  private:
47  struct GPUTestExpectationEntry {
48  GPUTestExpectationEntry();
49 
50  std::string test_name;
51  GPUTestConfig test_config;
52  int32 test_expectation;
53  size_t line_number;
54  };
55 
56  // Parse a line of text. If we have a valid entry, save it; otherwise,
57  // generate error messages.
58  bool ParseLine(const std::string& line_data, size_t line_number);
59 
60  // Update OS/GPUVendor/BuildType modifiers. May generate an error message.
61  bool UpdateTestConfig(
62  GPUTestConfig* config, int32 token, size_t line_number);
63 
64  // Update GPUDeviceID modifier. May generate an error message.
65  bool UpdateTestConfig(GPUTestConfig* config,
66  const std::string & gpu_device_id,
67  size_t line_number);
68 
69  // Check if two entries' config overlap with each other. May generate an
70  // error message.
71  bool DetectConflictsBetweenEntries();
72 
73  // Save an error message, which can be queried later.
74  void PushErrorMessage(const std::string& message, size_t line_number);
75  void PushErrorMessage(const std::string& message,
76  size_t entry1_line_number,
77  size_t entry2_line_number);
78 
79  std::vector<GPUTestExpectationEntry> entries_;
80  std::vector<std::string> error_messages_;
81 };
82 
83 } // namespace gpu
84 
85 #endif // GPU_CONFIG_GPU_TEST_EXPECTATIONS_PARSER_H_
86 
path
Definition: generate.py:74
bool ParseConfig(int argc, char **argv, TestConfig *out_config)
Definition: test_config.cc:167
Definition: gpu_test_expectations_parser.h:16
Definition: gpu_test_config.h:107
#define GPU_EXPORT
Definition: angle_config.h:25
Definition: gpu_test_config.h:17
Definition: gpu_info.cc:22
EGLStreamKHR EGLint EGLint EGLint const void * data
Definition: eglext.h:984
GLsizei const GLchar *const * string
Definition: gl2.h:479
GPUTestExpectation
Definition: gpu_test_expectations_parser.h:18
GLuint GLsizei const GLchar * message
Definition: gl2ext.h:137
EGLConfig config
Definition: eglext.h:389
int32_t int32
Definition: angle_config.h:27