Rewrite test file generation.