Create t/lib/Testing.pm to hold functions used in test suite.

Refactor repeated code into read_cachefile(), read_cachefile_with_pages() and
get_expected_pages() and import those subroutines from Testing.