ワンクリックで
test-development
// Guide for writing, running, and debugging Nanvix unit, integration, and system tests in Rust and C/C++. Use this when asked about test implementation or failures.
// Guide for writing, running, and debugging Nanvix unit, integration, and system tests in Rust and C/C++. Use this when asked about test implementation or failures.
| name | test-development |
| description | Guide for writing, running, and debugging Nanvix unit, integration, and system tests in Rust and C/C++. Use this when asked about test implementation or failures. |
Use this skill when the user asks about writing, running, or debugging tests in Nanvix. Nanvix has unit tests, integration tests, and system tests written in Rust and C/C++.
Unit tests are #[cfg(test)] modules within library crates. They run on the host system using
cargo test.
./z build -- run-unit-tests
Libraries with unit tests are listed in
ALL_GUEST_RUST_LIBS_TEST_LIST: arch, bitmap, config,
elf, error, type-safe, proc, raw-array, slab,
static_assert, libc_string, syslog-macros, syslog.
| Test | Path | Purpose |
|---|---|---|
testd | src/tests/testd/ | Guest test daemon |
arch-rust | src/tests/arch-rust/ | Arch tests |
file-rust | src/tests/file-rust/ | File tests |
thread-rust | src/tests/thread-rust/ | Thread tests |
stress-rust | src/tests/stress-rust/ | Stress tests |
test-kernel | src/tests/test-kernel/ | Kernel tests |
linux-app | src/tests/linux-app/ | Linux app tests |
System tests are available on microvm machines. On Linux, all deployment
modes are supported (nanvixd + kernel + guest). On Windows, only standalone mode is supported.
# Linux
./z build -- run-nanvix-tests
# Windows (standalone mode only)
.\z.ps1 build -- run-nanvix-tests
Test configurations:
test/test-standalone.toml — Standalone mode (Linux).test/test-standalone-windows.toml — Standalone mode (Windows).test/test-single_process.toml — Single-process mode.test/test-multi_process.toml — Multi-process mode.test/test-l2.toml — L2 VM mode.The nanvix-test utility (src/utils/nanvix-test/) drives
these tests in two execution modes:
nanvixd.nanvixd
(native ELF only).Add #[cfg(test)] modules to library crates:
//============================================================
// Tests
//============================================================
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_example() {
let result: u32 = some_function();
assert_eq!(result, 42, "expected 42");
}
}
Rules for tests:
expect() is preferred over unwrap() for better failure diagnostics.#[allow(clippy::unwrap_used)] or #[allow(clippy::expect_used)] at the module level when
needed (the crate uses #![deny(...)]).Guest integration tests are #![no_std] binaries that run inside Nanvix:
src/tests/<name>/.#![no_std], #![no_main]).ALL_GUEST_TESTS in the Makefile.members in root Cargo.toml.# Unit tests + system tests (if applicable).
./z build -- test
# Full CI pipeline (includes all test types).
./scripts/pipeline.sh
Guide for Nanvix CI and GitHub Actions workflow behavior, including local pipeline execution and matrix coverage. Use this when asked about CI checks, workflow failures, or release flow.
Guide for developing, building, and running Nanvix user-space applications across supported runtimes and languages. Use this when asked about guest app implementation or execution.
Guide for creating and modifying Nanvix libraries under src/libs, including guest no_std and host std crates. Use this when asked about library architecture or crate changes.
Guide for developing and debugging Nanvix daemons, including guest daemons and host linuxd behavior. Use this when asked about daemon architecture or daemon changes.
Guide for modifying and debugging the Nanvix kernel architecture and kernel-call paths. Use this when asked about kernel internals or kernel implementation changes.
Guide for running Nanvix tests with z. Use this when asked to run unit tests, integration tests, or the full test suite.