Rename apps to regression

This commit is contained in:
Qingsong Chen 2026-02-10 08:20:49 +00:00
parent e6104161b7
commit 6e79dc14d2
190 changed files with 60 additions and 58 deletions

View File

@ -6,7 +6,7 @@ branding:
inputs:
# Test Configuration
auto_test:
description: 'Test type (general, osdk, boot, syscall, test)'
description: 'Test type (general, osdk, boot, syscall, regression)'
required: true
release:
description: 'Whether to run in release mode'

View File

@ -85,12 +85,12 @@ jobs:
boot_protocol: 'multiboot2'
smp: 4
# General Test (Linux EFI Handover) (Debug Build)
- test_id: 'general-handover64-debug'
# Regression Test (Linux EFI Handover) (Debug Build)
- test_id: 'regression-handover64-debug'
release: false
boot_protocol: 'linux-efi-handover64'
# SMP General Test (Multiboot2)
- test_id: 'general-multiboot2-smp4'
# SMP Regression Test (Multiboot2)
- test_id: 'regression-multiboot2-smp4'
boot_protocol: 'multiboot2'
smp: 4
fail-fast: false
@ -103,7 +103,7 @@ jobs:
uses: ./.github/actions/test
with:
auto_test: ${{ (startsWith(matrix.test_id, 'boot') && 'boot') ||
(startsWith(matrix.test_id, 'syscall') && 'syscall') || 'test' }}
(startsWith(matrix.test_id, 'syscall') && 'syscall') || 'regression' }}
release: ${{ !contains(matrix.release, 'false') }}
enable_kvm: ${{ !contains(matrix.enable_kvm, 'false') }}
smp: ${{ matrix.smp }}
@ -118,7 +118,7 @@ jobs:
uses: ./.github/actions/test
with:
auto_test: ${{ (startsWith(matrix.test_id, 'boot') && 'boot') ||
(startsWith(matrix.test_id, 'syscall') && 'syscall') || 'test' }}
(startsWith(matrix.test_id, 'syscall') && 'syscall') || 'regression' }}
release: ${{ !contains(matrix.release, 'false') }}
enable_kvm: ${{ !contains(matrix.enable_kvm, 'false') }}
smp: ${{ matrix.smp }}

View File

@ -33,10 +33,10 @@ jobs:
netdev: 'tap'
smp: 4
# General Test
- test_id: 'general'
# SMP General Test
- test_id: 'general-tap-smp4'
# Regression Test
- test_id: 'regression'
# SMP Regression Test
- test_id: 'regression-tap-smp4'
netdev: 'tap'
smp: 4
fail-fast: false
@ -46,7 +46,7 @@ jobs:
uses: ./.github/actions/test
with:
auto_test: ${{ startsWith(matrix.test_id, 'boot') && 'boot' ||
startsWith(matrix.test_id, 'syscall') && 'syscall' || 'test' }}
startsWith(matrix.test_id, 'syscall') && 'syscall' || 'regression' }}
intel_tdx: true
release: true
smp: ${{ matrix.smp }}

View File

@ -21,8 +21,8 @@ OSTD_TASK_STACK_SIZE_IN_PAGES ?= 64
FEATURES ?=
NO_DEFAULT_FEATURES ?= 0
COVERAGE ?= 0
# Specify whether to build regression tests under `test/initramfs/src/apps`.
ENABLE_BASIC_TEST ?= false
# Specify whether to build regression tests under `test/initramfs/src/regression`.
ENABLE_REGRESSION_TEST ?= false
# Specify the primary system console (supported: tty0, ttyS0, hvc0).
# - tty0: The active virtual terminal (VT).
# - ttyS0: The serial (UART) terminal.
@ -97,18 +97,18 @@ CARGO_OSDK_BUILD_ARGS += --kcmd-args="SYSCALL_TEST_SUITE=$(SYSCALL_TEST_SUITE)"
CARGO_OSDK_BUILD_ARGS += --kcmd-args="SYSCALL_TEST_WORKDIR=$(SYSCALL_TEST_WORKDIR)"
CARGO_OSDK_BUILD_ARGS += --kcmd-args="EXTRA_BLOCKLISTS_DIRS=$(EXTRA_BLOCKLISTS_DIRS)"
CARGO_OSDK_BUILD_ARGS += --init-args="/opt/syscall_test/run_syscall_test.sh"
else ifeq ($(AUTO_TEST), test)
ENABLE_BASIC_TEST := true
else ifeq ($(AUTO_TEST), regression)
ENABLE_REGRESSION_TEST := true
ifneq ($(SMP), 1)
CARGO_OSDK_BUILD_ARGS += --kcmd-args="BLOCK_UNSUPPORTED_SMP_TESTS=1"
endif
CARGO_OSDK_BUILD_ARGS += --kcmd-args="INTEL_TDX=$(INTEL_TDX)"
CARGO_OSDK_BUILD_ARGS += --init-args="/test/run_general_test.sh"
CARGO_OSDK_BUILD_ARGS += --init-args="/test/run_regression_test.sh"
else ifeq ($(AUTO_TEST), boot)
ENABLE_BASIC_TEST := true
ENABLE_REGRESSION_TEST := true
CARGO_OSDK_BUILD_ARGS += --init-args="/test/boot_hello.sh"
else ifeq ($(AUTO_TEST), vsock)
ENABLE_BASIC_TEST := true
ENABLE_REGRESSION_TEST := true
export VSOCK=on
CARGO_OSDK_BUILD_ARGS += --init-args="/test/run_vsock_test.sh"
endif
@ -315,9 +315,9 @@ run_kernel: initramfs $(CARGO_OSDK)
ifeq ($(AUTO_TEST), syscall)
@tail --lines 100 qemu.log | grep -q "^All syscall tests passed." \
|| (echo "Syscall test failed" && exit 1)
else ifeq ($(AUTO_TEST), test)
@tail --lines 100 qemu.log | grep -q "^All general tests passed." \
|| (echo "General test failed" && exit 1)
else ifeq ($(AUTO_TEST), regression)
@tail --lines 100 qemu.log | grep -q "^All regression tests passed." \
|| (echo "Regression test failed" && exit 1)
else ifeq ($(AUTO_TEST), boot)
@tail --lines 100 qemu.log | grep -q "^Successfully booted." \
|| (echo "Boot test failed" && exit 1)

