[Piglit] [PATCH 4/7] cl.py: Use TESTS_DIR and GENERATED_TESTS_DIR

Dylan Baker baker.dylan.c at gmail.com
Mon Jan 12 00:22:29 PST 2015


This allows cl.py to be run from outside of the piglit source directory,
such as when piglit is installed.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/cl.py | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/tests/cl.py b/tests/cl.py
index 897d99a..f7f2811 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -2,16 +2,18 @@
 # -*- coding: utf-8 -*-
 # All OpenCL tests that come with piglit, using default settings
 
-__all__ = ['profile']
+from __future__ import division, absolute_import, print_function
 
 import os
 import os.path as path
-
 import platform
 import glob
 
 from framework.profile import TestProfile
 from framework.test import PiglitCLTest
+from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
+
+__all__ = ['profile']
 
 ######
 # Helper functions
@@ -114,29 +116,29 @@ program["Build"]["Fail"] = program_build_fail
 program["Execute"] = program_execute
 
 add_program_test_dir(program_build,
-                     os.path.join('tests', 'cl', 'program', 'build'))
+                     os.path.join(TESTS_DIR, 'cl', 'program', 'build'))
 add_program_test_dir(program_build_fail,
-                     os.path.join('tests', 'cl', 'program', 'build', 'fail'))
+                     os.path.join(TESTS_DIR, 'cl', 'program', 'build', 'fail'))
 add_program_test_dir(program_execute,
-                     os.path.join('tests', 'cl', 'program', 'execute'))
+                     os.path.join(TESTS_DIR, 'cl', 'program', 'execute'))
 add_program_test_dir(program_execute,
-                     os.path.join('tests', 'cl', 'program', 'execute',
+                     os.path.join(TESTS_DIR, 'cl', 'program', 'execute',
                                   'builtin', 'atomic'))
 add_program_test_dir(program_execute,
-                     os.path.join('tests', 'cl', 'program', 'execute',
+                     os.path.join(TESTS_DIR, 'cl', 'program', 'execute',
                                   'builtin', 'convert'))
 
 #Run generated built-in tests
 program_execute_builtin = {}
 program["Execute"]["Builtin"] = program_execute_builtin
 add_program_test_dir(program_execute_builtin,
-                     os.path.join('generated_tests', 'cl', 'builtin', 'int'))
+                     os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin', 'int'))
 add_program_test_dir(program_execute_builtin,
-                     os.path.join('generated_tests', 'cl', 'builtin', 'math'))
+                     os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin', 'math'))
 add_program_test_dir(program_execute_builtin,
-                     os.path.join('generated_tests', 'cl', 'builtin',
+                     os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin',
                                   'relational'))
 program_execute_store = {}
 program["Execute"]["Store"] = program_execute_store
 add_program_test_dir(program_execute_store,
-                     os.path.join('generated_tests', 'cl', 'store'))
+                     os.path.join(GENERATED_TESTS_DIR, 'cl', 'store'))
-- 
2.2.1



More information about the Piglit mailing list