File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Test Build
2+
3+ on :
4+ push :
5+ branches-ignore :
6+ - comp-and-judge
7+ pull_request :
8+ branches-ignore :
9+ - comp-and-judge
10+ workflow_dispatch :
11+
12+ jobs :
13+ build-and-run-test :
14+ runs-on : ubuntu-latest
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ arch : [riscv64, loongarch64]
19+ include :
20+ - arch : riscv64
21+ target : riscv64gc-unknown-none-elf
22+ - arch : loongarch64
23+ target : loongarch64-unknown-none-softfloat
24+ steps :
25+ - name : Checkout code
26+ uses : actions/checkout@v4
27+
28+ - name : Setup rust nightly
29+ run : rustup component add rust-src llvm-tools
30+
31+ - name : Setup QEMU
32+ run : |
33+ sudo apt-get install -y qemu-system-${{ matrix.arch }} qemu-kvm
34+
35+ - name : Configure
36+ run : ./configure
37+
38+ - name : Run build for ${{ matrix.arch }} targets
39+ run : |
40+ make build ARCH=${{ matrix.arch }} MODE=release
41+ zstd -k build/boot-${{ matrix.arch }}.img
42+
43+ - name : Upload build artifacts
44+ uses : actions/upload-artifact@v4
45+ with :
46+ name : eonix-kernel-and-image-${{ matrix.arch }}
47+ path : |
48+ build/${{ matrix.target }}/release/eonix_kernel
49+ build/boot-${{ matrix.arch }}.img.zst
50+
51+ - name : Test run for ${{ matrix.arch }}
52+ run : |
53+ echo "Fixing permissions for /dev/kvm..."
54+ sudo adduser $USER kvm
55+ sh script/test.sh
56+ env :
57+ ARCH : ${{ matrix.arch }}
58+ QEMU_ACCEL : ' '
59+ timeout-minutes : 2
60+ continue-on-error : true
61+
62+ - name : Upload run log
63+ uses : actions/upload-artifact@v4
64+ with :
65+ name : test-${{ matrix.arch }}.log
66+ path : build/test-*.log
Original file line number Diff line number Diff line change @@ -21,15 +21,19 @@ KERNEL_SOURCES := $(shell find src macros crates -name '*.rs' -type f)
2121KERNEL_CARGO_MANIFESTS += $(shell find src macros crates -name Cargo.toml -type f)
2222KERNEL_DEPS := $(KERNEL_SOURCES) $(KERNEL_CARGO_MANIFESTS)
2323
24- QEMU_ARGS ?= -no-reboot -no-shutdown
24+ QEMU_ARGS ?= -no-reboot
2525CARGO_FLAGS := --profile $(PROFILE) --features $(FEATURES)$(if $(SMP),$(COMMA)smp,)
2626
2727ifeq ($(HOST),darwin)
2828QEMU_ACCEL ?= -accel tcg
2929else ifeq ($(HOST),linux)
30+
31+ ifeq ($(shell ls /dev/kvm),/dev/kvm)
3032QEMU_ACCEL ?= -accel kvm
3133endif
3234
35+ endif
36+
3337QEMU_ARGS += $(QEMU_ACCEL)
3438
3539ifneq ($(DEBUG_TRAPS),)
@@ -122,6 +126,10 @@ run: build build/kernel.sym
122126srun: build build/kernel.sym
123127 $(QEMU) $(QEMU_ARGS) -display none -S -s -serial mon:stdio
124128
129+ .PHONY: test-run
130+ test-run: build
131+ $(QEMU) $(QEMU_ARGS) -display none -serial stdio
132+
125133.PHONY: clean
126134clean:
127135 -rm -rf build
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ SUCCESS_MSG=" ###$RANDOM :SuCCeSS: $RANDOM ###"
4+
5+ if [ " $ARCH " = " " ]; then
6+ echo " Error: ARCH environment variable is not set." >&2
7+ exit 1
8+ fi
9+
10+ printf " ls\necho \" $SUCCESS_MSG \" \npoweroff\n" \
11+ | make test-run ARCH=$ARCH MODE=release QEMU=qemu-system-$ARCH \
12+ | tee build/test-$$ .log \
13+ | grep " $SUCCESS_MSG " > /dev/null && echo TEST\ $$ \ WITH\ ARCH=$ARCH \ PASSED
You can’t perform that action at this time.
0 commit comments