Fix tests in separate build dir

Pass $TOP_BUILDDIR into tests.