diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1892da..ed09d46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,7 +81,7 @@ jobs: autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \ gawk build-essential bison flex texinfo gperf libtool patchutils bc \ zlib1g-dev libexpat1-dev pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev libslirp-dev \ - python3 python3-pip ninja-build + python3 python3-pip ninja-build e2fsprogs - name: 📥 Cache QEMU Build and Installation uses: actions/cache@v4 diff --git a/data/iperf_testcode_comix.sh b/data/iperf_testcode_comix.sh deleted file mode 100755 index 9ce7189..0000000 --- a/data/iperf_testcode_comix.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -# -# Comix-friendly iperf3 test script. -# -# Differences vs data/iperf_testcode.sh: -# - Avoids `-D` (daemon mode) which is fragile on minimal userlands. -# - Uses `-1` (one-off) and runs server in background per test case. -# - Redirects logs to /tmp to keep console clean and help debugging. -# - -host="${HOST:-127.0.0.1}" -port="${PORT:-5001}" -iperf="${IPERF:-iperf3}" - -# Keep consistent with the original test intent: extremely high send rate for UDP. -udp_bw="${UDP_BW:-1000G}" -duration="${DURATION:-2}" -parallel="${PARALLEL:-5}" - -mkdir -p /tmp - -echo "#### OS COMP TEST GROUP START iperf ####" - -pass=0 -fail=0 - -run_case() { - name="$1" - server_args="$2" - client_args="$3" - - s_log="/tmp/iperf3_${name}_s.log" - c_log="/tmp/iperf3_${name}_c.log" - rm -rf "$s_log" "$c_log" - - echo "====== iperf $name begin ======" - - # Best-effort cleanup from previous runs. - killall iperf3 2>/dev/null - - # Start one-off server in background. - $iperf $server_args >"$s_log" 2>&1 & - s_pid=$! - - # Give server time to bind/listen. - sleep 1 - - # Run client in foreground to capture return code. - $iperf $client_args >"$c_log" 2>&1 - rc=$? - - # Best-effort: don't hang forever if server doesn't exit. - sleep 1 - if kill -0 "$s_pid" 2>/dev/null; then - kill "$s_pid" 2>/dev/null - sleep 1 - kill -9 "$s_pid" 2>/dev/null - fi - killall iperf3 2>/dev/null - - if [ "$rc" -eq 0 ]; then - ans="success" - pass=$((pass + 1)) - else - ans="fail" - fail=$((fail + 1)) - fi - - echo "====== iperf $name end: $ans (rc=$rc) ======" - echo " server_log=$s_log" - echo " client_log=$c_log" - echo "" -} - -# Server template -srv_base="-s -4 -p $port -1" - -# Client template -cli_base="-4 -c $host -p $port -t $duration -i 0" - -# basic test -run_case "BASIC_UDP" "$srv_base" "$cli_base -u -b $udp_bw" -run_case "BASIC_TCP" "$srv_base" "$cli_base" - -# parallel test -run_case "PARALLEL_UDP" "$srv_base" "$cli_base -u -P $parallel -b $udp_bw" -run_case "PARALLEL_TCP" "$srv_base" "$cli_base -P $parallel" - -# reverse test (server sends, client receives) -run_case "REVERSE_UDP" "$srv_base" "$cli_base -u -R -b $udp_bw" -run_case "REVERSE_TCP" "$srv_base" "$cli_base -R" - -echo "#### OS COMP TEST GROUP END iperf ####" -echo "iperf summary: pass=$pass fail=$fail" - -# Exit non-zero if any case failed (friendlier for CI) -if [ "$fail" -ne 0 ]; then - exit 1 -fi -exit 0 diff --git a/data/netperf_testcode.sh b/data/netperf_testcode.sh deleted file mode 100755 index 4e945db..0000000 --- a/data/netperf_testcode.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -ip="${IP:-127.0.0.1}" -port="${PORT:-12865}" - -/bin/busybox echo "#### OS COMP TEST GROUP START netperf-musl ####" - -run_netperf() { - echo "====== netperf $1 begin ======" - /bin/netperf -H "$ip" -p "$port" -t "$1" -l 1 -- $2 - if [ $? = 0 ]; then - ans="success" - else - ans="fail" - fi - echo "====== netperf $1 end: $ans ======" -} - -/bin/netserver -D -L "$ip" -p "$port" & -server_pid=$! - -run_netperf UDP_STREAM "-s 16k -S 16k -m 1k -M 1k" -run_netperf TCP_STREAM "-s 16k -S 16k -m 1k -M 1k" -run_netperf UDP_RR "-s 16k -S 16k -m 1k -M 1k -r 64,64 -R 1" -run_netperf TCP_RR "-s 16k -S 16k -m 1k -M 1k -r 64,64 -R 1" -run_netperf TCP_CRR "-s 16k -S 16k -m 1k -M 1k -r 64,64 -R 1" - -kill -9 "$server_pid" - -/bin/busybox echo "#### OS COMP TEST GROUP END netperf-musl ####" diff --git a/data/risc-v_musl/bin/iperf3 b/data/risc-v_musl/bin/iperf3 deleted file mode 100755 index 2944b29..0000000 Binary files a/data/risc-v_musl/bin/iperf3 and /dev/null differ diff --git a/data/risc-v_musl/bin/netperf b/data/risc-v_musl/bin/netperf deleted file mode 100755 index c9ccbdf..0000000 Binary files a/data/risc-v_musl/bin/netperf and /dev/null differ diff --git a/data/risc-v_musl/bin/netserver b/data/risc-v_musl/bin/netserver deleted file mode 100755 index dd21f0e..0000000 Binary files a/data/risc-v_musl/bin/netserver and /dev/null differ diff --git a/data/risc-v_musl/iperf_testcode.sh b/data/risc-v_musl/iperf_testcode.sh deleted file mode 100644 index 5dd9882..0000000 --- a/data/risc-v_musl/iperf_testcode.sh +++ /dev/null @@ -1,42 +0,0 @@ -host="127.0.0.1" -port="5001" -iperf="iperf3" - - -echo "#### OS COMP TEST GROUP START iperf ####" - - -run_iperf() { - name=$1 - args=$2 - echo "====== iperf $name begin ======" - - $iperf -c $host -p $port -t 2 -i 0 $args - if [ $? == 0 ]; then - ans="success" - else - ans="fail" - fi - - echo "====== iperf $name end: $ans ======" - echo "" -} - - -#start server -$iperf -s -p $port -D - -#basic test -run_iperf "BASIC_UDP" "-u -b 1000G" -run_iperf "BASIC_TCP" "" - -#parallel test -run_iperf "PARALLEL_UDP" "-u -P 5 -b 1000G" -run_iperf "PARALLEL_TCP" "-P 5" - -#reverse test (server sends, client recieves) -run_iperf "REVERSE_UDP" "-u -R -b 1000G" -run_iperf "REVERSE_TCP" "-R" - - -echo "#### OS COMP TEST GROUP END iperf ####" \ No newline at end of file diff --git a/data/tmp/.gitkeep b/data/tmp/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/os/build.rs b/os/build.rs index 976f6a8..2f67220 100644 --- a/os/build.rs +++ b/os/build.rs @@ -98,7 +98,8 @@ fn main() { if force_rebuild || should_rebuild(&fs_img_path, &dependencies) { println!( - "cargo:warning=[build.rs] Creating full ext4 runtime image (4GB) at fs.img..." + "cargo:warning=[build.rs] Creating full ext4 runtime image at {}...", + fs_img_name ); create_full_ext4_image(&fs_img_path, &data_dir, &project_root); let _ = fs::write(&arch_stamp, format!("{}\n", arch_key)); @@ -251,11 +252,11 @@ fn create_empty_ext4_image(path: &PathBuf, size_mb: usize) { /// 创建完整的 ext4 镜像 (包含 data/) fn create_full_ext4_image(path: &PathBuf, data_dir: &Path, _project_root: &Path) { - const IMG_SIZE_MB: usize = 4096; // 4GB + const IMG_SIZE_MB: usize = 512; // 512MB const BLOCK_SIZE: usize = 1024 * 1024; println!( - "cargo:warning=[build.rs] Creating {}MB (4GB) full ext4 image at {}", + "cargo:warning=[build.rs] Creating {}MB full ext4 image at {}", IMG_SIZE_MB, path.display() ); @@ -299,11 +300,13 @@ fn create_full_ext4_image(path: &PathBuf, data_dir: &Path, _project_root: &Path) .arg("4096") .arg("-m") .arg("0") + .arg("-g") + .arg("512") // 每组 512 块 (2MB),确保生成多个块组以避免 ext4_rs bug + .arg("-N") + .arg("65536") // 显式指定 inode 数量,避免小镜像 inode 不足 .arg("-d") .arg(&temp_root) // 使用临时目录作为根 .arg(path) - .stdout(std::process::Stdio::null()) - .stderr(std::process::Stdio::null()) .status() .expect("Failed to execute mkfs.ext4"); @@ -314,7 +317,7 @@ fn create_full_ext4_image(path: &PathBuf, data_dir: &Path, _project_root: &Path) // 5. 清理临时目录 fs::remove_dir_all(&temp_root).ok(); - println!("cargo:warning=[build.rs] Full ext4 image created successfully (1GB)."); + println!("cargo:warning=[build.rs] Full ext4 image created successfully ({}MB).", IMG_SIZE_MB); } /// 递归复制目录