Merge "aconfig: update flag info query api" into main am: 65610a10d5 am: 625fd83d28

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

Change-Id: I37c178584c264b7fc8dbd0f12664996dcb4f74bf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Dennis Shen 2024-04-12 18:24:50 +00:00 committed by Automerger Merge Worker
commit b835cfefe0
10 changed files with 121 additions and 65 deletions

View file

@ -106,6 +106,19 @@ Result<MappedStorageFile> get_mapped_file_impl(
} // namespace private internal api
/// Map from StoredFlagType to FlagValueType
android::base::Result<FlagValueType> map_to_flag_value_type(
StoredFlagType stored_type) {
switch (stored_type) {
case StoredFlagType::ReadWriteBoolean:
case StoredFlagType::ReadOnlyBoolean:
case StoredFlagType::FixedReadOnlyBoolean:
return FlagValueType::Boolean;
default:
return Error() << "Unsupported stored flag type";
}
}
/// Get mapped storage file
Result<MappedStorageFile> get_mapped_file(
std::string const& container,
@ -178,12 +191,14 @@ Result<bool> get_boolean_flag_value(
}
/// Get boolean flag attribute
Result<uint8_t> get_boolean_flag_attribute(
Result<uint8_t> get_flag_attribute(
MappedStorageFile const& file,
FlagValueType value_type,
uint32_t index) {
auto content = rust::Slice<const uint8_t>(
static_cast<uint8_t*>(file.file_ptr), file.file_size);
auto info_cxx = get_boolean_flag_attribute_cxx(content, index);
auto info_cxx = get_flag_attribute_cxx(
content, static_cast<uint16_t>(value_type), index);
if (info_cxx.query_success) {
return info_cxx.flag_attribute;
} else {

View file

@ -37,7 +37,6 @@ enum FlagInfoBit {
HasOverride = 1<<2,
};
/// Mapped storage file
struct MappedStorageFile {
void* file_ptr;
@ -68,6 +67,12 @@ android::base::Result<MappedStorageFile> get_mapped_file_impl(
} // namespace private_internal_api
/// Map from StoredFlagType to FlagValueType
/// \input stored_type: stored flag type in the storage file
/// \returns the flag value type enum
android::base::Result<FlagValueType> map_to_flag_value_type(
StoredFlagType stored_type);
/// Get mapped storage file
/// \input container: stoarge container name
/// \input file_type: storage file type enum
@ -110,9 +115,11 @@ android::base::Result<bool> get_boolean_flag_value(
/// Get boolean flag attribute
/// \input file: mapped storage file
/// \input value_type: flag value type
/// \input index: the boolean flag index in the file
/// \returns the boolean flag attribute
android::base::Result<uint8_t> get_boolean_flag_attribute(
android::base::Result<uint8_t> get_flag_attribute(
MappedStorageFile const& file,
FlagValueType value_type,
uint32_t index);
} // namespace aconfig_storage

View file

@ -17,11 +17,15 @@
//! flag value query module defines the flag value file read from mapped bytes
use crate::{AconfigStorageError, FILE_VERSION};
use aconfig_storage_file::{flag_info::FlagInfoHeader, read_u8_from_bytes};
use aconfig_storage_file::{flag_info::FlagInfoHeader, read_u8_from_bytes, FlagValueType};
use anyhow::anyhow;
/// Get flag attribute bitfield
pub fn find_boolean_flag_attribute(buf: &[u8], flag_index: u32) -> Result<u8, AconfigStorageError> {
pub fn find_flag_attribute(
buf: &[u8],
flag_type: FlagValueType,
flag_index: u32,
) -> Result<u8, AconfigStorageError> {
let interpreted_header = FlagInfoHeader::from_bytes(buf)?;
if interpreted_header.version > crate::FILE_VERSION {
return Err(AconfigStorageError::HigherStorageFileVersion(anyhow!(
@ -31,8 +35,11 @@ pub fn find_boolean_flag_attribute(buf: &[u8], flag_index: u32) -> Result<u8, Ac
)));
}
// Find the byte offset to the flag info, each flag info now takes one byte
let mut head = (interpreted_header.boolean_flag_offset + flag_index) as usize;
// get byte offset to the flag info
let mut head = match flag_type {
FlagValueType::Boolean => (interpreted_header.boolean_flag_offset + flag_index) as usize,
};
if head >= interpreted_header.file_size as usize {
return Err(AconfigStorageError::InvalidStorageFileOffset(anyhow!(
"Flag info offset goes beyond the end of the file."
@ -53,7 +60,8 @@ mod tests {
fn test_is_flag_sticky() {
let flag_info_list = create_test_flag_info_list().into_bytes();
for offset in 0..8 {
let attribute = find_boolean_flag_attribute(&flag_info_list[..], offset).unwrap();
let attribute =
find_flag_attribute(&flag_info_list[..], FlagValueType::Boolean, offset).unwrap();
assert_eq!((attribute & FlagInfoBit::IsSticky as u8) != 0u8, false);
}
}
@ -64,7 +72,8 @@ mod tests {
let flag_info_list = create_test_flag_info_list().into_bytes();
let baseline: Vec<bool> = vec![true, false, true, false, false, false, false, false];
for offset in 0..8 {
let attribute = find_boolean_flag_attribute(&flag_info_list[..], offset).unwrap();
let attribute =
find_flag_attribute(&flag_info_list[..], FlagValueType::Boolean, offset).unwrap();
assert_eq!(
(attribute & FlagInfoBit::IsReadWrite as u8) != 0u8,
baseline[offset as usize]
@ -77,7 +86,8 @@ mod tests {
fn test_flag_has_override() {
let flag_info_list = create_test_flag_info_list().into_bytes();
for offset in 0..8 {
let attribute = find_boolean_flag_attribute(&flag_info_list[..], offset).unwrap();
let attribute =
find_flag_attribute(&flag_info_list[..], FlagValueType::Boolean, offset).unwrap();
assert_eq!((attribute & FlagInfoBit::HasOverride as u8) != 0u8, false);
}
}
@ -86,7 +96,8 @@ mod tests {
// this test point locks down query beyond the end of boolean section
fn test_boolean_out_of_range() {
let flag_info_list = create_test_flag_info_list().into_bytes();
let error = find_boolean_flag_attribute(&flag_info_list[..], 8).unwrap_err();
let error =
find_flag_attribute(&flag_info_list[..], FlagValueType::Boolean, 8).unwrap_err();
assert_eq!(
format!("{:?}", error),
"InvalidStorageFileOffset(Flag info offset goes beyond the end of the file.)"
@ -99,7 +110,7 @@ mod tests {
let mut info_list = create_test_flag_info_list();
info_list.header.version = crate::FILE_VERSION + 1;
let flag_info = info_list.into_bytes();
let error = find_boolean_flag_attribute(&flag_info[..], 4).unwrap_err();
let error = find_flag_attribute(&flag_info[..], FlagValueType::Boolean, 4).unwrap_err();
assert_eq!(
format!("{:?}", error),
format!(

View file

@ -45,12 +45,12 @@ pub mod package_table_query;
#[cfg(test)]
mod test_utils;
pub use aconfig_storage_file::{AconfigStorageError, StorageFileType};
pub use aconfig_storage_file::{AconfigStorageError, FlagValueType, StorageFileType};
pub use flag_table_query::FlagReadContext;
pub use package_table_query::PackageReadContext;
use aconfig_storage_file::{read_u32_from_bytes, FILE_VERSION};
use flag_info_query::find_boolean_flag_attribute;
use flag_info_query::find_flag_attribute;
use flag_table_query::find_flag_read_context;
use flag_value_query::find_boolean_flag_value;
use package_table_query::find_package_read_context;
@ -149,16 +149,21 @@ pub fn get_storage_file_version(file_path: &str) -> Result<u32, AconfigStorageEr
read_u32_from_bytes(&buffer, &mut head)
}
/// Get the boolean flag attribute.
/// Get the flag attribute.
///
/// \input file: mapped flag info file
/// \input index: boolean flag index
/// \input flag_type: flag value type
/// \input flag_index: flag index
///
/// \return
/// If the provide offset is valid, it returns the boolean flag attribute bitfiled, otherwise it
/// If the provide offset is valid, it returns the flag attribute bitfiled, otherwise it
/// returns the error message.
pub fn get_boolean_flag_attribute(file: &Mmap, index: u32) -> Result<u8, AconfigStorageError> {
find_boolean_flag_attribute(file, index)
pub fn get_flag_attribute(
file: &Mmap,
flag_type: FlagValueType,
flag_index: u32,
) -> Result<u8, AconfigStorageError> {
find_flag_attribute(file, flag_type, flag_index)
}
// *************************************** //
@ -201,7 +206,7 @@ mod ffi {
}
// Flag info query return for cc interlop
pub struct BooleanFlagAttributeQueryCXX {
pub struct FlagAttributeQueryCXX {
pub query_success: bool,
pub error_message: String,
pub flag_attribute: u8,
@ -224,10 +229,11 @@ mod ffi {
pub fn get_boolean_flag_value_cxx(file: &[u8], offset: u32) -> BooleanFlagValueQueryCXX;
pub fn get_boolean_flag_attribute_cxx(
pub fn get_flag_attribute_cxx(
file: &[u8],
offset: u32,
) -> BooleanFlagAttributeQueryCXX;
flag_type: u16,
flag_index: u32,
) -> FlagAttributeQueryCXX;
}
}
@ -312,7 +318,7 @@ impl ffi::BooleanFlagValueQueryCXX {
}
/// Implement the flag info interlop return type, create from actual flag info api return type
impl ffi::BooleanFlagAttributeQueryCXX {
impl ffi::FlagAttributeQueryCXX {
pub(crate) fn new(info_result: Result<u8, AconfigStorageError>) -> Self {
match info_result {
Ok(info) => {
@ -365,12 +371,18 @@ pub fn get_boolean_flag_value_cxx(file: &[u8], offset: u32) -> ffi::BooleanFlagV
ffi::BooleanFlagValueQueryCXX::new(find_boolean_flag_value(file, offset))
}
/// Get boolean flag attribute cc interlop
pub fn get_boolean_flag_attribute_cxx(
/// Get flag attribute cc interlop
pub fn get_flag_attribute_cxx(
file: &[u8],
offset: u32,
) -> ffi::BooleanFlagAttributeQueryCXX {
ffi::BooleanFlagAttributeQueryCXX::new(find_boolean_flag_attribute(file, offset))
flag_type: u16,
flag_index: u32,
) -> ffi::FlagAttributeQueryCXX {
match FlagValueType::try_from(flag_type) {
Ok(value_type) => {
ffi::FlagAttributeQueryCXX::new(find_flag_attribute(file, value_type, flag_index))
}
Err(errmsg) => ffi::FlagAttributeQueryCXX::new(Err(errmsg)),
}
}
/// Get storage version number cc interlop
@ -494,7 +506,8 @@ files {{
unsafe { get_mapped_file(&pb_file_path, "mockup", StorageFileType::FlagInfo).unwrap() };
let is_rw: Vec<bool> = vec![true, false, true, false, false, false, false, false];
for (offset, expected_value) in is_rw.into_iter().enumerate() {
let attribute = get_boolean_flag_attribute(&flag_info_file, offset as u32).unwrap();
let attribute =
get_flag_attribute(&flag_info_file, FlagValueType::Boolean, offset as u32).unwrap();
assert!((attribute & FlagInfoBit::IsSticky as u8) == 0u8);
assert_eq!((attribute & FlagInfoBit::IsReadWrite as u8) != 0u8, expected_value);
assert!((attribute & FlagInfoBit::HasOverride as u8) == 0u8);

View file

@ -234,7 +234,7 @@ TEST_F(AconfigStorageTest, test_boolean_flag_info_query) {
auto expected_value = std::vector<bool>{
true, false, true, false, false, false, false, false};
for (int index = 0; index < 8; ++index) {
auto attribute = api::get_boolean_flag_attribute(*mapped_file, index);
auto attribute = api::get_flag_attribute(*mapped_file, api::FlagValueType::Boolean, index);
ASSERT_TRUE(attribute.ok());
ASSERT_EQ(*attribute & static_cast<uint8_t>(api::FlagInfoBit::IsSticky), 0);
ASSERT_EQ((*attribute & static_cast<uint8_t>(api::FlagInfoBit::IsReadWrite)) != 0,
@ -249,7 +249,7 @@ TEST_F(AconfigStorageTest, test_invalid_boolean_flag_info_query) {
storage_record_pb, "mockup", api::StorageFileType::flag_info);
ASSERT_TRUE(mapped_file.ok());
auto attribute = api::get_boolean_flag_attribute(*mapped_file, 8);
auto attribute = api::get_flag_attribute(*mapped_file, api::FlagValueType::Boolean, 8);
ASSERT_FALSE(attribute.ok());
ASSERT_EQ(attribute.error().message(),
std::string("InvalidStorageFileOffset(Flag info offset goes beyond the end of the file.)"));

View file

@ -1,9 +1,9 @@
#[cfg(not(feature = "cargo"))]
mod aconfig_storage_rust_test {
use aconfig_storage_file::protos::storage_record_pb::write_proto_to_temp_file;
use aconfig_storage_file::{FlagInfoBit, StorageFileType, StoredFlagType};
use aconfig_storage_file::{FlagInfoBit, FlagValueType, StorageFileType, StoredFlagType};
use aconfig_storage_read_api::{
get_boolean_flag_attribute, get_boolean_flag_value, get_flag_read_context,
get_boolean_flag_value, get_flag_attribute, get_flag_read_context,
get_package_read_context, get_storage_file_version, mapped_file::get_mapped_file,
PackageReadContext,
};
@ -190,7 +190,8 @@ files {{
unsafe { get_mapped_file(&pb_file_path, "mockup", StorageFileType::FlagInfo).unwrap() };
let is_rw: Vec<bool> = vec![true, false, true, false, false, false, false, false];
for (offset, expected_value) in is_rw.into_iter().enumerate() {
let attribute = get_boolean_flag_attribute(&flag_info_file, offset as u32).unwrap();
let attribute =
get_flag_attribute(&flag_info_file, FlagValueType::Boolean, offset as u32).unwrap();
assert!((attribute & FlagInfoBit::IsSticky as u8) == 0u8);
assert_eq!((attribute & FlagInfoBit::IsReadWrite as u8) != 0u8, expected_value);
assert!((attribute & FlagInfoBit::HasOverride as u8) == 0u8);
@ -205,7 +206,7 @@ files {{
// The safety here is ensured as the test process will not write to temp storage file
let flag_info_file =
unsafe { get_mapped_file(&pb_file_path, "mockup", StorageFileType::FlagInfo).unwrap() };
let err = get_boolean_flag_attribute(&flag_info_file, 8u32).unwrap_err();
let err = get_flag_attribute(&flag_info_file, FlagValueType::Boolean, 8u32).unwrap_err();
assert_eq!(
format!("{:?}", err),
"InvalidStorageFileOffset(Flag info offset goes beyond the end of the file.)"

View file

@ -95,7 +95,7 @@ pub fn update_flag_has_override(
mod tests {
use super::*;
use aconfig_storage_file::test_utils::create_test_flag_info_list;
use aconfig_storage_read_api::flag_info_query::find_boolean_flag_attribute;
use aconfig_storage_read_api::flag_info_query::find_flag_attribute;
#[test]
// this test point locks down is sticky update
@ -104,10 +104,10 @@ mod tests {
let mut buf = flag_info_list.into_bytes();
for i in 0..flag_info_list.header.num_flags {
update_flag_is_sticky(&mut buf, FlagValueType::Boolean, i, true).unwrap();
let attribute = find_boolean_flag_attribute(&buf, i).unwrap();
let attribute = find_flag_attribute(&buf, FlagValueType::Boolean, i).unwrap();
assert!((attribute & (FlagInfoBit::IsSticky as u8)) != 0);
update_flag_is_sticky(&mut buf, FlagValueType::Boolean, i, false).unwrap();
let attribute = find_boolean_flag_attribute(&buf, i).unwrap();
let attribute = find_flag_attribute(&buf, FlagValueType::Boolean, i).unwrap();
assert!((attribute & (FlagInfoBit::IsSticky as u8)) == 0);
}
}
@ -119,10 +119,10 @@ mod tests {
let mut buf = flag_info_list.into_bytes();
for i in 0..flag_info_list.header.num_flags {
update_flag_has_override(&mut buf, FlagValueType::Boolean, i, true).unwrap();
let attribute = find_boolean_flag_attribute(&buf, i).unwrap();
let attribute = find_flag_attribute(&buf, FlagValueType::Boolean, i).unwrap();
assert!((attribute & (FlagInfoBit::HasOverride as u8)) != 0);
update_flag_has_override(&mut buf, FlagValueType::Boolean, i, false).unwrap();
let attribute = find_boolean_flag_attribute(&buf, i).unwrap();
let attribute = find_flag_attribute(&buf, FlagValueType::Boolean, i).unwrap();
assert!((attribute & (FlagInfoBit::HasOverride as u8)) == 0);
}
}

View file

@ -281,7 +281,7 @@ pub(crate) fn update_flag_is_sticky_cxx(
match crate::flag_info_update::update_flag_is_sticky(file, value_type, offset, value) {
Ok(()) => ffi::FlagIsStickyUpdateCXX {
update_success: true,
error_message: String::from("")
error_message: String::from(""),
},
Err(errmsg) => ffi::FlagIsStickyUpdateCXX {
update_success: false,
@ -292,7 +292,7 @@ pub(crate) fn update_flag_is_sticky_cxx(
Err(errmsg) => ffi::FlagIsStickyUpdateCXX {
update_success: false,
error_message: format!("{:?}", errmsg),
}
},
}
}
@ -304,10 +304,11 @@ pub(crate) fn update_flag_has_override_cxx(
) -> ffi::FlagHasOverrideUpdateCXX {
match FlagValueType::try_from(flag_type) {
Ok(value_type) => {
match crate::flag_info_update::update_flag_has_override(file, value_type, offset, value) {
match crate::flag_info_update::update_flag_has_override(file, value_type, offset, value)
{
Ok(()) => ffi::FlagHasOverrideUpdateCXX {
update_success: true,
error_message: String::from("")
error_message: String::from(""),
},
Err(errmsg) => ffi::FlagHasOverrideUpdateCXX {
update_success: false,
@ -318,7 +319,7 @@ pub(crate) fn update_flag_has_override_cxx(
Err(errmsg) => ffi::FlagHasOverrideUpdateCXX {
update_success: false,
error_message: format!("{:?}", errmsg),
}
},
}
}
@ -346,7 +347,7 @@ mod tests {
write_bytes_to_temp_file,
};
use aconfig_storage_file::FlagInfoBit;
use aconfig_storage_read_api::flag_info_query::find_boolean_flag_attribute;
use aconfig_storage_read_api::flag_info_query::find_flag_attribute;
use aconfig_storage_read_api::flag_value_query::find_boolean_flag_value;
use std::fs::File;
use std::io::Read;
@ -402,11 +403,11 @@ files {{
}
}
fn get_flag_attribute_at_offset(file: &str, offset: u32) -> u8 {
fn get_flag_attribute_at_offset(file: &str, value_type: FlagValueType, offset: u32) -> u8 {
let mut f = File::open(&file).unwrap();
let mut bytes = Vec::new();
f.read_to_end(&mut bytes).unwrap();
find_boolean_flag_attribute(&bytes, offset).unwrap()
find_flag_attribute(&bytes, value_type, offset).unwrap()
}
#[test]
@ -442,10 +443,10 @@ files {{
.unwrap();
for i in 0..8 {
set_flag_is_sticky(&mut file, FlagValueType::Boolean, i, true).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute = get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::IsSticky as u8)) != 0);
set_flag_is_sticky(&mut file, FlagValueType::Boolean, i, false).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute = get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::IsSticky as u8)) == 0);
}
}
@ -484,10 +485,10 @@ files {{
.unwrap();
for i in 0..8 {
set_flag_has_override(&mut file, FlagValueType::Boolean, i, true).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute = get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::HasOverride as u8)) != 0);
set_flag_has_override(&mut file, FlagValueType::Boolean, i, false).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute = get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::HasOverride as u8)) == 0);
}
}

View file

@ -170,7 +170,8 @@ TEST_F(AconfigStorageTest, test_flag_is_sticky_update) {
auto ro_mapped_file = api::MappedStorageFile();
ro_mapped_file.file_ptr = mapped_file.file_ptr;
ro_mapped_file.file_size = mapped_file.file_size;
auto attribute = api::get_boolean_flag_attribute(ro_mapped_file, offset);
auto attribute = api::get_flag_attribute(
ro_mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_TRUE(*attribute & api::FlagInfoBit::IsSticky);
@ -179,7 +180,8 @@ TEST_F(AconfigStorageTest, test_flag_is_sticky_update) {
ASSERT_TRUE(update_result.ok());
ro_mapped_file.file_ptr = mapped_file.file_ptr;
ro_mapped_file.file_size = mapped_file.file_size;
attribute = api::get_boolean_flag_attribute(ro_mapped_file, offset);
attribute = api::get_flag_attribute(
ro_mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_FALSE(*attribute & api::FlagInfoBit::IsSticky);
}
@ -199,7 +201,8 @@ TEST_F(AconfigStorageTest, test_flag_has_override_update) {
auto ro_mapped_file = api::MappedStorageFile();
ro_mapped_file.file_ptr = mapped_file.file_ptr;
ro_mapped_file.file_size = mapped_file.file_size;
auto attribute = api::get_boolean_flag_attribute(ro_mapped_file, offset);
auto attribute = api::get_flag_attribute(
ro_mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_TRUE(*attribute & api::FlagInfoBit::HasOverride);
@ -208,7 +211,8 @@ TEST_F(AconfigStorageTest, test_flag_has_override_update) {
ASSERT_TRUE(update_result.ok());
ro_mapped_file.file_ptr = mapped_file.file_ptr;
ro_mapped_file.file_size = mapped_file.file_size;
attribute = api::get_boolean_flag_attribute(ro_mapped_file, offset);
attribute = api::get_flag_attribute(
ro_mapped_file, api::FlagValueType::Boolean, offset);
ASSERT_TRUE(attribute.ok());
ASSERT_FALSE(*attribute & api::FlagInfoBit::HasOverride);
}

View file

@ -2,7 +2,7 @@
mod aconfig_storage_write_api_test {
use aconfig_storage_file::protos::ProtoStorageFiles;
use aconfig_storage_file::{FlagInfoBit, FlagValueType, StorageFileType};
use aconfig_storage_read_api::flag_info_query::find_boolean_flag_attribute;
use aconfig_storage_read_api::flag_info_query::find_flag_attribute;
use aconfig_storage_read_api::flag_value_query::find_boolean_flag_value;
use aconfig_storage_write_api::{
mapped_file::get_mapped_file, set_boolean_flag_value, set_flag_has_override,
@ -55,11 +55,11 @@ files {{
}
/// Get flag attribute at offset
fn get_flag_attribute_at_offset(file: &str, offset: u32) -> u8 {
fn get_flag_attribute_at_offset(file: &str, value_type: FlagValueType, offset: u32) -> u8 {
let mut f = File::open(file).unwrap();
let mut bytes = Vec::new();
f.read_to_end(&mut bytes).unwrap();
find_boolean_flag_attribute(&bytes, offset).unwrap()
find_flag_attribute(&bytes, value_type, offset).unwrap()
}
#[test]
@ -107,10 +107,12 @@ files {{
};
for i in 0..8 {
set_flag_is_sticky(&mut file, FlagValueType::Boolean, i, true).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute =
get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::IsSticky as u8)) != 0);
set_flag_is_sticky(&mut file, FlagValueType::Boolean, i, false).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute =
get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::IsSticky as u8)) == 0);
}
}
@ -133,10 +135,12 @@ files {{
};
for i in 0..8 {
set_flag_has_override(&mut file, FlagValueType::Boolean, i, true).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute =
get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::HasOverride as u8)) != 0);
set_flag_has_override(&mut file, FlagValueType::Boolean, i, false).unwrap();
let attribute = get_flag_attribute_at_offset(&flag_info_path, i);
let attribute =
get_flag_attribute_at_offset(&flag_info_path, FlagValueType::Boolean, i);
assert!((attribute & (FlagInfoBit::HasOverride as u8)) == 0);
}
}