mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-08 11:53:00 -04:00
Detect broken unsetenv at unit-test runtime
If we have an unsetenv function that doesn't work, we can't run the main/base_environ unit test, so we should skip it.
This commit is contained in:
parent
fdc629736e
commit
f37cd4c227
@ -1831,6 +1831,18 @@ test_base_environ(void *arg)
|
||||
int i, n_methods=0;
|
||||
const char *defaultname;
|
||||
|
||||
/* See if unsetenv works before we rely on it. */
|
||||
setenv("EVENT_NOWAFFLES", "1", 1);
|
||||
unsetenv("EVENT_NOWAFFLES");
|
||||
if (getenv("EVENT_NOWAFFLES") != NULL) {
|
||||
#ifndef _EVENT_HAVE_UNSETENV
|
||||
TT_DECLARE("NOTE", ("Can't fake unsetenv; skipping test"));
|
||||
#else
|
||||
TT_DECLARE("NOTE", ("unsetenv doesn't work; skipping test"));
|
||||
#endif
|
||||
tt_skip();
|
||||
}
|
||||
|
||||
basenames = event_get_supported_methods();
|
||||
for (i = 0; basenames[i]; ++i) {
|
||||
methodname_to_envvar(basenames[i], varbuf, sizeof(varbuf));
|
||||
|
Loading…
x
Reference in New Issue
Block a user