Skip to content
Snippets Groups Projects
Commit 0015f04e authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Do not apply jarjar rules on intermediate libs

Using jarjar on intermediate libraries causes issues when they are
combined with other libraries that use different jarjar rules, as the
resulting binary may contain multiple incompatible copies of the
classes. Instead, jarjar should be used on the final artifact, after
combining the libraries.

Ensure NetworkStackJarJarRules is not applied on intermediate libraries
like TetheringIntegrationTestsLib, but instead apply it on
TetheringIntegrationTests or CtsTetheringTest.

Bug: 192535368
Test: atest TetheringCoverageTests TetheringIntegrationTests \
          CtsTetheringTest
Change-Id: I248a533651984de81f676336c0e74e3788610bbb
parent 93bda739
No related branches found
No related tags found
No related merge requests found
......@@ -41,9 +41,10 @@ java_defaults {
"libdexmakerjvmtiagent",
"libstaticjvmtiagent",
],
jarjar_rules: ":NetworkStackJarJarRules",
}
// Library including tethering integration tests targeting the latest stable SDK.
// Use with NetworkStackJarJarRules.
android_library {
name: "TetheringIntegrationTestsLatestSdkLib",
target_sdk_version: "30",
......@@ -56,6 +57,8 @@ android_library {
]
}
// Library including tethering integration tests targeting current development SDK.
// Use with NetworkStackJarJarRules.
android_library {
name: "TetheringIntegrationTestsLib",
target_sdk_version: "current",
......@@ -76,6 +79,7 @@ android_test {
"mts",
],
compile_multilib: "both",
jarjar_rules: ":NetworkStackJarJarRules",
}
android_library {
......@@ -88,13 +92,33 @@ android_library {
"TetheringTestsLatestSdkLib",
"TetheringIntegrationTestsLatestSdkLib",
],
jarjar_rules: ":TetheringTestsJarJarRules",
// Jarjar rules should normally be applied on final artifacts and not intermediate libraries as
// applying different rules on intermediate libraries can cause conflicts when combining them
// (the resulting artifact can end up with multiple incompatible implementations of the same
// classes). But this library is used to combine tethering coverage tests with connectivity
// coverage tests into a single coverage target. The tests need to use the same jarjar rules as
// covered production code for coverage to be calculated properly, so jarjar is applied
// separately on each set of tests.
jarjar_rules: ":TetheringCoverageJarJarRules",
manifest: "AndroidManifest_coverage.xml",
visibility: [
"//packages/modules/Connectivity/tests:__subpackages__"
],
}
// Combine NetworkStack and Tethering jarjar rules for coverage target. The jarjar files are
// simply concatenated in the order specified in srcs.
genrule {
name: "TetheringCoverageJarJarRules",
srcs: [
":TetheringTestsJarJarRules",
":NetworkStackJarJarRules",
],
out: ["jarjar-rules-tethering-coverage.txt"],
cmd: "cat $(in) > $(out)",
visibility: ["//visibility:private"],
}
// Special version of the tethering tests that includes all tests necessary for code coverage
// purposes. This is currently the union of TetheringTests, TetheringIntegrationTests and
// NetworkStackTests.
......
......@@ -17,3 +17,8 @@ rule com.android.net.module.util.** com.android.networkstack.tethering.util.@1
# TestableLooper from "testables" can be used instead of TestLooper from frameworks-base-testutils.
zap android.os.test.TestLooperTest*
zap com.android.test.filters.SelectTestTests*
# When used in combined test suites like ConnectivityCoverageTests, these test jarjar rules are
# combined with the jarjar-rules.txt of other included modules (like NetworkStack jarjar rules).
# They will effectively be added after the following line break. Note that jarjar stops at the first
# matching rule, so any rule in this file takes precedence over rules in the following ones.
......@@ -71,6 +71,7 @@ android_test {
// Include both the 32 and 64 bit versions
compile_multilib: "both",
jarjar_rules: ":NetworkStackJarJarRules",
}
// Tethering CTS tests for development and release. These tests always target the platform SDK
......@@ -95,4 +96,5 @@ android_test {
// Include both the 32 and 64 bit versions
compile_multilib: "both",
jarjar_rules: ":NetworkStackJarJarRules",
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment