Skip to content

Commit

Permalink
Add simple automated tests #7
Browse files Browse the repository at this point in the history
  • Loading branch information
r1ru committed Feb 4, 2024
2 parents 82153e5 + 3e8fbab commit ec1e840
Show file tree
Hide file tree
Showing 14 changed files with 207 additions and 412 deletions.
14 changes: 0 additions & 14 deletions .github/DISCUSSION_TEMPLATE/bugs.yml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/DISCUSSION_TEMPLATE/corrections.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/DISCUSSION_TEMPLATE/help.yml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Auto approve

on:
pull_request:
types: [opened, synchronize, ready_for_review]

jobs:
auto-approve:
if: |
github.event.pull_request.user.login == github.repository_owner
&& ! github.event.pull_request.draft
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v4
108 changes: 6 additions & 102 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ on:
branches: [main]
pull_request:
types: [opened, synchronize]

jobs:
linux_build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install packages
run: sudo apt-get update && sudo apt-get install -y llvm clang lld python3-pip qemu-system tshark
- name: Install pip packages
Expand All @@ -20,114 +23,15 @@ jobs:
run: make doctor
- name: Debug build
run: make build -j2
- name: Release build
run: make build -j2 RELEASE=1
- name: Run tests (debug build, 1 CPU)
run: make test -j2
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 1
- name: Run tests (release build, 1 CPU)
run: make test -j2 RELEASE=1
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 1
- name: Run tests (debug build, 4 CPUs)
run: make test -j2
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 4
- name: Run tests (release build, 4 CPUs)
run: make test -j2 RELEASE=1
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 4

macos_build:
runs-on: macos-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Install packages
run: brew install llvm python3 qemu
- name: Install pip packages
run: pip3 install --user -r tools/requirements.txt
- name: make doctor
run: make doctor
- name: Debug build
run: make build -j3
- name: Release build
run: make build -j3 RELEASE=1
- name: Run tests (debug build, 1 CPU)
run: make test -j3
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 1
- name: Run tests (release build, 1 CPU)
run: make test -j3 RELEASE=1
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 1
- name: Run tests (debug build, 4 CPUs)
run: make test -j3
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 4
- name: Run tests (release build, 4 CPUs)
run: make test -j3 RELEASE=1
env:
TEST_DEFAULT_TIMEOUT: 10
FLAKE_RUNS: 4
CPUS: 4

windows_build:
runs-on: windows-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Install Chocolatey packages
run: choco install qemu --version=2023.6.29
- name: Install pip packages
run: py -m pip install --user -r tools/requirements.txt
- name: make doctor
run: make doctor
- name: Debug build
run: make build -j2
- name: Release build
run: make build -j2 RELEASE=1
- name: Run tests (debug build, 1 CPU)
run: make test -j2
env:
TEST_DEFAULT_TIMEOUT: 30
FLAKE_RUNS: 1
CPUS: 1
QEMU: C:\Program Files\qemu\qemu-system-riscv32
- name: Run tests (release build, 1 CPU)
run: make test -j2 RELEASE=1
env:
TEST_DEFAULT_TIMEOUT: 30
FLAKE_RUNS: 1
CPUS: 1
QEMU: C:\Program Files\qemu\qemu-system-riscv32
- name: Run tests (debug build, 2 CPUs)
run: make test -j2
env:
TEST_DEFAULT_TIMEOUT: 30
FLAKE_RUNS: 1
CPUS: 2
QEMU: C:\Program Files\qemu\qemu-system-riscv32
- name: Run tests (release build, 2 CPUs)
run: make test -j2 RELEASE=1
env:
TEST_DEFAULT_TIMEOUT: 30
FLAKE_RUNS: 1
CPUS: 2
QEMU: C:\Program Files\qemu\qemu-system-riscv32

CPUS: 4
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ QEMUFLAGS += -drive file=$(hinafs_img),if=none,format=raw,id=drive0
QEMUFLAGS += -device virtio-blk-device,drive=drive0,bus=virtio-mmio-bus.0
QEMUFLAGS += -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1
QEMUFLAGS += -object filter-dump,id=fiter0,netdev=net0,file=virtio-net.pcap
QEMUFLAGS += -netdev user,id=net0,hostfwd=tcp:127.0.0.1:1234-:80
QEMUFLAGS += -netdev user,id=net0

wasmos_elf := $(BUILD_DIR)/wasmos.elf
boot_elf := $(BUILD_DIR)/servers/vm.elf
Expand Down Expand Up @@ -197,16 +197,15 @@ gdb:
$(PROGRESS) GDB $(BUILD_DIR)/gdbinit
$(GDB) -q -ex "source $(BUILD_DIR)/gdbinit"

# 自動テスト
# Automated test
export QEMUFLAGS
.PHONY: test
test:
$(PYTHON3) \
-m pytest tests.py -p no:cacheprovider \
--qemu "$(QEMU)" --make "$(MAKE)" \
$(if $(FLAKE_RUNS),--flake-finder --flake-runs=$(FLAKE_RUNS)) \
$(if $(RELEASE),--release,)

$(PYTHON3) \
-m pytest tests -p no:cacheprovider \
--qemu $(QEMU) \
$(if $(FLAKE_RUNS),--flake-finder --flake-runs=$(FLAKE_RUNS))

# トラブルシューティングに役立つ情報を表示するコマンド
.PHONY: doctor
doctor:
Expand Down
103 changes: 0 additions & 103 deletions conftest.py

This file was deleted.

27 changes: 0 additions & 27 deletions servers/hello_wasmvm/app.c

This file was deleted.

12 changes: 0 additions & 12 deletions servers/hello_wasmvm/build.mk

This file was deleted.

Loading

0 comments on commit ec1e840

Please sign in to comment.