test,zos: use gid=-1 to test spawn_setgid_fails

This is because on some platforms like z/OS, setgid(0) is
allowed for non-superusers. So instead, use setgid(-1) to
get UV_EINVAL to test that spawn failure returns the right
return code.

PR-URL: https://github.com/libuv/libuv/pull/1456
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
John Barboza 2017-08-02 22:58:45 -04:00 committed by Ben Noordhuis
parent 5e2fbe5994
commit f9823e5c12

View File

@ -1351,10 +1351,14 @@ TEST_IMPL(spawn_setgid_fails) {
init_process_options("spawn_helper1", fail_cb);
options.flags |= UV_PROCESS_SETGID;
#if defined(__MVS__)
options.gid = -1;
#else
options.gid = 0;
#endif
r = uv_spawn(uv_default_loop(), &process, &options);
#if defined(__CYGWIN__)
#if defined(__CYGWIN__) || defined(__MVS__)
ASSERT(r == UV_EINVAL);
#else
ASSERT(r == UV_EPERM);