Add diff drivers tests (and fix bugs)

This adds real tests for user-configured diff drivers and in the
process found a bunch of bugs.