about summary refs log tree commit diff
path: root/shared/nm-utils/nm-test-utils.h
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2021-02-18 18:54:58 +0100
committerMichael Biebl <biebl@debian.org>2021-02-18 18:54:58 +0100
commiteca19fa2272137cfd38135376f8cbf6d0a2f2187 (patch)
tree36d3cdb47cd2b3b367dced642667479007ffaf62 /shared/nm-utils/nm-test-utils.h
parent16df93361dd8829fa730e08ce96650b499a59f70 (diff)
parent3a56bce6c0ea7ba0fe269520547740783b342e0d (diff)
Update upstream source from tag 'upstream/1.30.0'
Update to upstream version '1.30.0'
with Debian dir e4e3c5986af4d47930d9e35ac7d8bc6c70bd1dd9
Diffstat (limited to 'shared/nm-utils/nm-test-utils.h')
-rw-r--r--shared/nm-utils/nm-test-utils.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index 6b41c11e..d51f972e 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -624,6 +624,23 @@ __nmtst_init(int *       argc,
         g_setenv("G_MESSAGES_DEBUG", "all", TRUE);
     }
 
+    /* "tc" is in /sbin, which might not be in $PATH of a regular user. Unconditionally
+     * add "/bin" and "/sbin" to $PATH for all tests. */
+    {
+        static char *path_new;
+        const char * path_old;
+
+        g_assert(!path_new);
+
+        path_old = g_getenv("PATH");
+        path_new = g_strjoin("",
+                             path_old ?: "",
+                             (nm_str_is_empty(path_old) ? "" : ":"),
+                             "/bin:/sbin",
+                             NULL);
+        g_setenv("PATH", path_new, TRUE);
+    }
+
     /* Delay messages until we setup logging. */
     for (i = 0; i < debug_messages->len; i++)
         __NMTST_LOG(g_message, "%s", g_array_index(debug_messages, const char *, i));