summaryrefslogtreecommitdiff
path: root/tests/util/piglit-util.c
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-07-06 18:39:58 -0700
committerChad Versace <chad.versace@linux.intel.com>2012-07-15 21:16:35 -0700
commite2a761a27b9f91644fc8a5fc27537fd788542be8 (patch)
tree3726523a8948ea615c12503a187de0c57dbff41a /tests/util/piglit-util.c
parentedbb8a48c57226aaac9e33ab3837ff3ba3fabd44 (diff)
util: Add piglit_source_dir()
This function reads the environment variable PIGLIT_SOURCE_DIR, and reports failure if the function is undefined. The intention is that tests should use to construct the path to any needed data files. Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'tests/util/piglit-util.c')
-rw-r--r--tests/util/piglit-util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index f6c2ba02e..f01ff5e3a 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -334,3 +334,16 @@ char *piglit_load_text_file(const char *file_name, unsigned *size)
return text;
#endif
}
+
+const char*
+piglit_source_dir(void)
+{
+
+ const char *s = getenv("PIGLIT_SOURCE_DIR");
+
+ if (s == NULL) {
+ printf("error: env var PIGLIT_SOURCE_DIR is undefined\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ return s;