Fixes tests to not rely on OS sorting of directory entries