public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/1] tests/tools_test: Find the tool binaries also from bindir
@ 2018-10-08 12:10 Petri Latvala
  2018-10-08 13:28 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/1] " Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Petri Latvala @ 2018-10-08 12:10 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Also print what directory gets used.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
 tests/tools_test.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/tests/tools_test.c b/tests/tools_test.c
index a0025bed..ac8717c5 100644
--- a/tests/tools_test.c
+++ b/tests/tools_test.c
@@ -59,20 +59,33 @@ static void assert_cmd_success(int exec_return)
 	igt_assert_eq(exec_return, IGT_EXIT_SUCCESS);
 }
 
+bool chdir_to_tools_dir()
+{
+	char path[4096];
+
+	/* Try TOOLS relative to cwd */
+	if (chdir(TOOLS) == 0)
+		return true;
+
+	/* Try TOOLS and install dir relative to test binary */
+	if (readlink("/proc/self/exe", path, sizeof(path)) > 0)
+		chdir(dirname(path));
+
+	return chdir(TOOLS) == 0 || chdir("../../bin") == 0;
+}
+
 igt_main
 {
 	igt_skip_on_simulation();
 
 	igt_fixture {
-		char path[4096];
-
-		/* Try to guess where the TOOLS are! */
-		if (access(TOOLS, F_OK) &&
-		    readlink("/proc/self/exe", path, sizeof(path)) > 0)
-			chdir(dirname(path));
+		char *path;
 
-		igt_require_f(chdir(TOOLS) == 0,
+		igt_require_f(chdir_to_tools_dir(),
 			      "Unable to determine the tools directory, expecting them in $cwd/" TOOLS " or $path/" TOOLS "\n");
+		path = get_current_dir_name();
+		igt_info("Using tools from %s\n", path);
+		free(path);
 	}
 
 	igt_subtest("sysfs_l3_parity") {
-- 
2.18.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-05 13:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-08 12:10 [igt-dev] [PATCH i-g-t 1/1] tests/tools_test: Find the tool binaries also from bindir Petri Latvala
2018-10-08 13:28 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/1] " Patchwork
2018-10-08 14:41 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2018-10-08 15:49 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-11-05 10:50 ` [igt-dev] [PATCH i-g-t 1/1] " Arkadiusz Hiler
2018-11-05 11:42   ` Petri Latvala
2018-11-05 13:45     ` Arkadiusz Hiler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox