diff --git a/wlauto/workloads/androbench/__init__.py b/wlauto/workloads/androbench/__init__.py new file mode 100644 index 00000000..861fe45a --- /dev/null +++ b/wlauto/workloads/androbench/__init__.py @@ -0,0 +1,43 @@ +# Copyright 2013-2015 ARM Limited +# +# 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. +# + + +import os +import sqlite3 +from wlauto import AndroidUiAutoBenchmark + + +class Androbench(AndroidUiAutoBenchmark): + name = 'androbench' + description = """Androbench measures the storage performance of device""" + package = 'com.andromeda.androbench2' + activity = '.main' + run_timeout = 10 * 60 + + def update_result(self, context): + super(Androbench, self).update_result(context) + dbn = 'databases/history.db' + db = self.device.path.join(self.device.package_data_directory, self.package, dbn) + host_results = os.path.join(context.output_directory, 'history.db') + self.device.pull_file(db, host_results, as_root=True) + qs = 'select * from history' + conn = sqlite3.connect(host_results) + c = conn.cursor() + c.execute(qs) + results = c.fetchone() + context.result.add_metric('Sequential Read ', results[8], 'MB/s') + context.result.add_metric('Sequential Write ', results[9], 'MB/s') + context.result.add_metric('Random Read ', results[10], 'MB/s') + context.result.add_metric('Random Write ', results[12], 'MB/s') diff --git a/wlauto/workloads/androbench/com.arm.wlauto.uiauto.androbench.jar b/wlauto/workloads/androbench/com.arm.wlauto.uiauto.androbench.jar new file mode 100644 index 00000000..d047faf2 Binary files /dev/null and b/wlauto/workloads/androbench/com.arm.wlauto.uiauto.androbench.jar differ diff --git a/wlauto/workloads/androbench/uiauto/build.sh b/wlauto/workloads/androbench/uiauto/build.sh new file mode 100755 index 00000000..2bec8695 --- /dev/null +++ b/wlauto/workloads/androbench/uiauto/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 2013-2015 ARM Limited +# +# 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. +# + + + +class_dir=bin/classes/com/arm/wlauto/uiauto +base_class=`python -c "import os, wlauto; print os.path.join(os.path.dirname(wlauto.__file__), 'common', 'android', 'BaseUiAutomation.class')"` +mkdir -p $class_dir +cp $base_class $class_dir + +ant build + +if [[ -f bin/com.arm.wlauto.uiauto.androbench.jar ]]; then + cp bin/com.arm.wlauto.uiauto.androbench.jar .. +fi diff --git a/wlauto/workloads/androbench/uiauto/build.xml b/wlauto/workloads/androbench/uiauto/build.xml new file mode 100644 index 00000000..6293990f --- /dev/null +++ b/wlauto/workloads/androbench/uiauto/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wlauto/workloads/androbench/uiauto/project.properties b/wlauto/workloads/androbench/uiauto/project.properties new file mode 100644 index 00000000..a3ee5ab6 --- /dev/null +++ b/wlauto/workloads/androbench/uiauto/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-17 diff --git a/wlauto/workloads/androbench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java b/wlauto/workloads/androbench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java new file mode 100644 index 00000000..dd621aad --- /dev/null +++ b/wlauto/workloads/androbench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java @@ -0,0 +1,67 @@ +/* Copyright 2013-2015 ARM Limited + * + * 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.arm.wlauto.uiauto.androbench; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; + +// Import the uiautomator libraries +import com.android.uiautomator.core.UiObject; +import com.android.uiautomator.core.UiObjectNotFoundException; +import com.android.uiautomator.core.UiScrollable; +import com.android.uiautomator.core.UiSelector; +import com.android.uiautomator.testrunner.UiAutomatorTestCase; + +import com.arm.wlauto.uiauto.BaseUiAutomation; + +public class UiAutomation extends BaseUiAutomation { + + public static String TAG = "androbench"; + + public void runUiAutomation() throws Exception { + Bundle status = new Bundle(); + status.putString("product", getUiDevice().getProductName()); + UiSelector selector = new UiSelector(); + sleep(3); + UiObject btn_microbench = new UiObject(selector .textContains("Micro") + .className("android.widget.Button")); + btn_microbench.click(); + + UiObject btn_yes= new UiObject(selector .textContains("Yes") + .className("android.widget.Button")); + btn_yes.click(); + + + try{ + UiObject complete_text = new UiObject(selector .text("Cancel") + .className("android.widget.Button")); + + waitObject(complete_text); + + sleep(2); + complete_text.click(); + } finally{ + //complete_text.click(); + } + + sleep(5); + takeScreenshot("Androbench"); + getAutomationSupport().sendStatus(Activity.RESULT_OK, status); + } + +}