corrade icon indicating copy to clipboard operation
corrade copied to clipboard

Tests that no Windows handles are leaked in Directory APIs

Open Squareys opened this issue 4 years ago • 1 comments

Hi @mosra !

As per gitter, here's the fix for the leaking handle. Windows will refuse to delete folders with open handles, which means every list()-ed folder would be locked until application exit.

Best, Jonathan


Edit by @mosra -- things to do in addition to Windows handle leak counting because yes everything turns into a "fixing a lightbulb" problem after a while:

  • [ ] Make it possible to have checks in a teardown routine (I have branch for this somewhere)
  • [ ] Turn this into a teardown check that's attached for test cases that access the OS APIs
  • [ ] Figure out a way to check file descriptor leaks on Unix as well (mainly for tests that map empty files, etc.)
    • On Linux check the number of entries in /proc/self/fd before and after
    • On macOS it's /dev/fd?? https://stackoverflow.com/a/42483033
  • [ ] Checking that we're errno clean in Directory APIs / tests (in particular, if some API such as rm() fails, it should clean errno after itself)

Squareys avatar Aug 15 '20 10:08 Squareys

Merged the fix alone in 515cc7e31e2c76903a19c52d2b6c82a0f8ccbb96, keeping this open so I have a reminder to add the handle counting to all tests.

Thanks!

mosra avatar Aug 15 '20 15:08 mosra