summaryrefslogtreecommitdiff
path: root/generated_tests
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2015-02-19 16:39:39 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2015-02-23 15:47:10 -0800
commit22be17c96909d3b2989cb8aed37f3c6b63dfdc23 (patch)
tree19af5cd616b0085807cf0ba81e55f01cc5a652fe /generated_tests
parent934e04163f57b72b8b1685a15891480920229288 (diff)
gen_shader_bit_encoding_tests.py: python 2/3 hybridize
This requires modifications to the mako template and to the generator Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'generated_tests')
-rw-r--r--generated_tests/gen_shader_bit_encoding_tests.py10
-rw-r--r--generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako3
2 files changed, 8 insertions, 5 deletions
diff --git a/generated_tests/gen_shader_bit_encoding_tests.py b/generated_tests/gen_shader_bit_encoding_tests.py
index 46567552d..5eda4b414 100644
--- a/generated_tests/gen_shader_bit_encoding_tests.py
+++ b/generated_tests/gen_shader_bit_encoding_tests.py
@@ -26,6 +26,8 @@ import struct
import os
from operator import neg
+import six
+
from templates import template_file
from modules import utils
@@ -134,7 +136,7 @@ REQUIREMENTS = {
def main():
"""main function."""
# pylint: disable=line-too-long
- for api, requirement in REQUIREMENTS.iteritems():
+ for api, requirement in six.iteritems(REQUIREMENTS):
version = requirement['version']
extensions = [requirement['extension']] if requirement['extension'] else []
@@ -142,9 +144,9 @@ def main():
'built-in-functions')
utils.safe_makedirs(dirname)
- for func, attrib in FUNCS.iteritems():
+ for func, attrib in six.iteritems(FUNCS):
for execution_stage in ('vs', 'fs'):
- for in_modifier_func, modifier_func in MODIFIER_FUNCS.iteritems():
+ for in_modifier_func, modifier_func in six.iteritems(MODIFIER_FUNCS):
# Modifying the sign of an unsigned number doesn't make sense.
if func == 'uintBitsToFloat' and in_modifier_func != '':
continue
@@ -162,7 +164,7 @@ def main():
in_modifier_func = '-abs'
with open(filename, 'w') as f:
- f.write(TEMPLATE.render(
+ f.write(TEMPLATE.render_unicode(
version=version,
extensions=extensions,
execution_stage=execution_stage,
diff --git a/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako b/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako
index 83eb5679c..a7f49d9c4 100644
--- a/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako
+++ b/generated_tests/templates/gen_shader_bit_encoding_tests/template.shader_test.mako
@@ -1,3 +1,4 @@
+<%! import six %>
[require]
GLSL >= ${version}
% for extension in extensions:
@@ -73,7 +74,7 @@ vertex/float/2
-1.0 1.0
[test]
-% for name, data in sorted(test_data.iteritems()):
+% for name, data in sorted(six.iteritems(test_data)):
% if name == '-0.0' and in_modifier_func != '' and func == 'intBitsToFloat':
# ${in_modifier_func}(INT_MIN) doesn't fit in a 32-bit int. Cannot test.
% else: