Add a NetworkStackCoverageTests target.
This target will include all tests that are necessary to calculate
code coverage of the network stack. It is currently the union of
NetworkStackTests and NetworkStackIntegrationTests
Also apply jarjar rules on top of NetworkStackIntegrationTests and
NetworkStackTests, to make sure that the test classes (and not the
framework classes) are used during the test. This requires the tests to
stop using external (hidden) references to classes in
com.android.internal, as the references would be broken when applying
jarjar.
Test: atest NetworkStackIntegrationTests NetworkStackTests \
NetworkStackCoverageTests
Change-Id: Ib945cb9faa960862593a6ac2ac26058948e777a4
diff --git a/tests/unit/Android.bp b/tests/unit/Android.bp
index 9209dc4..bdb2d74 100644
--- a/tests/unit/Android.bp
+++ b/tests/unit/Android.bp
@@ -38,8 +38,10 @@
"libstaticjvmtiagent",
"libnetworkstackutilsjni",
],
+ jarjar_rules: ":NetworkStackJarJarRules",
}
+// Tests for NetworkStackNext.
android_test {
name: "NetworkStackNextTests",
srcs: [], // TODO: tests that only apply to the current, non-stable API can be added here
@@ -48,6 +50,17 @@
static_libs: ["NetworkStackApiCurrentLib"],
}
+// Library containing the unit tests. This is used by the coverage test target to pull in the
+// unit test code. It is not currently used by the tests themselves because all the build
+// configuration needed by the tests is in the NetworkStackTestsDefaults rule.
+android_library {
+ name: "NetworkStackTestsLib",
+ min_sdk_version: "29",
+ defaults: ["NetworkStackTestsDefaults"],
+ static_libs: ["NetworkStackApiStableLib"],
+ visibility: ["//packages/modules/NetworkStack/tests/integration"]
+}
+
android_test {
name: "NetworkStackTests",
min_sdk_version: "29",