Fix util/process test on Cygwin
authorJon Turney <jon.turney@dronecode.org.uk>
Wed, 25 Mar 2020 13:22:30 +0000 (13:22 +0000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Apr 2020 21:10:11 +0000 (21:10 +0000)
It seems meson returns the filename with extension for full_path(), even
though Cygwin does it's best to pretend the file doesn't have that
extension.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4514>

src/util/process_test.c

index 00703df6034c9b274cfbd60db7e14c5ee8eee6ce..ef7e2b4d4ad293fce937b226ae61b36c33dc1416 100644 (file)
@@ -75,6 +75,11 @@ test_util_get_process_exec_path (void)
       error = true;
       return;
    }
+#ifdef __CYGWIN__
+   int i = strlen(build_path) - 4;
+   if ((i > 0) && (strcmp(&build_path[i], ".exe") == 0))
+      build_path[i] = 0;
+#endif
    expect_equal_str(build_path, path, "util_get_process_name");
 }