Robolectric temporary files left in /tmp/

635 views
Skip to first unread message

Jens Andersen

unread,
Apr 28, 2014, 9:01:49 AM4/28/14
to robol...@googlegroups.com
Hi,

we have inherited some tests leaving file of the form android-*robolectric in /tmp/. For obscure reasons we would like robolectric to use a different directory for temporaries, but cannot find documentation on how/why robolectric uses /tmp/. Is there a resource/environment setting we can set to achieve this? Is there a way to enforce robolectric to properly clean up aftter a test run?

We run the tests on Ubuntu...

Can anyone help?

Best regards

Erich Douglass

unread,
Apr 30, 2014, 10:52:55 AM4/30/14
to robol...@googlegroups.com
Hi Jens,

Robolectric does create temp files when it runs for things like db
drivers, system I/O, etc. Those files are placed under the directory
returned by System.getProperty("java.io.tmpdir") (on Linux, it'll be
under /tmp or /var/tmp). You should be able to set the value of the
java.io.tmpdir property on the JVM that's running the tests.
> --
> You received this message because you are subscribed to the Google Groups
> "Robolectric" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to robolectric...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

David Carver

unread,
Apr 30, 2014, 12:57:54 PM4/30/14
to robol...@googlegroups.com
Any thought on using the JUnit @Rule annotation, and the TemporaryFolder class?  This would allow Robolectric to clean up after itself when running the tests.

Jake Wharton

unread,
Apr 30, 2014, 1:18:16 PM4/30/14
to robol...@googlegroups.com
Rules are people writing the tests and are scoped to a test. Its innards just do the same thing as Robolectric (which is the test runner). If Robolectric isn't deleting the files it creates then that's a bug.

David Carver

unread,
May 1, 2014, 3:24:22 PM5/1/14
to robol...@googlegroups.com
yeah, i can verify that it doesn't as my tmp folder is littered with robolectric created temporary items.  I'm using 2.2 so not sure if 2.3 is different in this aspect.

Jake Wharton

unread,
May 1, 2014, 3:33:26 PM5/1/14
to robol...@googlegroups.com
Doubtful. Can you file a bug on GitHub for this? Let's destroy those files!
Reply all
Reply to author
Forward
0 new messages