Merge "Add tests for custom canned_fs_config."
This commit is contained in:
commit
0cefc0cbc4
2 changed files with 49 additions and 6 deletions
13
apex/apex.go
13
apex/apex.go
|
@ -103,12 +103,13 @@ type apexBundleProperties struct {
|
|||
// to avoid mistakes. When set as true, no force-labelling.
|
||||
Use_file_contexts_as_is *bool
|
||||
|
||||
// Path to the canned fs config file for customizing file's uid/gid/mod/capabilities. The
|
||||
// format is /<path_or_glob> <uid> <gid> <mode> [capabilities=0x<cap>], where path_or_glob is a
|
||||
// path or glob pattern for a file or set of files, uid/gid are numerial values of user ID
|
||||
// and group ID, mode is octal value for the file mode, and cap is hexadecimal value for the
|
||||
// capability. If this property is not set, or a file is missing in the file, default config
|
||||
// is used.
|
||||
// Path to the canned fs config file for customizing file's
|
||||
// uid/gid/mod/capabilities. The content of this file is appended to the
|
||||
// default config, so that the custom entries are preferred. The format is
|
||||
// /<path_or_glob> <uid> <gid> <mode> [capabilities=0x<cap>], where
|
||||
// path_or_glob is a path or glob pattern for a file or set of files,
|
||||
// uid/gid are numerial values of user ID and group ID, mode is octal value
|
||||
// for the file mode, and cap is hexadecimal value for the capability.
|
||||
Canned_fs_config *string `android:"path"`
|
||||
|
||||
ApexNativeDependencies
|
||||
|
|
|
@ -10105,3 +10105,45 @@ func TestTrimmedApex(t *testing.T) {
|
|||
android.AssertStringDoesContain(t, "missing lib to trim", libs_to_trim, "libbar")
|
||||
android.AssertStringDoesNotContain(t, "unexpected libs in the libs to trim", libs_to_trim, "libbaz")
|
||||
}
|
||||
|
||||
func TestCannedFsConfig(t *testing.T) {
|
||||
ctx := testApex(t, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
updatable: false,
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}`)
|
||||
mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
|
||||
generateFsRule := mod.Rule("generateFsConfig")
|
||||
cmd := generateFsRule.RuleParams.Command
|
||||
|
||||
ensureContains(t, cmd, `( echo '/ 1000 1000 0755'; echo '/apex_manifest.json 1000 1000 0644'; echo '/apex_manifest.pb 1000 1000 0644'; ) >`)
|
||||
}
|
||||
|
||||
func TestCannedFsConfig_HasCustomConfig(t *testing.T) {
|
||||
ctx := testApex(t, `
|
||||
apex {
|
||||
name: "myapex",
|
||||
key: "myapex.key",
|
||||
canned_fs_config: "my_config",
|
||||
updatable: false,
|
||||
}
|
||||
|
||||
apex_key {
|
||||
name: "myapex.key",
|
||||
public_key: "testkey.avbpubkey",
|
||||
private_key: "testkey.pem",
|
||||
}`)
|
||||
mod := ctx.ModuleForTests("myapex", "android_common_myapex_image")
|
||||
generateFsRule := mod.Rule("generateFsConfig")
|
||||
cmd := generateFsRule.RuleParams.Command
|
||||
|
||||
// Ensure that canned_fs_config has "cat my_config" at the end
|
||||
ensureContains(t, cmd, `( echo '/ 1000 1000 0755'; echo '/apex_manifest.json 1000 1000 0644'; echo '/apex_manifest.pb 1000 1000 0644'; cat my_config ) >`)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue