Skip to content

Commit

Permalink
Configure CI to run Mirage tests
Browse files Browse the repository at this point in the history
This commit configures the CI to run `just test` on each PR for the main
branch.
  • Loading branch information
CharlyCst committed Jan 21, 2024
1 parent d216e20 commit dde4a94
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
branches: [ "main", "ci" ]
pull_request:
branches: [ "main", "ci" ]

env:
CARGO_TERM_COLOR: always

jobs:
Mirage:
runs-on: ubuntu-22.04
env:
RUSTFLAGS: --deny warnings
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v1 # Install `just`
- name: Setup
run: just install-toolchain
run: rustup component list
- name: Test
run: just test

7 changes: 7 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,12 @@ run-dbg:
gdb:
rust-gdb {{mirage_elf}} -q -x "./config/setup.gdb"

# Install the rust toolchain and required components
install-toolchain:
rustup toolchain install $(cat rust-toolchain)
rustup component add rustc --toolchain "$(cat rust-toolchain)"
rustup component add rust-src --toolchain "$(cat rust-toolchain)"
rustup component add llvm-tools-preview --toolchain "$(cat rust-toolchain)"

# The following line gives highlighting on vim
# vim: set ft=make :
2 changes: 1 addition & 1 deletion payloads/csr_ops/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn test_csr_op(regs: &[(usize, usize, usize)]) {
check_csrrs(*in_rs1, *in_csr, out_csr, out_rd);
}
// CSRRWI
for (in_rd, in_rs1, in_csr) in regs {
for (in_rd, _, in_csr) in regs {
let (out_csr, out_rd) = unsafe { csrrwi(*in_csr, *in_rd) };
check_csrrwi(*in_csr, out_csr, out_rd);
}
Expand Down
8 changes: 6 additions & 2 deletions runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ fn objcopy(target: &Target) -> PathBuf {
.arg(elf_path)
.arg(&bin_path);

if !objopy_cmd.status().unwrap().success() {
panic!("objcopy failed - is `rust-objcopy` installed? Try installing with `rustup component add llvm-tools`");
if !objopy_cmd
.status()
.expect("objcopy failed. Is `rust-objcopy` installed?")
.success()
{
panic!("objcopy failed");
}

bin_path
Expand Down
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly-2023-12-22

0 comments on commit dde4a94

Please sign in to comment.