Issue #24751: Fix running regrtest with '-w' flag in case of test failures.

Also fixes reporting of tests that change environment when there are no test
failures.
1 file changed