Browse Source

fix(penglai): add changelog file, add CI workflow checks to penglai crate (#143)

* fix(xtask): cross-platform ExitStatus, to make xtask build under non-unix platforms

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>

* fix(penglai): add changelog file, add CI workflow checks to `penglai` crate

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>

---------

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
Luo Jia / Zhouqi Jiang 1 day ago
parent
commit
64a1f9dd1c
5 changed files with 37 additions and 0 deletions
  1. 21 0
      .github/workflows/Library.yml
  2. 1 0
      Cargo.toml
  3. 7 0
      library/penglai/CHANGELOG.md
  4. 4 0
      xtask/src/bench.rs
  5. 4 0
      xtask/src/test.rs

+ 21 - 0
.github/workflows/Library.yml

@@ -89,6 +89,21 @@ jobs:
       - name: Run tests
         run: cargo test -p sbi-spec --verbose
 
+  test-penglai:
+    name: Test `penglai` crate
+    needs: fmt
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - uses: actions-rust-lang/setup-rust-toolchain@v1
+        with:
+          toolchain: nightly
+      - uses: Swatinem/rust-cache@v2
+      # - name: Check clippy
+      #   run: cargo clippy -- -D warnings
+      - name: Run tests
+        run: cargo test -p penglai --verbose
+
   build-sbi-rt:
     name: Build sbi-rt
     needs: fmt
@@ -156,6 +171,9 @@ jobs:
         sbi_spec_TARGET:
           - riscv64imac-unknown-none-elf
           - riscv32imac-unknown-none-elf
+        penglai_TARGET:
+          - riscv64imac-unknown-none-elf
+          - riscv32imac-unknown-none-elf
         TOOLCHAIN:
           - nightly-2025-04-22
     steps:
@@ -172,6 +190,7 @@ jobs:
           rustup target add ${{ matrix.sbi_rt_TARGET }}
           rustup target add ${{ matrix.sbi_testing_TARGET }}
           rustup target add ${{ matrix.sbi_spec_TARGET }}
+          rustup target add ${{ matrix.penglai_TARGET }}
       - uses: Swatinem/rust-cache@v2
         with:
           key: ${{ matrix.TOOLCHAIN }}
@@ -183,6 +202,8 @@ jobs:
         run: cargo check --target ${{ matrix.sbi_testing_TARGET }} -p sbi-testing
       - name: Check sbi-spec (compilation check)
         run: cargo check --target ${{ matrix.sbi_spec_TARGET }} -p sbi-spec
+      - name: Check penglai (compilation check)
+        run: cargo check --target ${{ matrix.penglai_TARGET }} -p penglai
 # sbi-testing:
 #     name: Run rust-clippy analyzing
 #     runs-on: ubuntu-latest

+ 1 - 0
Cargo.toml

@@ -17,6 +17,7 @@ default-members = [
     "library/sbi-rt",
     "library/sbi-spec",
     "library/rustsbi",
+    "library/penglai",
 ]
 
 [workspace.package]

+ 7 - 0
library/penglai/CHANGELOG.md

@@ -0,0 +1,7 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]

+ 4 - 0
xtask/src/bench.rs

@@ -58,7 +58,11 @@ pub fn run(arg: &BenchArg) -> Option<ExitStatus> {
             }
             Err(err_msg) => {
                 error!("{}", err_msg);
+                // TODO cross-platform ExitStatus return value
+                #[cfg(unix)]
                 return Some(<ExitStatus as std::os::unix::process::ExitStatusExt>::from_raw(1));
+                #[cfg(not(unix))]
+                return None;
             }
         }
     } else {

+ 4 - 0
xtask/src/test.rs

@@ -55,7 +55,11 @@ pub fn run(arg: &TestArg) -> Option<ExitStatus> {
             }
             Err(err_msg) => {
                 error!("{}", err_msg);
+                // TODO cross-platform ExitStatus return value
+                #[cfg(unix)]
                 return Some(<ExitStatus as std::os::unix::process::ExitStatusExt>::from_raw(1));
+                #[cfg(not(unix))]
+                return None;
             }
         }
     } else {