Skip to content

Commit a4e5508

Browse files
committed
fix workflow test running
1 parent a797a11 commit a4e5508

File tree

4 files changed

+54
-54
lines changed

4 files changed

+54
-54
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# target = "x86_64-unknown-none"
44
rustflags = [
55
# TODO: remove and implement DWARF info based stack tracing
6-
"-C", "force-frame-pointers=true",
6+
"-C", "force-frame-pointers=y",
77
#"-C", "code-model=kernel",
88
#"-C", "relocation-model=static",
99
#"-C", "linker=clang-16",

.github/workflows/rust.yml

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,64 +12,54 @@ env:
1212
jobs:
1313

1414
unit-tests:
15-
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
rust-version: [nightly-2023-05-15]
18+
os: [ubuntu-latest]
19+
20+
runs-on: ${{ matrix.os }}
21+
1622
steps:
1723
- uses: actions/checkout@v3
18-
19-
- name: Rust Cache
24+
25+
#- run: apt update # only on ACT
26+
27+
- uses: awalsh128/cache-apt-pkgs-action@latest
28+
with:
29+
packages: jq xorriso qemu-system-x86 ripgrep
30+
version: 1.0
31+
32+
- name: Cache toolchain
33+
id: cache-rustup
34+
uses: actions/cache@v3
35+
with:
36+
path: ~/.rustup
37+
key: rust-toolchain-${{ matrix.rust-version }}
38+
39+
- name: Install ${{ matrix.rust-version }}
40+
if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
41+
uses: actions-rs/toolchain@v1
42+
with:
43+
profile: minimal
44+
toolchain: ${{ matrix.rust-version }}
45+
override: true
46+
target: x86_64-unknown-none
47+
components: rustfmt, clippy
48+
49+
- name: Cache Build
2050
uses: Swatinem/rust-cache@v2.5.0
2151

22-
- name: install cargo-nextest
23-
uses: taiki-e/install-action@nextest
24-
25-
- name: Hack to ignore kernel from test cargo compiler
26-
run: sed -i -e 's/^# \(.*sed_mark_1\)/\1/' Cargo.toml && sed -i -e 's/^\(.*sed_mark_0\)/# \1/' Cargo.toml
27-
2852
- name: Build
29-
run: cargo build --verbose
53+
run: make build
3054

3155
- name: Run tests
32-
run: cargo nextest run --verbose
33-
34-
kernel-unit-tests:
35-
if: false
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: actions/checkout@v3
39-
40-
- name: Add x86_64 target
41-
run: rustup target add x86_64-unknown-none
56+
run: make unittest
4257

43-
- name: Rust Cache
44-
uses: Swatinem/rust-cache@v2.5.0
45-
46-
- name: Run qemu tests
58+
- name: Run QEMU tests
4759
run: make test
48-
49-
clippy:
50-
runs-on: ubuntu-latest
51-
steps:
52-
- uses: actions/checkout@v3
53-
54-
- name: Rust Cache
55-
uses: Swatinem/rust-cache@v2.5.0
56-
57-
- name: Add Clippy
58-
run: rustup component add clippy
5960

60-
- name: Run clippy
61+
- name: Run Clippy
6162
run: cargo clippy --all -- -D warnings
6263

63-
rustfmt:
64-
runs-on: ubuntu-latest
65-
steps:
66-
- uses: actions/checkout@v3
67-
68-
- name: Rust Cache
69-
uses: Swatinem/rust-cache@v2.5.0
70-
71-
- name: Add Rustfmt
72-
run: rustup component add rustfmt
73-
74-
- name: Run clippy
64+
- name: Run Rustfmt
7565
run: cargo fmt --all -- --check

Makefile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,20 @@ ${KERNEL_TESTING}: ${KERNEL_SRC} Makefile Cargo.toml Cargo.lock
7878
# ISO generation
7979
include ./${BOOT_DIR}/Makefile
8080

81-
# ISO running
81+
# ISO running (including unit tests in QEMU)
8282
include ./qemu.mk
8383

84+
# nextest doesn't support excluding packages
85+
EXCLUDED_UNITS := sample-elf kernel
86+
unittest:
87+
${CARGO} test \
88+
--no-fail-fast \
89+
--workspace $(patsubst %, --exclude hyperion-%, ${EXCLUDED_UNITS}) \
90+
-- --test-threads=$(shell nproc --all) \
91+
2>&1 | rg --pcre2 --multiline --multiline-dotall -e '^test' -e 'failures:.+?(?=\n\n\n)\n\n\n' \
92+
2>&1 | rg -v '^test result: '
93+
# a crazy hack that I somehow came up with to debloat the cargo test --workspace output ^^^
94+
8495
# build alias
8596
build: ${KERNEL}
8697

@@ -109,6 +120,6 @@ src:
109120
@echo "from: ${CARGO_DIR}/hyperion.d"
110121
@echo "${KERNEL_SRC}" | tr " " "\n" | sort
111122

112-
.PHONY : build iso reset-cargo-deps run test gdb kernel objdump readelf src
123+
.PHONY : build iso run test unittest gdb kernel objdump readelf src
113124

114125
# end

qemu.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ QEMU_FLAGS += -M smm=off
1919
endif
2020
ifeq (${DEBUG},1)
2121
QEMU_FLAGS += -d guest_errors
22-
else (${DEBUG},2)
22+
else ifeq (${DEBUG},2)
2323
QEMU_FLAGS += -d int,guest_errors
24-
else (${DEBUG},3)
24+
else ifeq (${DEBUG},3)
2525
QEMU_FLAGS += -d int,guest_errors,cpu_reset
26-
else
2726
endif
2827
QEMU_FLAGS += -no-reboot
2928
# QEMU_FLAGS += -no-shutdown

0 commit comments

Comments
 (0)