r16525: Move selftest-specific code back to selftest.