View File

@ -32,12 +32,12 @@ cargo osdk test
## Integration Test
### General Test
### Regression Test
The following command builds and runs the test binaries in `test/initramfs/src/apps` directory on Asterinas.
The following command builds and runs the test binaries in `test/initramfs/src/regression` directory on Asterinas.
```bash
make run_kernel AUTO_TEST=test
make run_kernel AUTO_TEST=regression
```
### Syscall Test

View File

@ -5,7 +5,7 @@ SMP ?= 1
VERBOSE ?= 1
SYSCALL_TEST_SUITE ?= ltp
SYSCALL_TEST_WORKDIR ?= /tmp
ENABLE_BASIC_TEST ?= false
ENABLE_REGRESSION_TEST ?= false
# Specify platform macros when building regression tests (supported: asterinas, linux).
# - asterinas: Define both `__asterinas__` and `__linux__`. Tests may fail in Linux.
# - linux: Define only `__linux__`. Tests may fail in Asterinas.
@ -65,7 +65,7 @@ $(INITRAMFS_IMAGE): $(INITRAMFS)
@nix-build \
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
--argstr target $(OSDK_TARGET_ARCH) \
--arg enableBasicTest $(ENABLE_BASIC_TEST) \
--arg enableRegressionTest $(ENABLE_REGRESSION_TEST) \
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
--arg enableBenchmark $(ENABLE_BENCHMARK) \
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
@ -82,7 +82,7 @@ $(INITRAMFS):
@nix-build \
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
--argstr target $(OSDK_TARGET_ARCH) \
--arg enableBasicTest $(ENABLE_BASIC_TEST) \
--arg enableRegressionTest $(ENABLE_REGRESSION_TEST) \
--argstr basicTestPlatform $(BASIC_TEST_PLATFORM) \
--arg enableBenchmark $(ENABLE_BENCHMARK) \
--arg enableSyscallTest $(ENABLE_SYSCALL_TEST) \
@ -104,7 +104,7 @@ x86_64_pkgs:
--arg enableSyscallTest true \
--out-link /nix/var/nix/gcroots/auto/x86_64-pkgs \
-A busybox \
-A apps.package \
-A regression.package \
-A benchmark.fio \
-A benchmark.hackbench \
-A benchmark.iperf3 \
@ -130,7 +130,7 @@ riscv64_pkgs:
--arg enableSyscallTest true \
--out-link /nix/var/nix/gcroots/auto/riscv64-pkgs \
-A busybox \
-A apps.package \
-A regression.package \
-A syscall.ltp
general_pkgs:
@ -139,7 +139,7 @@ general_pkgs:
--tarball-ttl $(NIXPKGS_CACHE_TTL) \
$(NIX_QUIET) \
--out-link /nix/var/nix/gcroots/auto/general \
-A apps.mongoose_src
-A regression.mongoose_src
install_host_pkgs:
@nix-env \
@ -178,12 +178,12 @@ $(EXFAT_IMAGE):
.PHONY: format
format:
@$(MAKE) --no-print-directory -C src/apps format
@$(MAKE) --no-print-directory -C src/regression format
@nixfmt nix
.PHONY: check
check:
@$(MAKE) --no-print-directory -C src/apps check
@$(MAKE) --no-print-directory -C src/regression check
@nixfmt --check nix
.PHONY: clean

View File

