Refactor test-process-function generation in preparation for special tests.