https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66005
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- r5-3553 uses if {![catch {open $path {RDWR CREAT EXCL} 0600} fd]} { to determine which make check invocation should be given a particular batch of tests (in an initially empty directory), could you use that instead?