This was fixed in later branches by along with other testsuite bugfixes that don't apply to 5.1 branch.