test-extract: Use mktemp for working directory

Adjust test-extract to use a working directory created using
mktemp, to avoid predictable filenames and symlink-attacks in
/tmp.

This completes the work begun in d42ed05.