add errno checking to tests