Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 0 additions & 65 deletions .github/workflows/makefile.yml

This file was deleted.

43 changes: 34 additions & 9 deletions .github/workflows/qemu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ jobs:
firmware: openwrt-malta-be-vmlinux-initramfs.elf
dependency: qemu-system-mips

- target: malta-le
firmware: openwrt-malta-le-vmlinux-initramfs.elf
dependency: qemu-system-mipsel

- target: malta-be64
firmware: openwrt-malta-be64-vmlinux-initramfs.elf
dependency: qemu-system-mips64

- target: malta-le64
firmware: openwrt-malta-le64-vmlinux-initramfs.elf
dependency: qemu-system-mips64el

- target: x86-64
firmware: openwrt-x86-64-generic-squashfs-combined.img.gz
dependency: qemu-system-x86
Expand All @@ -33,6 +45,16 @@ jobs:
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
path: tests
depth: 1

- name: Check out openwrt.git
uses: actions/checkout@v2
with:
repository: openwrt/openwrt
path: openwrt
depth: 1

- name: Install dependencies
run: |
Expand All @@ -41,29 +63,32 @@ jobs:
python3-poetry \
${{ matrix.dependency }}

- name: Install project dependencies
- name: Link tests to openwrt.git
run: |
ln -s $GITHUB_WORKSPACE/tests $GITHUB_WORKSPACE/openwrt/tests

- name: Poetry install
run: |
cd $GITHUB_WORKSPACE/tests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not working dir? to be less dependent of github actions structure?

poetry install

- name: Download test firmware
env:
target: ${{ matrix.target }}
run: |
wget https://downloads.openwrt.org/snapshots/targets/${target/-/\/}/${{ matrix.firmware }} \
--output-document ${{ matrix.firmware }}
--output-document $GITHUB_WORKSPACE/openwrt/${{ matrix.firmware }}

- name: Run test
run: |
cd $GITHUB_WORKSPACE/openwrt

gunzip ${{ matrix.firmware }} || true

firmware=${{ matrix.firmware }}
poetry run pytest tests/ \
--lg-env targets/qemu-${{ matrix.target }}.yaml \
--lg-log \
--lg-colored-steps \
-v \
-s \
--firmware $GITHUB_WORKSPACE/${firmware/.gz/}

make tests/${{ matrix.target }} \
FIRMWARE=$GITHUB_WORKSPACE/${firmware/.gz/}

- name: Upload console logs
uses: actions/upload-artifact@v2
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/shell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test Shell
on:
pull_request:

env:
PYTHONUNBUFFERED: "1"

jobs:
test-makefile:
name: Test Makefile
runs-on: ubuntu-24.04
steps:
- name: Check out repository code
uses: actions/checkout@v2
with:
path: tests
depth: 1

- name: Check out openwrt.git
uses: actions/checkout@v2
with:
repository: openwrt/openwrt
path: openwrt
depth: 1

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install \
make \
bats

- name: Link tests to openwrt.git
run: |
ln -s $GITHUB_WORKSPACE/tests $GITHUB_WORKSPACE/openwrt/tests

- name: Run shell test
run: |
cd $GITHUB_WORKSPACE/openwrt
make tests/shell V=s
29 changes: 25 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ TESTSDIR ?= $(shell readlink -f $(TOPDIR)/tests)
define pytest
poetry -C $(TESTSDIR) run \
pytest $(TESTSDIR)/tests/ \
--verbose \
--lg-log \
--lg-colored-steps $(if $(K),-k $(K),)
endef
Expand Down Expand Up @@ -59,15 +60,35 @@ $(curdir)/armsr-armv8:
--lg-env $(TESTSDIR)/targets/qemu-armsr-armv8.yaml \
--firmware $(FIRMWARE)

$(curdir)/malta-be: QEMU_BIN ?= qemu-system-mips
$(curdir)/malta-be: FIRMWARE ?= $(TOPDIR)/bin/targets/malta/be/openwrt-malta-be-vmlinux-initramfs.elf
$(curdir)/malta-be:
define qemu_malta
[ -f $(FIRMWARE) ]

LG_QEMU_BIN=$(QEMU_BIN) \
$(pytest) \
--lg-env $(TESTSDIR)/targets/qemu-malta-be.yaml \
--lg-env $(TESTSDIR)/targets/qemu-malta.yaml \
--firmware $(FIRMWARE)
endef


$(curdir)/malta-be: QEMU_BIN ?= qemu-system-mips
$(curdir)/malta-be: FIRMWARE ?= $(TOPDIR)/bin/targets/malta/be/openwrt-malta-be-vmlinux-initramfs.elf
$(curdir)/malta-be:
$(qemu_malta)

$(curdir)/malta-le: QEMU_BIN ?= qemu-system-mipsel
$(curdir)/malta-le: FIRMWARE ?= $(TOPDIR)/bin/targets/malta/le/openwrt-malta-le-vmlinux-initramfs.elf
$(curdir)/malta-le:
$(qemu_malta)

$(curdir)/malta-be64: QEMU_BIN ?= qemu-system-mips64
$(curdir)/malta-be64: FIRMWARE ?= $(TOPDIR)/bin/targets/malta/be64/openwrt-malta-be64-vmlinux-initramfs.elf
$(curdir)/malta-be64:
$(qemu_malta)

$(curdir)/malta-le64: QEMU_BIN ?= qemu-system-mips64el
$(curdir)/malta-le64: FIRMWARE ?= $(TOPDIR)/bin/targets/malta/le64/openwrt-malta-le64-vmlinux-initramfs.elf
$(curdir)/malta-le64:
$(qemu_malta)

$(curdir)/shell:
[ -n "$$(command -v bats)" ] || (echo "Please install bats" && exit 1)
Expand Down
1 change: 1 addition & 0 deletions targets/qemu-malta-be.yaml → targets/qemu-malta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ features:
- online
- opkg
- hwsim
- apk

targets:
main:
Expand Down