From cdc122cc2dcda9d5d1b01bc3a5bc1ae9ee1d051d Mon Sep 17 00:00:00 2001 From: Richard Uhler Date: Fri, 14 Sep 2018 16:18:06 +0100 Subject: [PATCH] Add explicit GCs to SystemMemoryTest. Bug: 111830582 Test: atest -v system-memory-test, manually confirming GC is triggered in system server. Change-Id: I8d755f8be50d1a77c4bfc68bbde67b719e11bd96 --- .../host/src/com/android/tests/sysmem/host/Cujs.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Cujs.java b/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Cujs.java index b605e62db0f22..6500428253f63 100644 --- a/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Cujs.java +++ b/tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Cujs.java @@ -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.