Skip to contentSkip to conversation

igt_core: Search "." as final fallback for igt_fopen_data()

PATCH In review Matt Roper 2 participants 2 messages May 26, 2016 – May 27, 2016 Library code

lore
Share & tools
lore

Matt Roper

author
#0 lore raw

PATCH 1/1 igt_core: Search "." as final fallback for igt_fopen_data()

Some validation teams seem to run tests out of source directories that have been nfs mounted or rsync'd to different locations on the target machine. This causes the igt_srcdir that the tests were built with to be invalid on the machine the tests get run on. Add the current directory as a final fallback for data file searches.

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=92248

Cc Humberto Israel Perez Rodriguez <[email protected]>
---
 lib/igt_core.c | 4 ++++
 lib/igt_core.h | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
lib/igt_core.c +4 -0
index 56061c3..92a875c 100644
@@ -1882,6 +1882,10 @@ FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
 		snprintf(path, sizeof(path), "%s/%s", igt_srcdir, filename);
 		fp = fopen(path, "r");
 	}
+	if (!fp) {
+		snprintf(path, sizeof(path), "./%s", filename);
+		fp = fopen(path, "r");
+	}
 
 	if (!fp)
 		igt_critical("Could not open data file \"%s\": %s", filename,
lib/igt_core.h +2 -2
index 1b62371..5995233 100644
@@ -842,8 +842,8 @@ FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
  * igt_fopen_data:
  * @filename: filename to open.
  *
- * Open a datafile for test, first try from installation directory
- * then from build directory.
+ * Open a datafile for test, first try from installation directory,
+ * then from build directory, and finally from current directory.
  */
 #define igt_fopen_data(filename) \
 	__igt_fopen_data(IGT_SRCDIR, IGT_DATADIR, filename)
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Pushed.

Quoted 51 lines · Matt Roper

Some validation teams seem to run tests out of source directories that have been nfs mounted or rsync'd to different locations on the target machine. This causes the igt_srcdir that the tests were built with to be invalid on the machine the tests get run on. Add the current directory as a final fallback for data file searches.

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=92248

Cc Humberto Israel Perez Rodriguez <[email protected]>
---
 lib/igt_core.c | 4 ++++
 lib/igt_core.h | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
lib/igt_core.c +4 -0
index 56061c3..92a875c 100644
@@ -1882,6 +1882,10 @@ FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
 		snprintf(path, sizeof(path), "%s/%s", igt_srcdir, filename);
 		fp = fopen(path, "r");
 	}
+	if (!fp) {
+		snprintf(path, sizeof(path), "./%s", filename);
+		fp = fopen(path, "r");
+	}
 
 	if (!fp)
 		igt_critical("Could not open data file \"%s\": %s", filename,
lib/igt_core.h +2 -2
index 1b62371..5995233 100644
@@ -842,8 +842,8 @@ FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir,
  * igt_fopen_data:
  * @filename: filename to open.
  *
- * Open a datafile for test, first try from installation directory
- * then from build directory.
+ * Open a datafile for test, first try from installation directory,
+ * then from build directory, and finally from current directory.
  */
 #define igt_fopen_data(filename) \
 	__igt_fopen_data(IGT_SRCDIR, IGT_DATADIR, filename)
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx