Merge "VSDK: use relative install path when generating snapshots" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1dd392b123
@@ -328,13 +328,13 @@ var ccSnapshotAction snapshot.GenerateSnapshotAction = func(s snapshot.SnapshotS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snapshotLibOut := filepath.Join(snapshotArchDir, targetArch, libType, stem)
|
snapshotLibOut := filepath.Join(snapshotArchDir, targetArch, libType, m.RelativeInstallPath(), stem)
|
||||||
ret = append(ret, copyFile(ctx, libPath, snapshotLibOut, fake))
|
ret = append(ret, copyFile(ctx, libPath, snapshotLibOut, fake))
|
||||||
} else {
|
} else {
|
||||||
stem = ctx.ModuleName(m)
|
stem = ctx.ModuleName(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
propOut = filepath.Join(snapshotArchDir, targetArch, libType, stem+".json")
|
propOut = filepath.Join(snapshotArchDir, targetArch, libType, m.RelativeInstallPath(), stem+".json")
|
||||||
} else if m.Binary() {
|
} else if m.Binary() {
|
||||||
// binary flags
|
// binary flags
|
||||||
prop.Symlinks = m.Symlinks()
|
prop.Symlinks = m.Symlinks()
|
||||||
|
@@ -1672,3 +1672,69 @@ func TestRecoverySnapshotDirected(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSnapshotInRelativeInstallPath(t *testing.T) {
|
||||||
|
bp := `
|
||||||
|
cc_library {
|
||||||
|
name: "libvendor_available",
|
||||||
|
vendor_available: true,
|
||||||
|
nocrt: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libvendor_available_var",
|
||||||
|
vendor_available: true,
|
||||||
|
stem: "libvendor_available",
|
||||||
|
relative_install_path: "var",
|
||||||
|
nocrt: true,
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||||
|
config.TestProductVariables.DeviceVndkVersion = StringPtr("current")
|
||||||
|
config.TestProductVariables.Platform_vndk_version = StringPtr("29")
|
||||||
|
ctx := testCcWithConfig(t, config)
|
||||||
|
|
||||||
|
// Check Vendor snapshot output.
|
||||||
|
|
||||||
|
snapshotDir := "vendor-snapshot"
|
||||||
|
snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64")
|
||||||
|
snapshotSingleton := ctx.SingletonForTests("vendor-snapshot")
|
||||||
|
|
||||||
|
var jsonFiles []string
|
||||||
|
|
||||||
|
for _, arch := range [][]string{
|
||||||
|
[]string{"arm64", "armv8-a"},
|
||||||
|
[]string{"arm", "armv7-a-neon"},
|
||||||
|
} {
|
||||||
|
archType := arch[0]
|
||||||
|
archVariant := arch[1]
|
||||||
|
archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant)
|
||||||
|
|
||||||
|
// For shared libraries, only non-VNDK vendor_available modules are captured
|
||||||
|
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
|
||||||
|
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
|
||||||
|
sharedDirVar := filepath.Join(sharedDir, "var")
|
||||||
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant)
|
||||||
|
CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available_var", "libvendor_available.so", sharedDirVar, sharedVariant)
|
||||||
|
jsonFiles = append(jsonFiles,
|
||||||
|
filepath.Join(sharedDir, "libvendor_available.so.json"),
|
||||||
|
filepath.Join(sharedDirVar, "libvendor_available.so.json"))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, jsonFile := range jsonFiles {
|
||||||
|
// verify all json files exist
|
||||||
|
if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil {
|
||||||
|
t.Errorf("%q expected but not found", jsonFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fake snapshot should have all outputs in the normal snapshot.
|
||||||
|
fakeSnapshotSingleton := ctx.SingletonForTests("vendor-fake-snapshot")
|
||||||
|
for _, output := range snapshotSingleton.AllOutputs() {
|
||||||
|
fakeOutput := strings.Replace(output, "/vendor-snapshot/", "/fake/vendor-snapshot/", 1)
|
||||||
|
if fakeSnapshotSingleton.MaybeOutput(fakeOutput).Rule == nil {
|
||||||
|
t.Errorf("%q expected but not found", fakeOutput)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user