Testing guide
Run unit and integration tests
You can run the unit and integration tests by:
cargo test --target x86_64-fortanix-unknown-sgx
Some features of cargo test
are not yet supported in Fortanix EDP, notably
- Detect default number of threads - The default number of threads has been set to 1.
- Set
RUST_TEST_THREADS
- This environment variable is ignored. - Pass command-line arguments (no-capture, test filtering, etc.) - These arguments are not propagated to the enclave.
Specify stack-size, heap-size and/or number of threads.
Depending on your application, you may want to increase the stack or heap size, or the number of threads. You can do this by providing custom values under [package.metadata]
table in Cargo.toml
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[package.metadata.fortanix-sgx]
# stack size (in bytes) for each thread, the default stack size is 0x20000.
stack-size=0x20000
# heap size (in bytes), the default heap size is 0x2000000.
heap-size=0x2000000
# the default number of threads is equal to the number of available CPUs of
# the current system.
# Gotcha: Don't forget to count the main thread when counting number of
# threads.
threads=1
# SSA frame size (in pages) for each thread, the default SSA frame size is 1.
# You normally don't need to change the SSA frame size.
ssaframesize=1
# whether to enable EDP debugging features in the enclave, debugging is
# enabled by default.
debug=true