Commit dd5cc5bf authored by Dylan Baker's avatar Dylan Baker
Browse files

gen_const_builtin_equal_tests.py: us os.path.join for directory names



This makes the test generators more OS agnostic.
Signed-off-by: default avatarDylan Baker <dylanx.c.baker@intel.com>
acked-by: Matt Turner's avatarMatt Turner <mattst88@gmail.com>
parent 271b77ad
...@@ -90,15 +90,17 @@ TEST_VECTORS = [ ...@@ -90,15 +90,17 @@ TEST_VECTORS = [
def main(): def main():
""" Main function """ """ Main function """
try: dirname = os.path.join('spec', 'glsl-1.20', 'execution',
os.makedirs('spec/glsl-1.20/execution/built-in-functions') 'built-in-functions')
except OSError: if not os.path.exists(dirname):
pass os.makedirs(dirname)
for test_id, x in enumerate(TEST_VECTORS, start=2): for test_id, x in enumerate(TEST_VECTORS, start=2):
# make equal tests # make equal tests
name = ("spec/glsl-1.20/execution/built-in-functions/" name = os.path.join(
"glsl-const-builtin-equal-{0:02d}.shader_test".format(test_id)) dirname,
"glsl-const-builtin-equal-{0:02d}.shader_test".format(test_id))
print(name) print(name)
with open(name, 'w') as f: with open(name, 'w') as f:
...@@ -106,9 +108,9 @@ def main(): ...@@ -106,9 +108,9 @@ def main():
func='equal', input=x[0:2], expected=x[2])) func='equal', input=x[0:2], expected=x[2]))
# make notEqual tests # make notEqual tests
name = ("spec/glsl-1.20/execution/built-in-functions/" name = os.path.join(
"glsl-const-builtin-notEqual-{0:02d}.shader_test".format( dirname,
test_id)) "glsl-const-builtin-notEqual-{0:02d}.shader_test".format(test_id))
# When generating the notEqual tests, each of the values in the # When generating the notEqual tests, each of the values in the
# expected result vector need to be inverted # expected result vector need to be inverted
...@@ -122,5 +124,6 @@ def main(): ...@@ -122,5 +124,6 @@ def main():
f.write(TEMPLATE.render_unicode( f.write(TEMPLATE.render_unicode(
func='notEqual', input=x[0:2], expected=expected)) func='notEqual', input=x[0:2], expected=expected))
if __name__ == "__main__": if __name__ == "__main__":
main() main()
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