Skip to content

Commit

Permalink
tests: fix compile error in HW mode
Browse files Browse the repository at this point in the history
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
  • Loading branch information
bluele committed Jun 7, 2023
1 parent 0e22bce commit fdc3143
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod tests {
use anyhow::{anyhow, bail};
use ecall_commands::{
CommitmentProofPair, IASRemoteAttestationInput, InitClientInput, InitEnclaveInput,
SimulateRemoteAttestationInput, UpdateClientInput, VerifyMembershipInput,
UpdateClientInput, VerifyMembershipInput,
};
use enclave_api::{Enclave, EnclaveCommandAPI};
use host_environment::Environment;
Expand Down Expand Up @@ -89,8 +89,7 @@ mod tests {
mut rly: Relayer,
enclave: &Enclave<store::memory::MemStore>,
) -> Result<(), anyhow::Error> {
let simulate = std::env::var("SGX_MODE").map_or(false, |m| m == "SW");
if simulate {
if cfg!(feature = "sgx_sw") {
info!("this test is running in SW mode");
} else {
info!("this test is running in HW mode");
Expand All @@ -103,8 +102,7 @@ mod tests {
}
};

let simulate = std::env::var("SGX_MODE").map_or(false, |m| m == "SW");
if !simulate {
if cfg!(not(feature = "sgx_sw")) {
let _ = match enclave.ias_remote_attestation(IASRemoteAttestationInput {
spid: std::env::var("SPID").unwrap().as_bytes().to_vec(),
ias_key: std::env::var("IAS_KEY").unwrap().as_bytes().to_vec(),
Expand All @@ -115,10 +113,13 @@ mod tests {
}
};
} else {
let _ = match enclave.simulate_remote_attestation(SimulateRemoteAttestationInput {
advisory_ids: vec![],
isv_enclave_quote_status: "OK".to_string(),
}) {
#[cfg(feature = "sgx_sw")]
let _ = match enclave.simulate_remote_attestation(
ecall_commands::SimulateRemoteAttestationInput {
advisory_ids: vec![],
isv_enclave_quote_status: "OK".to_string(),
},
) {
Ok(res) => res.avr,
Err(e) => {
bail!("Simulate Remote Attestation Failed {:?}!", e);
Expand Down

0 comments on commit fdc3143

Please sign in to comment.