-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: There's two separate QE check functions. Lets use the verse one as the default Differential Revision: D65419563 fbshipit-source-id: 9b33682aa657f39fe799e1fe05e094fd8590b9ca
- Loading branch information
1 parent
3994f21
commit 5055b06
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under both the MIT license found in the | ||
* LICENSE-MIT file in the root directory of this source tree and the Apache | ||
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory | ||
* of this source tree. | ||
*/ | ||
|
||
pub enum QEParamValue { | ||
Bool, | ||
String(String), | ||
Int(i64), | ||
} | ||
|
||
#[cfg(all(fbcode_build, target_os = "linux"))] | ||
pub fn evaluate_qe(unit_id: u64, universe: &str, param: &str, expect: QEParamValue) -> bool { | ||
use sandcastle_qe2_client::QE2; | ||
use tracing::info; | ||
|
||
let qe = crate::executor::run_as_sync(QE2::from_unit_id(unit_id, &[universe])); | ||
let ret = match expect { | ||
QEParamValue::Bool => qe.get_bool(universe, param, false), | ||
QEParamValue::String(expect) => { | ||
let qe_value = qe.get_string(universe, param, ""); | ||
qe_value == expect | ||
} | ||
QEParamValue::Int(expect) => { | ||
let qe_value = qe.get_int(universe, param, 0); | ||
qe_value == expect | ||
} | ||
}; | ||
|
||
info!("Check {param} from QE {universe}: {ret}"); | ||
crate::scuba!(event: VERSE_QE_CHECK, data: json!({ "param": param, "universe": universe, "result": ret })); | ||
ret | ||
} | ||
|
||
#[cfg(not(all(fbcode_build, target_os = "linux")))] | ||
pub fn evaluate_qe(unit_id: u64, universe: &str, param: &str, expect: QEParamValue) -> bool { | ||
return false; | ||
} |