tests/Utils.hs: fix handling of test failures