Pullpiri¶
This documents contains developments, testings, static analysis informations.
Development¶
Environment Setup¶
For detail, refer to installation.
Build¶
The first priority is to use Containers, but direct build is also possible. (However, build errors may occur depending on the system.)
The project is using cargo as its build system and command is wrapped in Makefile.
The binaries and other artifacts (such as the man pages) can be built via:
# in src directory
make build
# same as
cd src/agent && cargo build
cd src/player && cargo build
cd src/server && cargo build
After successfully compiling the binaries, they will be in:
# only binaries appear in below
[root@HPC src]# ls agent/target/debug/
nodeagent
[root@HPC src]# ls player/target/debug/
actioncontroller statemanager filtergateway
[root@HPC src]# ls server/target/debug/
apiserver monitoringserver policymanager
You can use these directly, but it is recommended to use containers.
For more details, refer to the Getting started
Static analysis¶
rustfmt¶
Rustfmt formats Rust code according to the official rust style guide. It enforces consistency across codebases and making code easier to read and review.
Using rustfmt¶
Step 1: Install Rustfmt.
Step 2: Format Your Code: Recursively formats all .rs files in the project.
clippy¶
Clippy is a collection of lints to catch common mistakes and improve Rust code. It analyzes source code and provides suggestions for idiomatic Rust practices to performance improvements and potential bugs.
Using clippy¶
Step 1: Install Clippy.
Step 2: Run Clippy: Runs the linter on your project. It reports warnings and suggestions for your code.
Optional: Automatically fix warnings: Applies safe automatic fixes to clippy warnings.
cargo audit - Security vulnerability scanner¶
Cargo Audit scans your Cargo.lock file for crates with known security
vulnerabilities using the RustSec Advisory Database.
It helps you ensure your dependencies are secure.
Using cargo-audit¶
Step 1: Install Cargo Audit.
Step 2: Run: Scans the dependency tree for known vulnerabilities and outdated crates.
cargo deny - Dependency & License checker¶
Cargo Deny checks for issues including:It’s used to enforce policies for project dependencies.
- Duplicate crates
- Insecure or unwanted licenses
- Vulnerabilities
- Unmaintained crates
Using cargo-deny¶
Step 1: Install Cargo Deny
Step 2: Initialize Configuration (for New components only) - Creates a default deny.toml file where you can configure license policies, bans and exceptions.
# directory located `Cargo.toml` like `src/server/apiserver`
# almost all crates already done.
cargo deny init
Step 3: Run Check - Analyzes dependency metadata and reports issues related to licenses, advisories and duplicates.
cargo udeps - Unused Dependency Detector¶
Cargo Udeps identifies unused dependencies in your Cargo.toml Keeping unused dependencies can bloat the project and expose unnecessary vulnerabilities."For this requires Nightly Rust to run".
Caution : rustc 1.86.0 or above is required. (on July 18th, 2025)
Using cargo-udeps¶
Step 1: Install Cargo Udeps
Step 2: Nightly run - This runs the unused dependency checker and lists packages not being used.
Unit tests¶
Unit tests can be executed using following commands:
Integration tests¶
Some Pullpiri modules has tests folder.
# in src/server/apiserver directory
[root@HPC apiserver]# tree
.
├── apiserver.md
├── Cargo.toml
├── src
......
└── tests
├── api_integration.rs
├── apiserver_init.rs
├── filtergateway_integration.rs
└── manager_integration.rs
For general information of integration testing, refer to rust doc.
cargo tarpaulin - Code coverage¶
cargo-tarpaulin is a code coverage tool specifically designed for Rust projects. It works by instrumenting the Rust code, running the tests,and generating a detailed report that shows which lines of code were covered during testing. It supports a variety of Rust test strategies, including unit tests and integration tests.
Install and run¶
To use cargo-tarpaulin you need to install it on your system. This can be done easily via cargo:
cargo install cargo-tarpaulin
#Once installed, you can run the tool in your project by using the following command:
# in any directories include `Cargo.toml`
cargo tarpaulin
Using Ports¶
Pullpiri uses ports from 47001 ~ 47099.
Other document¶
Files for documentation of this project are located in the doc directory comprising:
- Getting Started: how to run
- Examples: directory containing all files and guides for performing example
- (Deprecated) ~~pullpiri.drawio: file containing all diagrams used for Pullpiri~~