Skip to content
Commit 1017a134 authored by Bjorn Bringert's avatar Bjorn Bringert
Browse files

Clean up after failed MemoryFileTest.testPurge()

MemoryFileTest.testPurge() can fail if the process runs
out of file descriptors before the kernel starts purging ashmem areas.
Before, there was no finally block to close the open ashmem
file descriptions, which caused random other tests to fail.

I also changed the size of the memory areas to 10MB, which
should cause it to run out of memory before it runs out of file
descriptors. It now fails with this instead:

java.io.IOException
	at android.os.MemoryFile.native_pin(Native Method)
	at android.os.MemoryFile.allowPurging(MemoryFile.java:189)
	at android.os.MemoryFileTest.testPurge(MemoryFileTest.java:53)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)

I'm not sure why, but it could be that the kernel is purging the just
allocated area instead of an old one. That seems like bug.

See http://b/issue?id=2203775

Change-Id: Ia7930a714378474dd4c2c6709da40c08e715ab6f
parent cf06dd0a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment