This happens when running the tests with Xvfb driver, because _setup_environ_for_test() is called twice and the DTR is created there every time. Only the last directory created is cleaned up by the driver destructor. The DRT temp directory is only needed for layout tests, so we could even avoid its creation by moving it to the start() method like other drivers do (included the base driver implementation). Since API and WebDriver tests don't call start(), the directory is not even created, and the required env vars are not set either in that case.
Created attachment 328454 [details] Patch
Committed r225740: <https://trac.webkit.org/changeset/225740>
<rdar://problem/35962796>