Expand the number of signature tests
Replaces CtsApiSignatureTestCases which tests whether the runtime seen
by an app that has <uses-library android:name="android.test.runner"/> in
its manifest provides the API in frameworks/bases/api/current.txt with a
number of tests that test different app configurations.
CtsCurrentApiSignatureTestCases
tests that an app that is targeted at the current API level and does
not have any <uses-library> entries in its manifest can access the
API described in frameworks/base/api/current.txt - excluding APIs
provided by the android.test.runner and android.test.mock libraries.
CtsSystemCurrentApiSignatureTestCases
tests that an app that is targeted at the current API level and does
not have any <uses-library> entries in its manifest can access the
API described in frameworks/base/api/system-current.txt - excluding
APIs provided by the android.test.runner and android.test.mock
libraries.
CtsAndroidTestMockCurrentApiSignatureTestCases
tests that an app that is targeted at the current API level and has
<uses-library android:name="android.test.mock"/> in its manifest can
access the API described in
frameworks/base/test-runner/api/android-test-mock-current.txt.
CtsAndroidTestRunnerCurrentApiSignatureTestCases
tests that an app that is targeted at the current API level and has
<uses-library android:name="android.test.runner"/> in its manifest
can access the API described in
frameworks/base/test-runner/api/android-test-runner-current.txt and
in frameworks/base/test-runner/api/android-test-mock-current.txt.
CtsLegacyTest26ApiSignatureTestCases
tests that an app that is targeted at API level 26 can access the
API described in
frameworks/base/legacy-test/api/legacy-test-current.txt.
Adds tests/signature/runSignatureTests.sh to run the above tests.
The rest of the changes are made to support the above tests:
* Changes SignatureTest and other Java files to support providing an API
description file containing classes that are not expected to be
accessible to the application. This is used to ensure that optional
classes are not visible unless specifically requested.
* Generates additional *.api files for use by the above tests.
* Refactors the makefiles for generating *.api files and building test
APKs to extract the common behavior into separate reusable *.mk files
to reduce duplication.
Bug: 35192974
Bug: 30188076
Test: ran tests/signature/runSignatureTests.sh
Change-Id: Ibb178052a6098e4b42921067ae8ec86d6e7cb379
diff --git a/tests/signature/api-check/legacy-test-26-api/AndroidTest.xml b/tests/signature/api-check/legacy-test-26-api/AndroidTest.xml
new file mode 100644
index 0000000..ad30330
--- /dev/null
+++ b/tests/signature/api-check/legacy-test-26-api/AndroidTest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 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="Config for CTS API Signature test cases">
+ <option name="config-descriptor:metadata" key="component" value="systems" />
+ <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+ <option name="run-command" value="mkdir -p /data/local/tmp/signature-test" />
+ <option name="teardown-command" value="rm -rf /data/local/tmp/signature-test" />
+ </target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <option name="push" value="legacy-test-current.api->/data/local/tmp/signature-test/legacy-test-current.api" />
+ </target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsLegacyTest26ApiSignatureTestCases.apk" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="android.signature.cts.api.legacy_test_26" />
+ <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
+ <option name="instrumentation-arg" key="expected-api-files" value="legacy-test-current.api" />
+ <option name="runtime-hint" value="5s" />
+ </test>
+</configuration>