tests: add test for EBADF return