On Fri, 13 Aug 2021 09:52:53 -0700 Ian Lance Taylor <i...@google.com> wrote:
> On Fri, Aug 13, 2021 at 12:05 AM Sergei Trofimovich <sly...@gmail.com> wrote: > > > > On Thu, 12 Aug 2021 16:16:04 -0700 > > Ian Lance Taylor <i...@google.com> wrote: > > > > > On Thu, Aug 12, 2021 at 3:34 PM Sergei Trofimovich via Gcc-patches > > > <gcc-patches@gcc.gnu.org> wrote: > > > > > > > > From: Sergei Trofimovich <siarh...@google.com> > > > > > > > > I noticed test failures when ran gcc test suite from under mc shell. > > > > mc opens fd=9 and exposes it to child processes. As a result a few > > > > tests failes: > > > > FAIL: b2test_buildid > > > > FAIL: btest_gnudebuglink > > > > FAIL: btest > > > > FAIL: btest_lto > > > > FAIL: btest_alloc > > > > FAIL: ctestg > > > > FAIL: ctesta > > > > FAIL: ctestg_alloc > > > > FAIL: ctesta_alloc > > > > FAIL: dwarf5 > > > > FAIL: dwarf5_alloc > > > > > > > > Instead of trying to close file descripts in range test polls for > > > > first available file descriptor by creating it via dup(1). > > > > > > > > libbacktrace/ > > > > > > > > * btest.c (check_open_files): Use last free file descriptor as a > > > > signal for flie descriptor leak. > > > > > > This isn't a useful replacement, as this will pass as long as > > > libbacktrace closes the first file descriptor that it opens. It won't > > > check whether libbacktrace left any other file descriptors open. > > > > > > Perhaps at program startup we could fstat descriptors up to 10 and > > > record whether they are valid, and then skip those files in > > > check_open_files. > > > > Oh, great point! Completely missed it. Changed the patch to poll for present > > file descriptors with fcntl(fd, F_GETFD) to compare before/after. > > I believe that we currently run some of the tests on Windows systems. > Do you know if fcntl(fd, F_GETFD) will work there? Ah, it does not. At least mingw does not expose fcntl. I'll look at possible equivalent on it and send another version. -- Sergei