-
Notifications
You must be signed in to change notification settings - Fork 17
Utilize GitHub Actions for building and running via QEMU #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job
The error_desc array and the perror pointer are never modified after initialization. Marking them as const moves the data to the read-only section, improving safety. Before: $ riscv-none-elf-size ./build/kernel/error.o text data bss dec hex filename 398 172 0 570 23a ./build/kernel/error.o After: $ riscv-none-elf-size ./build/kernel/error.o text data bss dec hex filename 570 0 0 570 23a ./build/kernel/error.o
strlen() returns the length of the input string, which is always non‑negative. Switching the return type to size_t is more accurately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase the latest main
branch.
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.06.13/riscv32-elf-ubuntu-22.04-gcc-nightly-2025.06.13-nightly.tar.xz | ||
tar -xf riscv32-elf-ubuntu-22.04-gcc-nightly-2025.06.13-nightly.tar.xz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to dedicated scripts. See https://github.com/sysprog21/rv32emu/tree/master/.ci for reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you prefer keeping the scripts in a .ci/
directory (as in rv32emu),
or splitting them into a more general scripts/
directory for better reuse —
for example, by developers who want to build and run the kernel locally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you prefer keeping the scripts in a
.ci/
directory (as in rv32emu), or splitting them into a more generalscripts/
directory for better reuse — for example, by developers who want to build and run the kernel locally?
All CI-specific scripts should be placed in the .ci
directory, as they are not intended for general use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove lib/libc.c
and do git rebase
.
Next time, don't submit pull request via |
The workflow now extracts cpubench results from QEMU output and automatically comments the result on pull requests. Improve CI workflow with QEMU, cpubench, timeout I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job Fix merge conflict markers in CI workflow file Use Ubuntu 24.04 in CI workflow Remove merge conflict markers from error.c Remove merge conflict markers from error.h Remove redundant libc.h include from libc.c Delete libc.c
Got it. |
Marking this PR as a draft while I work on extracting the scripts from the workflow. Will reopen this PR or open a new one once the improvements are complete. |
A new PR is open #12 |
Fixes #2 Improves upon PR sysprog21#11 - Build Linmo kernel using RISC-V GNU toolchain - Run selected apps (e.g., cpubench) inside QEMU - Auto-extract test output and post results as PR comments - Move toolchain setup, build, and QEMU run logic to `.ci/` scripts - Introduce flexible script-based test sequencing and suite support - Improve CI maintainability and transparency for contributors Limitations: - Current tests (like cpubench) are not designed for full regression testing - Preemptive mode may stop QEMU exit - Only supports GNU toolchain for now; LLVM support WIP
This commit introduces a GitHub Actions workflow to build the Linmo kernel using the GNU RISC-V toolchain and run selected applications (e.g., cpubench) using QEMU. Test output is extracted from QEMU logs and automatically posted as a comment to pull requests. Toolchain setup, kernel build, and QEMU test execution have been modularized into reusable scripts under the `.ci/` directory. Features: - CI supports running multiple apps in a single job - All QEMU runs are time-limited to prevent hangs - Results are reported directly to GitHub PRs Limitations: - Only GNU toolchain is supported (LLVM is a work in progress) - Some test apps (e.g., cpubench) do not exit cleanly due to entering preemptive scheduler mode Fixes: #2 Supersedes: sysprog21#11
Introduce GitHub Actions-based CI that builds the kernel using the GNU RISC-V toolchain and runs selected apps (e.g., cpubench) in QEMU. Results are extracted and posted to PRs. Toolchain setup, build, and QEMU test logic are modularized into scripts in .ci/. Features: - Support multiple apps per run - CI comments results on PR automatically - Timeout prevents hangs Limitations: - Currently GNU-only (LLVM WIP) - cpubench doesn't exit cleanly due to preemptive mode Fixes: #2 Supersedes: sysprog21#11
Introduce GitHub Actions-based CI that builds the kernel using the GNU RISC-V toolchain and runs selected apps (e.g., cpubench) in QEMU. Results are extracted and posted to PRs. Toolchain setup, build, and QEMU test logic are modularized into scripts in .ci/. Features: - Support multiple apps per run - CI comments results on PR automatically - Timeout prevents hangs Limitations: - Currently GNU-only (LLVM WIP) - cpubench doesn't exit cleanly due to preemptive mode Fixes: #2 Supersedes: sysprog21#11
Introduce GitHub Actions-based CI that builds the kernel using the GNU RISC-V toolchain and runs selected apps (e.g., cpubench) in QEMU. Results are extracted and posted to PRs. Toolchain setup, build, and QEMU test logic are modularized into scripts in .ci/. Features: - Support multiple apps per run - CI comments results on PR automatically - Timeout prevents hangs Limitations: - Currently GNU-only (LLVM WIP) - cpubench doesn't exit cleanly due to preemptive mode Fixes: #2 Supersedes: sysprog21#11
This commit introduces initial support for compiling the RISC-V target using the LLVM toolchain. Add CI workflow to build and test with QEMU Introduce GitHub Actions-based CI that builds the kernel using the GNU RISC-V toolchain and runs selected apps (e.g., cpubench) in QEMU. Results are extracted and posted to PRs. Toolchain setup, build, and QEMU test logic are modularized into scripts in .ci/. Features: - Support multiple apps per run - CI comments results on PR automatically - Timeout prevents hangs Limitations: - Currently GNU-only (LLVM WIP) - cpubench doesn't exit cleanly due to preemptive mode Fixes: #2 Supersedes: sysprog21#11 Refactor riscv build.mk toolchain selection logic Add CI workflow for building and testing Improve CI workflow with QEMU, cpubench, timeout I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job ci: refactor QEMU test workflow and extract scripts The workflow now extracts cpubench results from QEMU output and automatically comments the result on pull requests. Improve CI workflow with QEMU, cpubench, timeout I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job Fix merge conflict markers in CI workflow file Use Ubuntu 24.04 in CI workflow Remove merge conflict markers from error.c Remove merge conflict markers from error.h Remove redundant libc.h include from libc.c Delete libc.c Add CI scripts and refactor workflow - Move toolchain setup, build, QEMU run, and result extraction to dedicated scripts in .ci/ - Update ci.yml to use these scripts for improved maintainability Make CI scripts executable Add flexible test sequencing and CI test suites - Replace run-qemu.sh with run-test-sequence.sh for configurable, robust test execution (supports timeouts, app lists, output dirs, continue-on-failure, and verbosity) - Add run-qemu-tests.sh for simple sequential app testing - Add test suite definitions: basic.txt, performance.txt, comprehensive.txt - Overhaul extract-result.sh to aggregate, summarize, and format results for GitHub Actions and artifacts - Update CI workflow to run multiple test suites (basic, performance, comprehensive, custom), upload artifacts, and generate a consolidated summary - Remove obsolete run-qemu.sh script Simplify CI test runner and result extraction Comment PR with benchmark results in CI workflow Run all basic apps in CI and comment results on PRs Remove extract-result.sh and update CI to inline test output Update QEMU tests to run cpubench and test64 only Inline build steps in CI workflow and remove build.sh
This commit introduces initial support for compiling the RISC-V target using the LLVM toolchain. Add CI workflow to build and test with QEMU Introduce GitHub Actions-based CI that builds the kernel using the GNU RISC-V toolchain and runs selected apps (e.g., cpubench) in QEMU. Results are extracted and posted to PRs. Toolchain setup, build, and QEMU test logic are modularized into scripts in .ci/. Features: - Support multiple apps per run - CI comments results on PR automatically - Timeout prevents hangs Limitations: - Currently GNU-only (LLVM WIP) - cpubench doesn't exit cleanly due to preemptive mode Fixes: #2 Supersedes: sysprog21#11 Refactor riscv build.mk toolchain selection logic Add CI workflow for building and testing Improve CI workflow with QEMU, cpubench, timeout I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job ci: refactor QEMU test workflow and extract scripts The workflow now extracts cpubench results from QEMU output and automatically comments the result on pull requests. Improve CI workflow with QEMU, cpubench, timeout I notice that the cpu bench will make qemu into Scheduler mode: Preemptive so the qemu will not stop, add some trick to pass the test(not good) Refactor CI workflow for improved toolchain usage Comment out hello build and run step in CI workflow Update RISC-V toolchain and enable hello build step Add -bios none to QEMU commands in CI workflow Remove hello build and run step from CI workflow Add timeout to QEMU command in CI workflow Add completion message to cpubench CI step Allow QEMU step to pass without stopping CI job Fix merge conflict markers in CI workflow file Use Ubuntu 24.04 in CI workflow Remove merge conflict markers from error.c Remove merge conflict markers from error.h Remove redundant libc.h include from libc.c Delete libc.c Add CI scripts and refactor workflow - Move toolchain setup, build, QEMU run, and result extraction to dedicated scripts in .ci/ - Update ci.yml to use these scripts for improved maintainability Make CI scripts executable Add flexible test sequencing and CI test suites - Replace run-qemu.sh with run-test-sequence.sh for configurable, robust test execution (supports timeouts, app lists, output dirs, continue-on-failure, and verbosity) - Add run-qemu-tests.sh for simple sequential app testing - Add test suite definitions: basic.txt, performance.txt, comprehensive.txt - Overhaul extract-result.sh to aggregate, summarize, and format results for GitHub Actions and artifacts - Update CI workflow to run multiple test suites (basic, performance, comprehensive, custom), upload artifacts, and generate a consolidated summary - Remove obsolete run-qemu.sh script Simplify CI test runner and result extraction Comment PR with benchmark results in CI workflow Run all basic apps in CI and comment results on PRs Remove extract-result.sh and update CI to inline test output Update QEMU tests to run cpubench and test64 only Inline build steps in CI workflow and remove build.sh Add LLVM toolchain support to CI and build system Remove test-summary job from CI workflow Update toolchain URLs and add CI test summary job Remove test64 argument from QEMU test script in CI Refactor toolchain URLs and add LLVM fallback in CI workflow Set CROSS_COMPILE to riscv32-unknown-elf- in CI setup Add AR=llvm-ar to LLVM toolchain environment setup Refactor toolchain URL to use TOOLCHAIN_OS variable Refactor RISC-V toolchain selection and defaults Run CI on all branches and pull requests Add __maybe_unused macro for unused attribute Use GNU ar instead of llvm-ar for LLVM toolchain Update toolchain version to verified Detect Clang toolchain in RISC-V build script
Fixes #2
This PR introduces a GitHub Actions CI workflow that:
cpubench
application under QEMUSample output from a successful CI run:
Preview: G36maid#1
Notes
cpubench
enters preemptive mode after benchmark completion, causing it to continue running tasks indefinitely.To ensure
QEMU
terminates in CI, I used atimeout 5s
wrapper.Ongoing Work
hello
,cpubench
, etc.) in sequence.This is just a prototype implementation.
Feel free to comment, suggest improvements, or advertise what kinds of test is needed.