Dependencies of tests are also included in APEX
Shared lib dependencies of a test is included in the APEX regardless of whether the test has test_per_srcs or not. Bug: N/A Test: m (apex_test.go amended) Change-Id: I6b16843cc7467c42e250aba88d79d5580ba47324
This commit is contained in:
parent
b39e15d3f3
commit
af9539fd14
|
@ -2082,13 +2082,13 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
// We do not add this variation to `filesInfo`, as it has no output;
|
// We do not add this variation to `filesInfo`, as it has no output;
|
||||||
// however, we do add the other variations of this module as indirect
|
// however, we do add the other variations of this module as indirect
|
||||||
// dependencies (see below).
|
// dependencies (see below).
|
||||||
return true
|
|
||||||
} else {
|
} else {
|
||||||
// Single-output test module (where `test_per_src: false`).
|
// Single-output test module (where `test_per_src: false`).
|
||||||
af := apexFileForExecutable(ctx, ccTest)
|
af := apexFileForExecutable(ctx, ccTest)
|
||||||
af.class = nativeTest
|
af.class = nativeTest
|
||||||
filesInfo = append(filesInfo, af)
|
filesInfo = append(filesInfo, af)
|
||||||
}
|
}
|
||||||
|
return true // track transitive dependencies
|
||||||
} else {
|
} else {
|
||||||
ctx.PropertyErrorf("tests", "%q is not a cc module", depName)
|
ctx.PropertyErrorf("tests", "%q is not a cc module", depName)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3145,11 +3145,19 @@ func TestApexWithTests(t *testing.T) {
|
||||||
gtest: false,
|
gtest: false,
|
||||||
srcs: ["mytest.cpp"],
|
srcs: ["mytest.cpp"],
|
||||||
relative_install_path: "test",
|
relative_install_path: "test",
|
||||||
|
shared_libs: ["mylib"],
|
||||||
system_shared_libs: [],
|
system_shared_libs: [],
|
||||||
static_executable: true,
|
static_executable: true,
|
||||||
stl: "none",
|
stl: "none",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "mylib",
|
||||||
|
srcs: ["mylib.cpp"],
|
||||||
|
system_shared_libs: [],
|
||||||
|
stl: "none",
|
||||||
|
}
|
||||||
|
|
||||||
cc_test {
|
cc_test {
|
||||||
name: "mytests",
|
name: "mytests",
|
||||||
gtest: false,
|
gtest: false,
|
||||||
|
@ -3169,8 +3177,9 @@ func TestApexWithTests(t *testing.T) {
|
||||||
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
|
apexRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexRule")
|
||||||
copyCmds := apexRule.Args["copy_commands"]
|
copyCmds := apexRule.Args["copy_commands"]
|
||||||
|
|
||||||
// Ensure that test dep is copied into apex.
|
// Ensure that test dep (and their transitive dependencies) are copied into apex.
|
||||||
ensureContains(t, copyCmds, "image.apex/bin/test/mytest")
|
ensureContains(t, copyCmds, "image.apex/bin/test/mytest")
|
||||||
|
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
|
||||||
|
|
||||||
// Ensure that test deps built with `test_per_src` are copied into apex.
|
// Ensure that test deps built with `test_per_src` are copied into apex.
|
||||||
ensureContains(t, copyCmds, "image.apex/bin/test/mytest1")
|
ensureContains(t, copyCmds, "image.apex/bin/test/mytest1")
|
||||||
|
|
Loading…
Reference in New Issue