diff options
| -rw-r--r-- | tools/ahat/Android.mk | 1 | ||||
| -rw-r--r-- | tools/ahat/AndroidTest.xml | 21 | ||||
| -rw-r--r-- | tools/ahat/etc/ahat-tests.mf | 2 | ||||
| -rw-r--r-- | tools/ahat/src/main/com/android/ahat/Main.java | 4 | ||||
| -rw-r--r-- | tools/ahat/src/test/com/android/ahat/AhatTestSuite.java (renamed from tools/ahat/src/test/com/android/ahat/Tests.java) | 42 |
5 files changed, 48 insertions, 22 deletions
diff --git a/tools/ahat/Android.mk b/tools/ahat/Android.mk index ad33233159..9f423ba76d 100644 --- a/tools/ahat/Android.mk +++ b/tools/ahat/Android.mk @@ -147,6 +147,7 @@ LOCAL_STATIC_JAVA_LIBRARIES := ahat junit-host LOCAL_IS_HOST_MODULE := true LOCAL_MODULE_TAGS := tests LOCAL_MODULE := ahat-tests +LOCAL_COMPATIBILITY_SUITE := general-tests include $(BUILD_HOST_JAVA_LIBRARY) AHAT_TEST_JAR := $(LOCAL_BUILT_MODULE) diff --git a/tools/ahat/AndroidTest.xml b/tools/ahat/AndroidTest.xml new file mode 100644 index 0000000000..867658cf5e --- /dev/null +++ b/tools/ahat/AndroidTest.xml @@ -0,0 +1,21 @@ +<?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. +--> +<configuration description="Runs the ahat unit tests"> + <option name="null-device" value="true" /> + <test class="com.android.tradefed.testtype.HostTest" > + <option name="class" value="com.android.ahat.AhatTestSuite" /> + </test> +</configuration> diff --git a/tools/ahat/etc/ahat-tests.mf b/tools/ahat/etc/ahat-tests.mf index af17fadded..48fdeb3a01 100644 --- a/tools/ahat/etc/ahat-tests.mf +++ b/tools/ahat/etc/ahat-tests.mf @@ -1 +1 @@ -Main-Class: com.android.ahat.Tests +Main-Class: com.android.ahat.AhatTestSuite diff --git a/tools/ahat/src/main/com/android/ahat/Main.java b/tools/ahat/src/main/com/android/ahat/Main.java index 04a6012a61..af197d4862 100644 --- a/tools/ahat/src/main/com/android/ahat/Main.java +++ b/tools/ahat/src/main/com/android/ahat/Main.java @@ -102,7 +102,7 @@ public class Main { i++; try { map.readFromFile(new File(args[i])); - } catch (IOException|ParseException ex) { + } catch (IOException | ParseException ex) { System.out.println("Unable to read proguard map: " + ex); System.out.println("The proguard map will not be used."); } @@ -110,7 +110,7 @@ public class Main { i++; try { mapbase.readFromFile(new File(args[i])); - } catch (IOException|ParseException ex) { + } catch (IOException | ParseException ex) { System.out.println("Unable to read baseline proguard map: " + ex); System.out.println("The proguard map will not be used."); } diff --git a/tools/ahat/src/test/com/android/ahat/Tests.java b/tools/ahat/src/test/com/android/ahat/AhatTestSuite.java index 0e7043291d..bce1f053be 100644 --- a/tools/ahat/src/test/com/android/ahat/Tests.java +++ b/tools/ahat/src/test/com/android/ahat/AhatTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015 The Android Open Source Project + * 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. @@ -17,28 +17,32 @@ package com.android.ahat; import org.junit.runner.JUnitCore; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; -public class Tests { +@RunWith(Suite.class) +@Suite.SuiteClasses({ + DiffFieldsTest.class, + DiffTest.class, + DominatorsTest.class, + HtmlEscaperTest.class, + InstanceTest.class, + NativeAllocationTest.class, + ObjectHandlerTest.class, + OverviewHandlerTest.class, + PerformanceTest.class, + ProguardMapTest.class, + RootedHandlerTest.class, + QueryTest.class, + SiteHandlerTest.class, + SiteTest.class +}) + +public class AhatTestSuite { public static void main(String[] args) { if (args.length == 0) { - args = new String[]{ - "com.android.ahat.DiffFieldsTest", - "com.android.ahat.DiffTest", - "com.android.ahat.DominatorsTest", - "com.android.ahat.HtmlEscaperTest", - "com.android.ahat.InstanceTest", - "com.android.ahat.NativeAllocationTest", - "com.android.ahat.ObjectHandlerTest", - "com.android.ahat.OverviewHandlerTest", - "com.android.ahat.PerformanceTest", - "com.android.ahat.ProguardMapTest", - "com.android.ahat.RootedHandlerTest", - "com.android.ahat.QueryTest", - "com.android.ahat.SiteHandlerTest", - "com.android.ahat.SiteTest", - }; + args = new String[]{"com.android.ahat.AhatTestSuite"}; } JUnitCore.main(args); } } - |