Skip to content

Feature/ext4:: 接入测试脚本扫描和相对路径转换

不让内核死机 requested to merge feature/ext4 into main

变更说明

本次将 EXT4 路径级能力接入 runner,补齐 VFS / 文件访问接口。

新增接口

  • list_test_scripts(path)

    • 扫描指定目录下的 *_testcode.sh
    • 对结果排序
    • 打印 [fs] found test script: ...
  • resolve_path(base_dir, path)

    • 支持 ./busybox -> /glibc/busybox
    • 支持 musl 目录下的相同转换
    • 拒绝包含 .. 的非法路径

文件读取稳定性

  • read_file_by_path(path, max_len) 失败时打印路径和错误原因
  • 不存在文件返回错误,不 panic
  • /glibc/busybox 大文件读取成功

runner 接入

  • 扫描 /glibc/musl
  • 自动发现全部 *_testcode.sh
  • 当前仍只执行排序后的第一份脚本
  • 不再写死 /glibc/basic_testcode.sh

文档同步

更新:

  • docs/EXT4_INTERFACE.md
  • docs/EXT4_STATUS.md

验证结果

已执行:

CARGO_TARGET_DIR=/tmp/oskernel-cargo-target cargo check --target riscv64gc-unknown-none-elf
bash scripts/run_ours.sh

QEMU 退出码:

0

脚本扫描结果:

/glibc: 12 scripts
/musl: 12 scripts

关键日志:

[fs] found test script: /glibc/basic_testcode.sh
[fs] found test script: /musl/basic_testcode.sh
[runner] program = /glibc/busybox
[execve] read elf from ext4 ok: /glibc/busybox bytes=1937944
[fs] read file failed: path=/proc/self/exe error=EXT4 backend error: EXT4 path not found

## 后续工作

- runner 顺序执行扫描到的全部脚本
- 完善 VFS file handle
- 继续推进 busybox syscall 兼容

Merge request reports