Add explicit GCs to SystemMemoryTest.

Bug: 111830582
Test: atest -v system-memory-test, manually confirming GC is triggered
      in system server.

Change-Id: I8d755f8be50d1a77c4bfc68bbde67b719e11bd96
This commit is contained in:
Richard Uhler
2018-09-14 16:18:06 +01:00
parent 1d5a713743
commit cdc122cc2d

View File

@@ -31,6 +31,12 @@ public class Cujs {
* Runs the critical user journeys.
*/
public void run() throws TestException {
// Do an explicit GC in the system server process as part of the test
// case to reduce GC-related sources of noise.
// SIGUSR1 = 10 is the magic signal to trigger the GC.
int pid = mDevice.getPidForProcess("system_server");
mDevice.executeShellCommand("kill -10 " + pid);
// Invoke the Device Cujs instrumentation to run the cujs.
// TODO: Consider exercising the system in other interesting ways as
// well.