Commit 348efd1b authored by Dylan Baker's avatar Dylan Baker
Browse files

gen_uniform_initializer_tests.py: Use templates folder for templates


Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
parent 3616cecd
......@@ -61,14 +61,14 @@ piglit_make_generated_tests(
piglit_make_generated_tests(
uniform-initializer_tests.list
gen_uniform_initializer_tests.py
uniform-initializer-templates/fs-initializer.template
uniform-initializer-templates/vs-initializer.template
uniform-initializer-templates/fs-initializer-from-const.template
uniform-initializer-templates/vs-initializer-from-const.template
uniform-initializer-templates/fs-initializer-set-by-API.template
uniform-initializer-templates/vs-initializer-set-by-API.template
uniform-initializer-templates/fs-initializer-set-by-other-stage.template
uniform-initializer-templates/vs-initializer-set-by-other-stage.template
templates/gen_uniform_initializer_tests/fs-initializer.shader_test.mako
templates/gen_uniform_initializer_tests/vs-initializer.shader_test.mako
templates/gen_uniform_initializer_tests/fs-initializer-from-const.shader_test.mako
templates/gen_uniform_initializer_tests/vs-initializer-from-const.shader_test.mako
templates/gen_uniform_initializer_tests/fs-initializer-set-by-API.shader_test.mako
templates/gen_uniform_initializer_tests/vs-initializer-set-by-API.shader_test.mako
templates/gen_uniform_initializer_tests/fs-initializer-set-by-other-stage.shader_test.mako
templates/gen_uniform_initializer_tests/vs-initializer-set-by-other-stage.shader_test.mako
)
piglit_make_generated_tests(
builtin_cl_int_tests.list
......
# coding=utf-8
#
# Copyright © 2012 Intel Corporation
# Copyright © 2012, 2014 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
......@@ -23,7 +23,10 @@
import os
import os.path
from mako.template import Template
from templates import template_dir
TEMPLATES = template_dir(os.path.splitext(os.path.basename(__file__))[0])
def open_src_file(filename):
......@@ -54,12 +57,8 @@ def get_value(type, idx):
def generate_tests(type_list, base_name, major, minor):
for target in ("vs", "fs"):
for t in all_templates:
template_file_name = (
"uniform-initializer-templates/"
"{0}-initializer{1}.template".format(target, t))
f = open_src_file(template_file_name)
template = f.read()
f.close()
template = TEMPLATES.get_template(
"{0}-initializer{1}.shader_test.mako".format(target, t))
test_file_name = os.path.join(
'spec',
......@@ -107,20 +106,17 @@ def generate_tests(type_list, base_name, major, minor):
j = j + 1
f = open(test_file_name, "w")
f.write(Template(template).render(type_list=test_vectors,
api_types=api_vectors,
major=major,
minor=minor))
f.write(template.render(type_list=test_vectors,
api_types=api_vectors,
major=major,
minor=minor))
f.close()
def generate_array_tests(type_list, base_name, major, minor):
for target in ("vs", "fs"):
template_file_name = \
"uniform-initializer-templates/{0}-initializer.template".format(target)
f = open_src_file(template_file_name)
template = f.read()
f.close()
template = TEMPLATES.get_template(
'{0}-initializer.shader_test.mako'.format(target))
test_file_name = os.path.join(
'spec',
......@@ -158,9 +154,9 @@ def generate_array_tests(type_list, base_name, major, minor):
j = j + 1
f = open(test_file_name, "w")
f.write(Template(template).render(type_list=test_vectors,
major=major,
minor=minor))
f.write(template.render(type_list=test_vectors,
major=major,
minor=minor))
f.close()
# These are a set of pseudo random values used by the number sequence
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment