From db9a988a1b86aa795091075cd483f68e3f756b74 Mon Sep 17 00:00:00 2001 From: Felka Chang Date: Tue, 12 Oct 2021 17:35:54 +0800 Subject: [PATCH] Change OverlayHostTest to be devide_tests only. Although OverlayHostTests.jar is a java jar file, it can run on any java VM. However, all files in frameworks/core/tests/overlaytests/host should be considered as one module rather than only OverlayHostTests.jar. ag/15993030 skip tests if the certificate of "android" package in ROM is different from "android" overlay package. ag/15993030 has a logic wrong. When the device_tests run on different certificate devices, the expected result is fail instead of skip. Test: make general-tests device-tests ; \ assertFiles() { \ unzip -l "$1" | awk \ -v "expectedNumOfApk=$2" -v "expectedNumOfJar=$3" \ '$4 ~ /OverlayHostTests.jar$/ { print $4 ; numberOfJar++ } \ $4 ~ /OverlayHostTest.*.apk$/ { print $4 ; numberOfApk++ } \ END { \ if (numberOfApk != expectedNumOfApk) { print "Fail for the apk files" } \ if (numberOfJar != expectedNumOfJar) { print "Fail for the jar file" } \ }' ;\ } ;\ assertFiles "$ANDROID_PRODUCT_OUT/device-tests.zip" 8 1 ;\ assertFiles "$ANDROID_PRODUCT_OUT/general-tests.zip" 0 0 Bug: 200698485 Fixes: 202254755 Change-Id: Iaa7b4bd8ef19f1d3fedcddfaa65e45c9024777d4 --- core/tests/overlaytests/host/Android.bp | 1 - .../host/test-apps/SignatureOverlay/Android.mk | 6 +++--- .../host/test-apps/UpdateOverlay/Android.mk | 10 +++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/tests/overlaytests/host/Android.bp b/core/tests/overlaytests/host/Android.bp index 08761f6b3d9fc..634098074ccaa 100644 --- a/core/tests/overlaytests/host/Android.bp +++ b/core/tests/overlaytests/host/Android.bp @@ -27,7 +27,6 @@ java_test_host { libs: ["tradefed"], test_suites: [ "device-tests", - "general-tests", ], target_required: [ "OverlayHostTests_NonPlatformSignatureOverlay", diff --git a/core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk b/core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk index 15fb76d9a6fbe..b453cde925e40 100644 --- a/core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk +++ b/core/tests/overlaytests/host/test-apps/SignatureOverlay/Android.mk @@ -23,7 +23,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_bad include $(BUILD_PACKAGE) @@ -34,7 +34,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_CERTIFICATE := platform LOCAL_MANIFEST_FILE := static/AndroidManifest.xml LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_static @@ -47,7 +47,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_CERTIFICATE := platform LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_v1 LOCAL_AAPT_FLAGS += --version-code 1 --version-name v1 diff --git a/core/tests/overlaytests/host/test-apps/UpdateOverlay/Android.mk b/core/tests/overlaytests/host/test-apps/UpdateOverlay/Android.mk index 392125166c4af..77fc887e94931 100644 --- a/core/tests/overlaytests/host/test-apps/UpdateOverlay/Android.mk +++ b/core/tests/overlaytests/host/test-apps/UpdateOverlay/Android.mk @@ -22,7 +22,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules LOCAL_USE_AAPT2 := true LOCAL_AAPT_FLAGS := --no-resource-removal @@ -37,7 +37,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_CERTIFICATE := platform LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_v1 LOCAL_AAPT_FLAGS += --version-code 1 --version-name v1 @@ -52,7 +52,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_CERTIFICATE := platform LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_v2 LOCAL_AAPT_FLAGS += --version-code 2 --version-name v2 @@ -69,7 +69,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_v1 LOCAL_AAPT_FLAGS += --version-code 1 --version-name v1 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/app/v1/res @@ -83,7 +83,7 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../../../NOTICE LOCAL_SDK_VERSION := current -LOCAL_COMPATIBILITY_SUITE := device-tests general-tests +LOCAL_COMPATIBILITY_SUITE := device-tests LOCAL_AAPT_FLAGS := --custom-package $(my_package_prefix)_v2 LOCAL_AAPT_FLAGS += --version-code 2 --version-name v2 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/app/v2/res