Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: gpu/gles2_conform_support/generate_gles2_conform_tests.py

Issue 105733002: Move src/gpu/gles2_conform_test out of src-internal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/gles2_conform_support/generate_gles2_conform_tests.py
diff --git a/gpu/gles2_conform_support/generate_gles2_conform_tests.py b/gpu/gles2_conform_support/generate_gles2_conform_tests.py
new file mode 100755
index 0000000000000000000000000000000000000000..df2980a11a4303dde37b79675312768cde74af2a
--- /dev/null
+++ b/gpu/gles2_conform_support/generate_gles2_conform_tests.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# 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.
+
+"""code generator for OpenGL ES 2.0 conformance tests."""
+
+import os
+import re
+import sys
+
+def ReadFileAsLines(filename):
+ """Reads a file, removing blank lines and lines that start with #"""
+ file = open(filename, "r")
+ raw_lines = file.readlines()
+ file.close()
+ lines = []
+ for line in raw_lines:
+ line = line.strip()
+ if len(line) > 0 and not line.startswith("#"):
+ lines.append(line)
+ return lines
+
+
+def GenerateTests(file):
+ """Generates gles2_conform_test_autogen.cc"""
+
+ tests = ReadFileAsLines(
+ "../../third_party/gles2_conform/GTF_ES/glsl/GTF/mustpass_es20.run")
+
+ file.write("""
+#include "gpu/gles2_conform_support/gles2_conform_test.h"
+#include "testing/gtest/include/gtest/gtest.h"
+""")
+
+ for test in tests:
+ file.write("""
+TEST(GLES2ConformTest, %(name)s) {
+ EXPECT_TRUE(RunGLES2ConformTest("%(path)s"));
+}
+""" % {
+ "name": re.sub(r'[^A-Za-z0-9]', '_', test),
+ "path": test,
+ })
+
+
+def main(argv):
+ """This is the main function."""
+
+ if len(argv) >= 1:
+ dir = argv[0]
+ else:
+ dir = '.'
+
+ file = open(os.path.join(dir, 'gles2_conform_test_autogen.cc'), 'wb')
+ GenerateTests(file)
+ file.close()
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))

Powered by Google App Engine
This is Rietveld 408576698