mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 12:30:10 +01:00
platform/test: allow running root tests as sudo
Call to nmtst_reexec_sudo(), which allows you to specify a program via environment variable to exec the test. This is useful to exec the test program with sudo. NMTST_DEBUG="no-debug,sudo-cmd=$PWD/tools/test-sudo-wrapper.sh" make -C src/platform/tests/ check Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
e3784fa618
commit
ae863a6954
1 changed files with 3 additions and 0 deletions
|
|
@ -150,6 +150,9 @@ main (int argc, char **argv)
|
|||
nmtst_init (&argc, &argv, NULL, "ALL");
|
||||
|
||||
if (SETUP == nm_linux_platform_setup && getuid() != 0) {
|
||||
/* Try to exec as sudo, this function does not return, if a sudo-cmd is set. */
|
||||
nmtst_reexec_sudo ();
|
||||
|
||||
#ifdef REQUIRE_ROOT_TESTS
|
||||
g_message ("Fail test: requires root privileges (%s)", program);
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue