2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """code generator for OpenGL ES 2.0 conformance tests."""
12 def ReadFileAsLines(filename
):
13 """Reads a file, removing blank lines and lines that start with #"""
14 file = open(filename
, "r")
15 raw_lines
= file.readlines()
18 for line
in raw_lines
:
20 if len(line
) > 0 and not line
.startswith("#"):
25 def GenerateTests(file):
26 """Generates gles2_conform_test_autogen.cc"""
28 tests
= ReadFileAsLines(
29 "../../third_party/gles2_conform/GTF_ES/glsl/GTF/mustpass_es20.run")
32 #include "gpu/gles2_conform_support/gles2_conform_test.h"
33 #include "testing/gtest/include/gtest/gtest.h"
38 TEST(GLES2ConformTest, %(name)s) {
39 EXPECT_TRUE(RunGLES2ConformTest("%(path)s"));
42 "name": re
.sub(r
'[^A-Za-z0-9]', '_', test
),
48 """This is the main function."""
55 file = open(os
.path
.join(dir, 'gles2_conform_test_autogen.cc'), 'wb')
62 if __name__
== '__main__':
63 sys
.exit(main(sys
.argv
[1:]))