@ -7,7 +7,7 @@ This directory contains the test suites of Asterinas running in initramfs, inclu
```
test/
├── src/
│ ├── apps/ # Handwritten test applications
│ ├── regression/ # Regression tests
│ ├── benchmark/ # Supported benchmark test suites
│ ├── etc/ # Configuration files
│ └── syscall/ # Syscall test suites
@ -16,7 +16,7 @@ test/
├── nix/
│ ├── benchmark/ # Nix expressions for `benchmark`
│ ├── syscall/ # Nix expressions for `syscall`
│ ├── apps.nix # Nix expression for `apps`
│ ├── regression.nix # Nix expression for `regression`
│ └── initramfs.nix # Nix expression for packaging initramfs
├── Makefile
└── README.md
@ -26,7 +26,7 @@ test/
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.
> **Note**: If you are adding a new test to the `regression` directory, ensure that it supports multiple architectures. Some of the existing tests lack proper architecture-specific handling.
### Syscall Test Suite - Gvisor Exception
@ -73,11 +73,11 @@ If the desired benchmark is not available or cannot be easily adapted, you can a
## Configuration Files
Configuration files required by benchmarks or apps should be placed in the `test/initramfs/src/etc` directory.
Configuration files required by benchmarks or regression tests should be placed in the `test/initramfs/src/etc` directory.
If additional configuration files or directories are needed, ensure they are appropriately packaged by updating the `initramfs.nix` file.
## Notes for Developers
- **Nix Usage**: Use `Nix` whenever possible to manage dependencies and builds for ease of maintenance and consistency.
- **Multi-Architecture Support**: Ensure new apps or benchmarks properly support multiple CPU architectures.
- **Multi-Architecture Support**: Ensure new regression tests or benchmarks properly support multiple CPU architectures.

View File

@ -1,5 +1,6 @@
{ target ? "x86_64", enableBasicTest ? false, basicTestPlatform ? "asterinas"
, enableBenchmark ? false, enableSyscallTest ? false, syscallTestSuite ? "ltp"
{ target ? "x86_64", enableRegressionTest ? false
, basicTestPlatform ? "asterinas", enableBenchmark ? false
, enableSyscallTest ? false, syscallTestSuite ? "ltp"
, syscallTestWorkDir ? "/tmp", dnsServer ? "none", smp ? 1
, initramfsCompressed ? true, }:
let
@ -23,7 +24,8 @@ let
};
in rec {
# Packages needed by initramfs
apps = pkgs.callPackage ./apps.nix { testPlatform = basicTestPlatform; };
regression =
pkgs.callPackage ./regression.nix { testPlatform = basicTestPlatform; };
busybox = pkgs.busybox;
benchmark = pkgs.callPackage ./benchmark { };
syscall = pkgs.callPackage ./syscall {
@ -33,7 +35,7 @@ in rec {
};
initramfs = pkgs.callPackage ./initramfs.nix {
inherit busybox;
apps = if enableBasicTest then apps else null;
regression = if enableRegressionTest then regression else null;
benchmark = if enableBenchmark then benchmark else null;
syscall = if enableSyscallTest then syscall else null;
dnsServer = dnsServer;

View File

@ -1,5 +1,5 @@
{ lib, stdenvNoCC, fetchFromGitHub, hostPlatform, writeClosure, busybox, apps
, benchmark, syscall, dnsServer, pkgs }:
{ lib, stdenvNoCC, fetchFromGitHub, hostPlatform, writeClosure, busybox
, regression, benchmark, syscall, dnsServer, pkgs }:
let
etc = lib.fileset.toSource {
root = ./../src/etc;
@ -16,7 +16,7 @@ let
# Whether the initramfs should include evtest, a common tool to debug input devices (`/dev/input/eventX`)
is_evtest_included = false;
all_pkgs = [ busybox etc resolv_conf ]
++ lib.optionals (apps != null) [ apps.package ]
++ lib.optionals (regression != null) [ regression.package ]
++ lib.optionals (benchmark != null) [ benchmark.package ]
++ lib.optionals (syscall != null) [ syscall.package ]
++ lib.optionals is_evtest_included [ pkgs.evtest ];
@ -39,8 +39,8 @@ in stdenvNoCC.mkDerivation {
cp ${resolv_conf}/resolv.conf $out/etc/
${lib.optionalString (apps != null) ''
cp -r ${apps.package}/* $out/test/
${lib.optionalString (regression != null) ''
cp -r ${regression.package}/* $out/test/
''}
${lib.optionalString (benchmark != null) ''

View File

@ -12,11 +12,11 @@
};
package = stdenv.mkDerivation {
pname = "apps";
pname = "regression";
version = "0.1.0";
src = lib.fileset.toSource {
root = ./../src;
fileset = ./../src/apps;
fileset = ./../src/regression;
};
MONGOOSE_DIR = "${mongoose_src}";
@ -34,10 +34,10 @@
buildCommand = ''
BUILD_DIR=$(mktemp -d)
mkdir -p $BUILD_DIR
cp -r $src/apps $BUILD_DIR/
cp -r $src/regression $BUILD_DIR/
pushd $BUILD_DIR
make --no-print-directory -C apps
make --no-print-directory -C regression
popd
mkdir -p $out

View File

@ -74,12 +74,12 @@ $(TEST_APPS):
.PHONY: format
format:
@echo "Fixing code format for general tests..."
@echo "Fixing code format for regression tests..."
@clang-format -i $(C_SOURCES)
.PHONY: check
check:
@echo "Checking code format for general tests..."
@echo "Checking code format for regression tests..."
@clang-format --dry-run --Werror $(C_SOURCES)
$(TEST_BUILD_DIR):

Some files were not shown because too many files have changed in this diff Show More