Merge changes from topic "aconfig-misc-fixes-2023-09-04" into main am: 6c4627369e am: 6a5b171816 am: 73039bc572

Original change: https://android-review.googlesource.com/c/platform/build/+/2738374

Change-Id: I8669bdd4e4a7857b3bec3399dccf29ef274c8e6b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-09-05 19:44:07 +00:00
committed by Automerger Merge Worker
3 changed files with 17 additions and 4 deletions

View File

@@ -215,6 +215,17 @@ pub mod parsed_flag {
super::tracepoint::verify_fields(tp)?; super::tracepoint::verify_fields(tp)?;
} }
ensure!(pf.bug.len() == 1, "bad flag declaration: exactly one bug required"); ensure!(pf.bug.len() == 1, "bad flag declaration: exactly one bug required");
if pf.is_fixed_read_only() {
ensure!(
pf.permission() == ProtoFlagPermission::READ_ONLY,
"bad parsed flag: flag is is_fixed_read_only but permission is not READ_ONLY"
);
for tp in pf.trace.iter() {
ensure!(tp.permission() == ProtoFlagPermission::READ_ONLY,
"bad parsed flag: flag is is_fixed_read_only but a tracepoint's permission is not READ_ONLY"
);
}
}
Ok(()) Ok(())
} }
@@ -547,7 +558,7 @@ parsed_flag {
description: "This is the description of the second flag." description: "This is the description of the second flag."
bug: "SOME_BUG" bug: "SOME_BUG"
state: ENABLED state: ENABLED
permission: READ_WRITE permission: READ_ONLY
trace { trace {
source: "flags.declarations" source: "flags.declarations"
state: DISABLED state: DISABLED
@@ -556,7 +567,7 @@ parsed_flag {
trace { trace {
source: "flags.values" source: "flags.values"
state: ENABLED state: ENABLED
permission: READ_WRITE permission: READ_ONLY
} }
is_fixed_read_only: true is_fixed_read_only: true
} }
@@ -570,14 +581,14 @@ parsed_flag {
assert_eq!(second.description(), "This is the description of the second flag."); assert_eq!(second.description(), "This is the description of the second flag.");
assert_eq!(second.bug, vec!["SOME_BUG"]); assert_eq!(second.bug, vec!["SOME_BUG"]);
assert_eq!(second.state(), ProtoFlagState::ENABLED); assert_eq!(second.state(), ProtoFlagState::ENABLED);
assert_eq!(second.permission(), ProtoFlagPermission::READ_WRITE); assert_eq!(second.permission(), ProtoFlagPermission::READ_ONLY);
assert_eq!(2, second.trace.len()); assert_eq!(2, second.trace.len());
assert_eq!(second.trace[0].source(), "flags.declarations"); assert_eq!(second.trace[0].source(), "flags.declarations");
assert_eq!(second.trace[0].state(), ProtoFlagState::DISABLED); assert_eq!(second.trace[0].state(), ProtoFlagState::DISABLED);
assert_eq!(second.trace[0].permission(), ProtoFlagPermission::READ_ONLY); assert_eq!(second.trace[0].permission(), ProtoFlagPermission::READ_ONLY);
assert_eq!(second.trace[1].source(), "flags.values"); assert_eq!(second.trace[1].source(), "flags.values");
assert_eq!(second.trace[1].state(), ProtoFlagState::ENABLED); assert_eq!(second.trace[1].state(), ProtoFlagState::ENABLED);
assert_eq!(second.trace[1].permission(), ProtoFlagPermission::READ_WRITE); assert_eq!(second.trace[1].permission(), ProtoFlagPermission::READ_ONLY);
assert!(second.is_fixed_read_only()); assert!(second.is_fixed_read_only());
// valid input: empty // valid input: empty

View File

@@ -1,3 +1,4 @@
#[cfg(not(feature = "cargo"))]
#[test] #[test]
fn test_flags() { fn test_flags() {
assert!(!aconfig_test_rust_library::disabled_ro()); assert!(!aconfig_test_rust_library::disabled_ro());

View File

@@ -1,3 +1,4 @@
#[cfg(not(feature = "cargo"))]
#[test] #[test]
fn test_flags() { fn test_flags() {
assert!(!aconfig_test_rust_library::disabled_ro()); assert!(!aconfig_test_rust_library::disabled_ro());