Merge changes from topic "rust_aconfig-test-mode" into main am: 73b4f2d4e2
am: 31fdd70294
Original change: https://android-review.googlesource.com/c/platform/build/+/2706433 Change-Id: Ifce75b4d3b01300ff5463f1d2ae7a8e6376b5506 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
20288ab1cd
4 changed files with 50 additions and 9 deletions
|
@ -160,11 +160,28 @@ rust_aconfig_library {
|
||||||
}
|
}
|
||||||
|
|
||||||
rust_test {
|
rust_test {
|
||||||
name: "aconfig.test.rust",
|
name: "aconfig.prod_mode.test.rust",
|
||||||
srcs: [
|
srcs: [
|
||||||
"tests/aconfig_test.rs"
|
"tests/aconfig_prod_mode_test.rs"
|
||||||
],
|
],
|
||||||
rustlibs: [
|
rustlibs: [
|
||||||
"libaconfig_test_rust_library",
|
"libaconfig_test_rust_library",
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
rust_aconfig_library {
|
||||||
|
name: "libaconfig_test_rust_library_with_test_mode",
|
||||||
|
crate_name: "aconfig_test_rust_library",
|
||||||
|
aconfig_declarations: "aconfig.test.flags",
|
||||||
|
test: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
rust_test {
|
||||||
|
name: "aconfig.test_mode.test.rust",
|
||||||
|
srcs: [
|
||||||
|
"tests/aconfig_test_mode_test.rs"
|
||||||
|
],
|
||||||
|
rustlibs: [
|
||||||
|
"libaconfig_test_rust_library_with_test_mode",
|
||||||
|
],
|
||||||
}
|
}
|
8
tools/aconfig/tests/aconfig_prod_mode_test.rs
Normal file
8
tools/aconfig/tests/aconfig_prod_mode_test.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#[test]
|
||||||
|
fn test_flags() {
|
||||||
|
assert!(!aconfig_test_rust_library::disabled_ro());
|
||||||
|
assert!(!aconfig_test_rust_library::disabled_rw());
|
||||||
|
// TODO: Fix template to not default both disabled and enabled to false
|
||||||
|
assert!(!aconfig_test_rust_library::enabled_ro());
|
||||||
|
assert!(!aconfig_test_rust_library::enabled_rw());
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
#[test]
|
|
||||||
fn test_flags() {
|
|
||||||
assert!(!aconfig_test_rust_library::disabled_ro());
|
|
||||||
assert!(!aconfig_test_rust_library::disabled_rw());
|
|
||||||
assert!(aconfig_test_rust_library::enabled_ro());
|
|
||||||
assert!(aconfig_test_rust_library::enabled_rw());
|
|
||||||
}
|
|
23
tools/aconfig/tests/aconfig_test_mode_test.rs
Normal file
23
tools/aconfig/tests/aconfig_test_mode_test.rs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#[test]
|
||||||
|
fn test_flags() {
|
||||||
|
assert!(!aconfig_test_rust_library::disabled_ro());
|
||||||
|
assert!(!aconfig_test_rust_library::disabled_rw());
|
||||||
|
// TODO: Fix template to not default both disabled and enabled to false
|
||||||
|
assert!(!aconfig_test_rust_library::enabled_ro());
|
||||||
|
assert!(!aconfig_test_rust_library::enabled_rw());
|
||||||
|
|
||||||
|
aconfig_test_rust_library::set_disabled_ro(true);
|
||||||
|
assert!(aconfig_test_rust_library::disabled_ro());
|
||||||
|
aconfig_test_rust_library::set_disabled_rw(true);
|
||||||
|
assert!(aconfig_test_rust_library::disabled_rw());
|
||||||
|
aconfig_test_rust_library::set_enabled_ro(true);
|
||||||
|
assert!(aconfig_test_rust_library::enabled_ro());
|
||||||
|
aconfig_test_rust_library::set_enabled_rw(true);
|
||||||
|
assert!(aconfig_test_rust_library::enabled_rw());
|
||||||
|
|
||||||
|
aconfig_test_rust_library::reset_flags();
|
||||||
|
assert!(!aconfig_test_rust_library::disabled_ro());
|
||||||
|
assert!(!aconfig_test_rust_library::disabled_rw());
|
||||||
|
assert!(!aconfig_test_rust_library::enabled_ro());
|
||||||
|
assert!(!aconfig_test_rust_library::enabled_rw());
|
||||||
|
}
|
Loading…
Reference in a new issue