Implement an RAII "temp directory" object that creates a temporary directory on creation, and deletes it and its contents when it goes out of scope (or logs if it fails to delete).
Extend the unittest framework to take an optional --temppath command line argument, falling back to $TMP then $TEMP then working directory, for choosing the root location for temporary directories.
Make the working path of the external sorter a construction parameter, rather than the global "dbpath" variable, but have MongoD always use dbapth + "/_tmp" for the sorter work area.
Pull the sorter test out of test.exe, utilizing 1-3 above.
Update smoke.py to pass an apporpriate --temppath to C++ unittests. Pick a default that makes the sorter test work like it does today, except not in test.exe.
Update MCI builders as desired to supply a different temp path, and perhaps to clean up after it.