tests: Promote files_equal() to a test-client-helper routine

The files_equal function originates from the Cairo testsuite.
tests: Drop debugging output in dump_image
tests: Construct the filename external to wl_test_record_screenshot

We need to use the output filename when we do a comparison with the
appropriate reference image, so move the filename construction to the
caller of record_screenshot() instead.

Doing this also requires externalizing the output iteration loop since
we want the output number to be recorded in the filename.  In most cases
this won't matter since we will just have a single head anyway; plus, in
cases where we do have multiple heads we could well be caring only about
the contents of the Nth head rather than all of them.

The fadein test doesn't care about multi-head so no need to traverse the
list; we'll look just at head #0.
tests: Add filename construction to client helper routines