This directory contains the test suites of Asterinas running in initramfs, including various test programs, benchmarks, syscall test suites, and necessary configuration files. The structure of the test directory is designed to be modular and flexible, supporting multiple CPU architectures and a streamlined workflow for building and running tests.
│ ├── benchmark/ # Supported benchmark test suites
│ ├── etc/ # Configuration files
│ └── syscall/ # Syscall test suites
│ ├── ltp/ # LTP syscall test suite
│ └── gvisor/ # Gvisor syscall test suite
├── nix/
│ ├── benchmark/ # Nix expressions for `benchmark`
│ ├── syscall/ # Nix expressions for `syscall`
│ ├── apps.nix # Nix expression for `apps`
│ └── initramfs.nix # Nix expression for packaging initramfs
├── Makefile
└── README.md
```
## Building and Packaging Tests
Most tests in this directory are compiled and packaged using [Nix](https://nixos.org/), a powerful package manager. This ensures consistency and reproducibility across environments.
> **Note**: If you are adding a new test to the `apps` directory, ensure that it supports multiple architectures. Some of the existing apps lack proper architecture-specific handling.
### Syscall Test Suite - Gvisor Exception
While most tests rely on `Nix` for compilation, the `gvisor` syscall test suite currently cannot be built with `Nix`. Instead, the `gvisor` tests are compiled in the Docker image. For details, refer to `tools/docker/Dockerfile`.
All benchmarks except `sysbench` support both `x86_64` and `riscv64` architectures.
These benchmarks are precompiled and packaged into the Docker image for convenience. Refer to `tools/docker/nix/Dockerfile` for details.
## Adding New Benchmarks
We recommend utilizing `Nix` when adding new benchmarks. To check if a benchmark is already available, use the [`Nix Package Search`](https://search.nixos.org/packages?channel=25.05). If a package exists in the Nix channel, you can directly use it or modify it if necessary.
If the desired benchmark is not available or cannot be easily adapted, you can add a custom `.nix` file to package it manually. Place the `.nix` files under the `test/initramfs/nix/benchmark` directory.