Fix incorrect reporting of failures from self-test function.