Run NetworkStaticLibTests on the actual source files.

Currently, NetworkStaticLibTests tests the class files that are
on the bootclasspath of the device. This makes running these
tests slow and/or confusing, because the framework must be
rebuilt and the device flashed before running the tests, and if
this is not done, the old code will be tested instead.

Instead, jarjar the tests so the test can be run without updating
the device.

Bug: 142892223
Test: atest NetworkStaticLibTests passes on device that does not have the library
Change-Id: I6a0dbebddbd0b64e2722078345ffe6b0c0a1801e
This commit is contained in:
Lorenzo Colitti 2020-01-21 15:31:06 +09:00
commit 5d9f8ed872
3 changed files with 9 additions and 0 deletions

View file

@ -40,6 +40,7 @@ java_library {
"//frameworks/opt/telephony",
"//packages/modules/NetworkStack",
"//packages/modules/CaptivePortalLogin",
"//frameworks/libs/net/common/tests:__subpackages__",
]
}
@ -53,6 +54,7 @@ java_library {
"//frameworks/opt/net/ike",
"//packages/modules/NetworkStack",
"//packages/modules/CaptivePortalLogin",
"//frameworks/libs/net/common/tests:__subpackages__",
],
}

View file

@ -6,9 +6,12 @@ android_test {
name: "NetworkStaticLibTests",
certificate: "platform",
srcs: ["src/**/*.java","src/**/*.kt"],
jarjar_rules: "jarjar-rules.txt",
test_suites: ["device-tests"],
static_libs: [
"androidx.test.rules",
"net-utils-framework-common",
"net-utils-services-common",
],
libs: [
"android.test.runner",

View file

@ -0,0 +1,4 @@
# Ensure that the tests can directly use the version of classes from the library. Otherwise, they
# will use whatever version is currently in the bootclasspath on the device running the test.
# These rules must match the jarjar rules used to build the library.
rule android.net.util.** com.android.net.module.util.@1