glsl/tests: Catch mkdir errors to help explain when they happen.
authorEric Anholt <eric@anholt.net>
Tue, 10 Mar 2020 20:36:51 +0000 (13:36 -0700)
committerMarge Bot <eric+marge@anholt.net>
Thu, 12 Mar 2020 19:47:23 +0000 (19:47 +0000)
A recent pipeline
(https://gitlab.freedesktop.org/Venemo/mesa/-/jobs/1893357) failed
with what looks like an intermittent error related to making files for
the cache test inside of the core of the cache.  Given some of the
errors, it looks like maybe a mkdir failed, so log those errors
earlier so we can debug what's going on next time.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4140>

src/compiler/glsl/tests/cache_test.c

index 9d7bde2834c827a10757869f65780b9e7d85a044..cf654e5b01db29c20828702c79987d8e8b8f7465 100644 (file)
@@ -230,7 +230,13 @@ test_disk_cache_create(void)
    expect_null(cache_exists(cache), "disk_cache_create with XDG_CACHE_HOME set "
                "with a non-existing parent directory");
 
-   mkdir(CACHE_TEST_TMP, 0755);
+   err = mkdir(CACHE_TEST_TMP, 0755);
+   if (err != 0) {
+      fprintf(stderr, "Error creating %s: %s\n", CACHE_TEST_TMP, strerror(errno));
+      error = true;
+      return;
+   }
+
    cache = disk_cache_create("test", "make_check", 0);
    expect_non_null(cache_exists(cache), "disk_cache_create with XDG_CACHE_HOME "
                    "set");
@@ -249,7 +255,13 @@ test_disk_cache_create(void)
    expect_null(cache_exists(cache), "disk_cache_create with MESA_GLSL_CACHE_DIR"
                " set with a non-existing parent directory");
 
-   mkdir(CACHE_TEST_TMP, 0755);
+   err = mkdir(CACHE_TEST_TMP, 0755);
+   if (err != 0) {
+      fprintf(stderr, "Error creating %s: %s\n", CACHE_TEST_TMP, strerror(errno));
+      error = true;
+      return;
+   }
+
    cache = disk_cache_create("test", "make_check", 0);
    expect_non_null(cache_exists(cache), "disk_cache_create with "
                    "MESA_GLSL_CACHE_DIR set");