summaryrefslogtreecommitdiff
path: root/tests/tools_test.c
diff options
context:
space:
mode:
authorArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-11-12 18:40:12 +0200
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-11-13 13:54:55 +0200
commit868d38c2bc075b6756ebed486db6e7152ed2c5be (patch)
treeff867bb9f8685115a28a18cea8bf69c4b71ef8e7 /tests/tools_test.c
parent43fa6db557ab0eff7408719747248bad0b691a5a (diff)
tests/tools_test: Add extra logging around chdirs
Sometimes we end up in /bin and I am not able to explain that just by looking at the machine or the IGT tarball that was deployed there so let's get some more breadcrumbs. Cc: Petri Latvala <petri.latvala@intel.com> Issue: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/12 Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'tests/tools_test.c')
-rw-r--r--tests/tools_test.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/tools_test.c b/tests/tools_test.c
index 88a6ae96..e3f73ac2 100644
--- a/tests/tools_test.c
+++ b/tests/tools_test.c
@@ -63,14 +63,30 @@ static void assert_cmd_success(int exec_return)
static bool chdir_to_tools_dir(void)
{
char path[PATH_MAX];
+ char *cwd;
+
+ cwd = get_current_dir_name();
+ igt_info("Current working directory: %s\n", cwd);
+ free(cwd);
/* Try TOOLS relative to cwd */
+ igt_info("Trying to cd to %s\n", TOOLS);
if (chdir(TOOLS) == 0)
return true;
+ igt_info("Failed to cd to %s\n", TOOLS);
+
/* Try TOOLS and install dir relative to test binary */
- if (readlink("/proc/self/exe", path, sizeof(path)) > 0)
+ if (readlink("/proc/self/exe", path, sizeof(path)) > 0) {
+ igt_info("/proc/self/exe point to %s, going to dirname()\n", path);
chdir(dirname(path));
+ }
+
+ cwd = get_current_dir_name();
+ igt_info("Current working directory: %s\n", cwd);
+ free(cwd);
+
+ igt_info("Trying to cd to %s or ../../bin\n", TOOLS);
return chdir(TOOLS) == 0 || chdir("../../bin") == 0;
}