Simplify test so that it is more portable.

I have checked that the test still fails when the "|| !P.isRegularFile()" from
the original patch is removed.