Skip to content

Commit

Permalink
test: disallow running the test suite as root
Browse files Browse the repository at this point in the history
The test suite is known to have issues when run as root. This
commit prevents the test suite from running when the euid is 0.

Fixes: #2549
PR-URL: #2585
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
  • Loading branch information
cjihrig committed Dec 26, 2019
1 parent 2ab3dc1 commit af45b6b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/run-tests.c
Expand Up @@ -51,6 +51,13 @@ static int maybe_run_test(int argc, char **argv);


int main(int argc, char **argv) {
#ifndef _WIN32
if (0 == geteuid() && NULL == getenv("UV_RUN_AS_ROOT")) {
fprintf(stderr, "The libuv test suite cannot be run as root.\n");
return EXIT_FAILURE;
}
#endif

if (platform_init(argc, argv))
return EXIT_FAILURE;

Expand Down

0 comments on commit af45b6b

Please sign in to comment.