Building, running and testing - RobertDrazkowskiGL/parsec GitHub Wiki
user@host:~/parsec$ cargo build --features cryptoauthlib-provider
user@host:~/parsec$ cargo fmt --all -- --check
user@host:~/parsec$ cargo clippy --all-targets --features cryptoauthlib-provider -- -D clippy::all -D clippy::cargo
user@host:~/parsec$ cargo test --doc --features cryptoauthlib-provider
user@host:~/parsec$ cargo test --lib --features cryptoauthlib-provider
Prerequisites
At least two consoles (terminals) are needed.
The Parsec binaries must be compiled with direct authenticator built-in, e.g. using below command:
user@host:~/parsec$ cargo build --features=cryptoauthlib-provider,all-authenticators
Check formatting
user@host:~/parsec$ cargo fmt --all --manifest-path e2e_tests/Cargo.toml -- --check
Check lints
user@host:~/parsec$ cargo clippy --all-targets --features=cryptoauthlib-provider --manifest-path e2e_tests/Cargo.toml -- -D clippy::all -D clippy::cargo
There are minor differences in command line, depending on backend to be used.
user@host:~/parsec$ RUST_LOG=info ./target/debug/parsec -c e2e_tests/provider_cfg/cryptoauthlib/config.toml
user@host:~/parsec$ RUST_LOG=info ./target/debug/parsec -c e2e_tests/provider_cfg/cryptoauthlib/config_608a.toml
user@host:~/parsec$ cd e2e_tests
user@host:~/parsec/e2e_tests$ PARSEC_SERVICE_ENDPOINT="unix:/tmp/parsec.sock" cargo test --features cryptoauthlib-provider normal_tests -- --test-threads 1
The number of test threads is limited, otherwise tests requirements quickly exhaust the number of available slots.
The location of parsec service socket file PARSEC_SERVICE_ENDPOINT
must be the same as the one defined in config.toml
, section listener
, field socket_path
.
To see the logs add 'nocapture' option
PARSEC_SERVICE_ENDPOINT="unix:/tmp/parsec.sock" cargo test --features cryptoauthlib-provider export_ecc_private_key_not_possible -- --nocapture -- --test-threads 1
Please note - all below tests must pass to make merging a pull request possible.
Hint - these tests are run in their containers and take a lot of time and consume a lot of disk space as well.
Check using df
if there is enough disk space (around 10GB) before every test.
If not docker container ls -al
together with docker container rm
can help.
Please also note, that as long as there is no good CryptoAuthentication Library in-software emulator, running end-to-end tests of a cryptoauthlib-provider is difficult in github CI.
And finally - github CI tests are setup here: parsec/.github/workflows/ci.yml - please refer to this file if an unexpected occurs.
user@host:~/parsec$ docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh mbed-crypto
user@host:~/parsec$ docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh pkcs11
user@host:~/parsec$ docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh tpm
user@host:~/parsec$ docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh trusted-service
Please note - it is still experimental!
user@host:~/parsec$ docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh --no-stress-test cryptoauthlib
user@host:~/parsec$ docker run -v $(pwd):/tmp/parsec -w /tmp/parsec ghcr.io/parallaxsecond/parsec-service-test-all /tmp/parsec/ci.sh all