3 * Copyright (C) 1997-2009 Net Integration Technologies, Inc.
4 * Licensed under the GNU Library General Public License, version 2.
5 * See the included file named LICENSE for license information.
21 static bool fd_is_valid(int fd)
24 if ((HANDLE)_get_osfhandle(fd) != INVALID_HANDLE_VALUE) return true;
37 static int fd_count(const char *when)
41 printf("fds open at %s:", when);
43 for (int fd = 0; fd < 1024; fd++)
58 int main(int argc, char **argv)
61 #if defined(_WIN32) && defined(HAVE_WVCRASH)
62 setup_console_crash();
65 // test wvtest itself. Not very thorough, but you have to draw the
72 char * const *prefixes = NULL;
77 startfd = fd_count("start");
78 int ret = WvTest::run_all(prefixes);
80 if (ret == 0) // don't pollute the strace output if we failed anyway
82 endfd = fd_count("end");
84 WVPASS(startfd == endfd);
88 sprintf(buf, "ls -l /proc/%d/fd", getpid());
94 // keep 'make' from aborting if this environment variable is set
95 if (getenv("WVTEST_NO_FAIL"))