android_system_core/fs_mgr/tests/Android.bp
Yi-Yo Chiang 79ad1e2e9b init: Unify kernel bootconfig parser with libfs_mgr
Right now there are two bootconfig parsers that gets linked into `init`.
One is from libinit itself and the other is from libfs_mgr.

The one in libinit removes all space characters between list elements,
so `key = "val1", "val2"` gets unquoted and squeezed into:
  `key=val1,val2`
The one in libfs_mgr doesn't remove spaces, it only unquotes:
  `key=val1, val2`

The libinit behavior is due to existing systems (such as sysprop)
expect the config value to be in the same format as kernel cmdline.
(aosp/1757971)
THe libfs_mgr behavior is due to the `androidboot.boot_device[s]`
format explicitly allows quoted comma appear in its list value, thus
relies on space, not comma, as the list value delimeter.

This commit merges the two parsers into libfs_mgr. Since all usages in
libfs_mgr besides `boot_device[s]` do not care about how list value are
delimited, and most usages in init expects the bootconfig value format
to be the same format as cmdline. We just special case the
`boot_device` scenario.

Also harden the test cases to cover all the different config value
format and expected result.

Note:
The format of kernel bootconfig is described here
https://docs.kernel.org/admin-guide/bootconfig.html

Bug: 293695109
Test: CtsFsMgrTestCases
Change-Id: I42b9bf626e8de38a60e8e09fac0693126b7efd91
2023-08-02 09:57:37 +00:00

116 lines
2.3 KiB
Text

// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_test {
name: "CtsFsMgrTestCases",
test_suites: [
"cts",
"device-tests",
],
compile_multilib: "both",
multilib: {
lib32: {
suffix: "32",
},
lib64: {
suffix: "64",
},
},
shared_libs: [
"libbase",
"liblog",
],
static_libs: [
"libfs_mgr",
"libgmock",
"libgtest",
],
srcs: [
"file_wait_test.cpp",
"fs_mgr_test.cpp",
],
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
}
sh_binary_host {
name: "adb-remount-test",
src: "adb-remount-test.sh",
filename_from_src: true,
target: {
darwin: {
enabled: false,
},
windows: {
enabled: false,
},
},
}
sh_test {
name: "adb-remount-sh",
src: "adb-remount-test.sh",
filename_from_src: true,
test_suites: ["general-tests"],
test_config: "adb-remount-sh.xml",
}
java_test_host {
name: "fs_mgr_vendor_overlay_test",
srcs: ["src/**/VendorOverlayHostTest.java"],
libs: ["tradefed"],
test_config: "vendor-overlay-test.xml",
test_suites: ["general-tests"],
}
cc_test {
name: "vts_fs_test",
test_suites: [
"vts",
"device-tests",
],
test_options: {
min_shipping_api_level: 29,
},
require_root: true,
auto_gen_config: true,
cflags: [
"-Wall",
"-Werror",
],
srcs: [
"vts_fs_test.cpp",
],
shared_libs: [
"libbase",
],
static_libs: [
"libfs_mgr",
"libgmock",
"libgtest",
],
}