tests: use captured copy of errno.