diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index c70925c1..4d4f19c9 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -30,6 +30,9 @@ inputs: required: false # Test Parameters + arch: + description: 'Architecture (x86_64/riscv64)' + required: false extra_blocklists: description: 'Extra blocklists directories' required: false @@ -59,16 +62,16 @@ runs: if: ${{ inputs.auto_test == 'general' }} shell: bash run: | - if [[ "${{ matrix.id }}" == "lint" ]]; then - make check - elif [[ "${{ matrix.id }}" == "compile" ]]; then - make build FEATURES=all - elif [[ "${{ matrix.id }}" == "usermode_test" ]]; then - make test - elif [[ "${{ matrix.id }}" == "ktest" ]]; then - make ktest NETDEV=tap - fi - + CMD="" + [[ "${{ matrix.id }}" == "lint" ]] && CMD+="make check" + [[ "${{ matrix.id }}" == "compile" ]] && CMD+="make build FEATURES=all" + [[ "${{ matrix.id }}" == "usermode_test" ]] && CMD+="make test" + [[ "${{ matrix.id }}" == "ktest" ]] && CMD+="make ktest NETDEV=tap" + [[ -n "${{ inputs.arch }}" ]] && CMD+=" ARCH=${{ inputs.arch }}" + + echo "Executing: $CMD" + eval $CMD + - name: Run integration test if: ${{ !(inputs.auto_test == 'general' || inputs.auto_test == 'osdk') }} shell: bash @@ -80,6 +83,7 @@ runs: [[ -n "${{ inputs.smp }}" ]] && CMD+=" SMP=${{ inputs.smp }}" [[ -n "${{ inputs.netdev }}" ]] && CMD+=" NETDEV=${{ inputs.netdev }}" [[ -n "${{ inputs.scheme }}" ]] && CMD+=" SCHEME=${{ inputs.scheme }}" + [[ -n "${{ inputs.arch }}" ]] && CMD+=" ARCH=${{ inputs.arch }}" [[ -n "${{ inputs.extra_blocklists }}" ]] && CMD+=" EXTRA_BLOCKLISTS_DIRS=${{ inputs.extra_blocklists }}" [[ -n "${{ inputs.syscall_test_dir }}" ]] && CMD+=" SYSCALL_TEST_DIR=${{ inputs.syscall_test_dir }}" [[ -n "${{ inputs.boot_protocol }}" ]] && CMD+=" BOOT_PROTOCOL=${{ inputs.boot_protocol }}" diff --git a/.github/workflows/test_riscv.yml b/.github/workflows/test_riscv.yml new file mode 100644 index 00000000..c95e2636 --- /dev/null +++ b/.github/workflows/test_riscv.yml @@ -0,0 +1,27 @@ +name: "Test riscv64 " + +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + basic-test: + runs-on: ubuntu-latest + container: + image: asterinas/asterinas:0.14.1-20250326 + options: --device=/dev/kvm --privileged + strategy: + matrix: + id: ['lint', 'compile'] + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Run basic tests + uses: ./.github/actions/test + with: + auto_test: 'general' + runs_on: 'ubuntu-latest' + arch: 'riscv64' diff --git a/Makefile b/Makefile index 3317c833..f255770a 100644 --- a/Makefile +++ b/Makefile @@ -289,6 +289,7 @@ format: @$(MAKE) --no-print-directory -C test format .PHONY: check +# FIXME: Make `make check` arch-aware. check: initramfs $(CARGO_OSDK) @./tools/format_all.sh --check # Check Rust format issues @# Check if STD_CRATES and NOSTD_CRATES combined is the same as all workspace members diff --git a/README.md b/README.md index 39afbb4a..1bff4794 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ asterinas-logo
A secure, fast, and general-purpose OS kernel written in Rust and compatible with Linux
Test x86-64 + Test riscv64 Test Intel TDX Benchmark x86-64
diff --git a/README_CN.md b/README_CN.md index 74ed50f4..18740216 100644 --- a/README_CN.md +++ b/README_CN.md @@ -2,6 +2,7 @@ asterinas-logo
一个安全、快速、通用的操作系统内核,使用Rust编写,并与Linux兼容
Test x86-64 + Test riscv64 Test Intel TDX Benchmark x86-64
diff --git a/README_JP.md b/README_JP.md index 99f43354..c64078f5 100644 --- a/README_JP.md +++ b/README_JP.md @@ -2,6 +2,7 @@ asterinas-logo
安全で高速、汎用的なOSカーネル。Rustで書かれ、Linuxと互換性があります
Test x86-64 + Test riscv64 Test Intel TDX Benchmark x86-64
diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index dcb4c754..0f5b79e6 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -34,7 +34,6 @@ cpio-decoder = { path = "libs/cpio-decoder" } intrusive-collections = "0.9.5" paste = "1.0" time = { version = "0.3", default-features = false, features = ["alloc"] } -tdx-guest = { version = "0.2.1", optional = true } # parse elf file xmas-elf = "0.8.0" @@ -62,6 +61,9 @@ cfg-if = "1.0" # TODO: fork this crate to rewrite all the (unnecessary) unsafe usage fixed = "1.28.0" +[target.x86_64-unknown-none.dependencies] +tdx-guest = { version = "0.2.1", optional = true } + [target.riscv64gc-unknown-none-elf.dependencies] riscv = { version = "0.11.1", features = ["s-mode"] }