3 * Copyright (C)1997-2012 Net Integration Technologies and contributors.
4 * Licensed under the GNU Library General Public License, version 2.
5 * See the included file named LICENSE for license information.
6 * You can get wvtest from: http://github.com/apenwarr/wvtest
22 static bool fd_is_valid(int fd)
25 if ((HANDLE)_get_osfhandle(fd) != INVALID_HANDLE_VALUE) return true;
38 static int fd_count(const char *when)
42 printf("fds open at %s:", when);
44 for (int fd = 0; fd < 1024; fd++)
59 int main(int argc, char **argv)
62 #if defined(_WIN32) && defined(HAVE_WVCRASH)
63 setup_console_crash();
66 // test wvtest itself. Not very thorough, but you have to draw the
73 char * const *prefixes = NULL;
78 startfd = fd_count("start");
79 int ret = WvTest::run_all(prefixes);
81 if (ret == 0) // don't pollute the strace output if we failed anyway
83 endfd = fd_count("end");
85 WVPASS(startfd == endfd);
89 sprintf(buf, "ls -l /proc/%d/fd", getpid());
95 // keep 'make' from aborting if this environment variable is set
96 if (getenv("WVTEST_NO_FAIL"))