fixes #8539 - refactoring a test to work for both GNU libc and Darwin libc