From a97f246bdbebb9fb823501937308b0f2bbf285ac Mon Sep 17 00:00:00 2001 From: Victor Hsieh Date: Wed, 11 Jan 2023 22:47:58 -0800 Subject: Add tests for preload and APEX measurement A new host-side test "BinaryTransparencyHostTest" is added to drive the actual test on device. The host can be used to set up the testing environment (e.g. update a preload, or later install MBA), then ask the helper app "BinaryTransparencyTestApp" to verify returned value of private APIs in the main service. Since the APIs are private (@hide, because we're not ready to make anything public yet), the (bundled) helper app needs to be compiled with `platform_apis: true`. Plus, since the service is not accessible to apps by sepolicy, the test has to run with SELinux disabled. An alternative is to add a userdebug_or_eng rule in sepolicy, but it's better to avoid adding rule for one specific test, and isolate the setup here (in AndroidTest.xml). The test is not yet added to TEST_MAPPING/presubmit. Once it runs successfully for a few runs in postsubmit, we should graduate it to presubmit. Test: atest BinaryTransparencyHostTest Test: atest BinaryTransparencyServiceTest Bug: 265244016 Change-Id: Ibd87f4cf6a2ae989ddfa8eaf9494cff5d34005ed --- tests/BinaryTransparencyHostTest/Android.bp | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/BinaryTransparencyHostTest/Android.bp (limited to 'tests/BinaryTransparencyHostTest/Android.bp') diff --git a/tests/BinaryTransparencyHostTest/Android.bp b/tests/BinaryTransparencyHostTest/Android.bp new file mode 100644 index 000000000000..142e3ddf9fe7 --- /dev/null +++ b/tests/BinaryTransparencyHostTest/Android.bp @@ -0,0 +1,42 @@ +// Copyright (C) 2023 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_base_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["frameworks_base_license"], +} + +java_test_host { + name: "BinaryTransparencyHostTest", + srcs: ["src/**/*.java"], + libs: [ + "tradefed", + "compatibility-tradefed", + "compatibility-host-util", + ], + static_libs: [ + "truth-prebuilt", + ], + data: [ + ":BinaryTransparencyTestApp", + ":EasterEgg", + ], + test_suites: [ + "general-tests", + ], +} -- cgit v1.2.3-59-g8ed1b