Skip to content

Commit b0a7036

Browse files
committed
common: CLI proptest derives only outside of SGX
1 parent 37f5111 commit b0a7036

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

common/src/api/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use std::fmt::{self, Display};
22
use std::str::FromStr;
33

4+
#[cfg(all(test, not(target_env = "sgx")))]
5+
use proptest_derive::Arbitrary;
46
use serde::{Deserialize, Serialize};
57

68
use crate::hex::{self, FromHex};
@@ -12,7 +14,7 @@ pub mod qs;
1214
pub mod runner;
1315
pub mod vfs;
1416

15-
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
17+
#[cfg_attr(all(test, not(target_env = "sgx")), derive(Arbitrary))]
1618
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
1719
pub struct UserPk(#[serde(with = "hexstr_or_bytes")] [u8; 32]);
1820

common/src/cli.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::fmt::{self, Display};
2-
#[cfg(test)]
2+
#[cfg(all(test, not(target_env = "sgx")))]
33
use std::net::Ipv4Addr;
44
use std::path::Path;
55
use std::process::Command;
@@ -8,11 +8,11 @@ use std::str::FromStr;
88
use anyhow::{anyhow, ensure};
99
use argh::FromArgs;
1010
use lightning_invoice::Currency;
11-
#[cfg(test)]
11+
#[cfg(all(test, not(target_env = "sgx")))]
1212
use proptest::arbitrary::{any, Arbitrary};
13-
#[cfg(test)]
13+
#[cfg(all(test, not(target_env = "sgx")))]
1414
use proptest::strategy::{BoxedStrategy, Just, Strategy};
15-
#[cfg(test)]
15+
#[cfg(all(test, not(target_env = "sgx")))]
1616
use proptest_derive::Arbitrary;
1717

1818
use crate::api::runner::Port;
@@ -83,7 +83,7 @@ impl NodeCommand {
8383
}
8484
}
8585

86-
#[cfg(test)]
86+
#[cfg(all(test, not(target_env = "sgx")))]
8787
impl Arbitrary for NodeCommand {
8888
type Parameters = ();
8989
type Strategy = BoxedStrategy<Self>;
@@ -98,7 +98,7 @@ impl Arbitrary for NodeCommand {
9898
}
9999

100100
/// Run the Lexe node
101-
#[cfg_attr(test, derive(Arbitrary))]
101+
#[cfg_attr(all(test, not(target_env = "sgx")), derive(Arbitrary))]
102102
#[derive(Clone, Debug, PartialEq, Eq, FromArgs)]
103103
#[argh(subcommand, name = "run")]
104104
pub struct RunArgs {
@@ -223,7 +223,7 @@ impl RunArgs {
223223
}
224224

225225
/// Provision a new Lexe node for a user
226-
#[cfg_attr(test, derive(Arbitrary))]
226+
#[cfg_attr(all(test, not(target_env = "sgx")), derive(Arbitrary))]
227227
#[derive(Clone, Debug, PartialEq, Eq, FromArgs)]
228228
#[argh(subcommand, name = "provision")]
229229
pub struct ProvisionArgs {
@@ -361,7 +361,7 @@ impl Display for BitcoindRpcInfo {
361361
}
362362
}
363363

364-
#[cfg(test)]
364+
#[cfg(all(test, not(target_env = "sgx")))]
365365
impl Arbitrary for BitcoindRpcInfo {
366366
type Parameters = ();
367367
type Strategy = BoxedStrategy<Self>;
@@ -466,7 +466,7 @@ impl From<Network> for Currency {
466466
}
467467
}
468468

469-
#[cfg(test)]
469+
#[cfg(all(test, not(target_env = "sgx")))]
470470
impl Arbitrary for Network {
471471
type Parameters = ();
472472
type Strategy = BoxedStrategy<Self>;
@@ -483,7 +483,7 @@ impl Arbitrary for Network {
483483
}
484484
}
485485

486-
#[cfg(test)]
486+
#[cfg(all(test, not(target_env = "sgx")))]
487487
mod test {
488488
use proptest::proptest;
489489

0 commit comments

Comments
 (0)