Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9444bf9 authored by Richard Uhler's avatar Richard Uhler
Browse files

Initial setup of a SystemMemoryTest.

Set up a memory test to experiment with actionable memory metrics and
detect regressions in system server memory use.

The initial CUJ is to launch an instrumentation that does nothing for
a few seconds.

The initial metric is to read showmap for system_server and report
VSS, RSS, and PSS.

The CUJ and metrics will be made more interesting once the basic
infrastructure for continuously running the test is set up.

Bug: 111830582
Test: tradefed.sh run commandAndExit template/local_min --template:map test=system-memory-test

Change-Id: I8793adb66de4adab254173585e2c8afc754d4a3a
parent 9a64ba26
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH:= $(call my-dir)

include $(call all-subdir-makefiles)
+21 −0
Original line number Diff line number Diff line
This directory contains a test for system server memory use.

Directory structure
===================
device
  - those parts of the test that run on device.

host
  - those parts of the test that run on host.

Running the test
================

You can manually run the test as follows:

  make tradefed-all system-memory-test SystemMemoryTestDevice
  tradefed.sh run commandAndExit template/local_min --template:map test=system-memory-test

This installs and runs the test on device. You can see the metrics in the
tradefed output.
+24 −0
Original line number Diff line number Diff line
# Copyright (C) 2018 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_PACKAGE_NAME := SystemMemoryTestDevice
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_COMPATIBILITY_SUITE := general-tests
include $(BUILD_PACKAGE)
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.tests.sysmem.device">

    <uses-sdk android:minSdkVersion="19" />

    <instrumentation
            android:name="com.android.tests.sysmem.device.Cujs"
            android:targetPackage="com.android.tests.sysmem.device" />

    <application
            android:allowBackup="false"
            android:label="System Memory Test">
    </application>
</manifest>
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.tests.sysmem.device;

import android.app.Activity;
import android.app.Instrumentation;
import android.os.Bundle;
import android.util.Log;

/**
 * Critical user journeys used to exercise the system for test, driven from
 * the device.
 */
public class Cujs extends Instrumentation {

    private static final String TAG = "SystemMemoryTest";

    @Override
    public void onCreate(Bundle arguments) {
        start();
    }

    @Override
    public void onStart() {
        // TODO: Exercise the system in more interesting ways.
        // Mostly what matters is that whatever we do here is sustainable: it
        // can be repeated indefinitely on the system without causing
        // problems.  For example, launching activities is fine. Installing
        // applications is only fine if we also uninstall them as part of the
        // test.
        try {
            Log.i(TAG, "Sleeping for 10 seconds...");
            Thread.sleep(10 * 1000);
        } catch (InterruptedException ignored) {
        }

        finish(Activity.RESULT_OK, null);
    }
}
Loading