On 04/07/2017 12:46 PM, Dylan Baker wrote:
Quoting Brian Paul (2017-04-07 11:41:10)
If piglit is built out of source (such as in a top-level build/ directory),
the generated shader tests will be in build/generated_tests/.  This patch
checks if PIGLIT_BUILD_DIR is set, and if so, looks for generated_tests/ in
that directory.
---
  tests/py_modules/constants.py | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tests/py_modules/constants.py b/tests/py_modules/constants.py
index a4e7fb3..d4a15bf 100644
--- a/tests/py_modules/constants.py
+++ b/tests/py_modules/constants.py
@@ -28,8 +28,16 @@ import sys
  import subprocess

  TESTS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
-GENERATED_TESTS_DIR = os.path.abspath(
-    os.path.join(TESTS_DIR, '..', 'generated_tests'))
+
+if 'PIGLIT_BUILD_DIR' in os.environ:
+    # The generated tests will be in the build dir
+    GENERATED_TESTS_DIR = os.path.abspath(
+        os.path.join(os.environ['PIGLIT_BUILD_DIR'], 'generated_tests'))
+else:
+    # The generated tests will be in the source dir
+    GENERATED_TESTS_DIR = os.path.abspath(
+        os.path.join(TESTS_DIR, '..', 'generated_tests'))
+

You could simplify this as:
GENERATED_TESTS_DIR = os.path.abspath(os.path.join(
     os.environ.get('PIGLIT_BUILD_DIR', os.path.join(TESTS_DIR, '..'),
     'generated_tests'))

Thanks.  I wasn't aware of os.environ.get() and its default arg.


Also, should we be checking for TEST_DIR the same way?

So far, it looks like if I set PIGLIT_BUILD_DIR and PIGLIT_SOURCE_DIR that things are working with just the above patch.

v2 coming.

-Brian

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to