summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Uhler <ruhler@google.com>2018-09-14 16:18:06 +0100
committerRichard Uhler <ruhler@google.com>2018-09-17 14:21:48 +0100
commitcdc122cc2dcda9d5d1b01bc3a5bc1ae9ee1d051d (patch)
treec69f772d9da35ec39c75c5fd9488e07ce797a5cb
parent1d5a71374361661db2dcc0fa49de4ad9b2a7ec30 (diff)
Add explicit GCs to SystemMemoryTest.
Bug: 111830582 Test: atest -v system-memory-test, manually confirming GC is triggered in system server. Change-Id: I8d755f8be50d1a77c4bfc68bbde67b719e11bd96
-rw-r--r--tests/SystemMemoryTest/host/src/com/android/tests/sysmem/host/Cujs.java6
1 files changed, 6 insertions, 0 deletions
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 b605e62db0f2..6500428253f6 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.