tests: make "test-execute" work in "sudo ninja -C build test" (#7463)

In this mode USER/LOGNAME still point to the original caller, and our
tests get confused by that.

Follow-up for: #7450
This commit is contained in:
Lennart Poettering 2017-11-24 22:56:44 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 3d22bc8636
commit 2482f88d2a

View File

@ -560,6 +560,9 @@ int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
(void) unsetenv("USER");
(void) unsetenv("LOGNAME");
/* It is needed otherwise cgroup creation fails */
if (getuid() != 0) {
puts("Skipping test: not root");