Skip to content

Commit ef16834

Browse files
committed
github/workflows: Add workflow to build and run unix port on MIPS.
This adds a coverage build and running of the test suite on a MIPS 32-bit big endian architecture. It uses the feature of qemu to execute foreign code as though it were native to the system (using qemu user mode). The code compiled for MIPS will run under the qemu VM, but all syscalls made by this code go to the host (Linux) system. See related adafruit#7268 and adafruit#7273. Signed-off-by: Damien George <[email protected]>
1 parent dc86e04 commit ef16834

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/workflows/ports_unix.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,17 @@ jobs:
186186
- name: Print failures
187187
if: failure()
188188
run: tests/run-tests.py --print-failures
189+
190+
qemu_mips:
191+
runs-on: ubuntu-latest
192+
steps:
193+
- uses: actions/checkout@v2
194+
- name: Install packages
195+
run: source tools/ci.sh && ci_unix_qemu_mips_setup
196+
- name: Build
197+
run: source tools/ci.sh && ci_unix_qemu_mips_build
198+
- name: Run main test suite
199+
run: source tools/ci.sh && ci_unix_qemu_mips_run_tests
200+
- name: Print failures
201+
if: failure()
202+
run: tests/run-tests.py --print-failures

tools/ci.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ CI_UNIX_OPTS_SYS_SETTRACE_STACKLESS=(
292292
CFLAGS_EXTRA="-DMICROPY_STACKLESS=1 -DMICROPY_STACKLESS_STRICT=1 -DMICROPY_PY_SYS_SETTRACE=1"
293293
)
294294

295+
CI_UNIX_OPTS_QEMU_MIPS=(
296+
CROSS_COMPILE=mips-linux-gnu-
297+
VARIANT=coverage
298+
MICROPY_STANDALONE=1
299+
LDFLAGS_EXTRA="-static"
300+
)
301+
295302
function ci_unix_build_helper {
296303
make ${MAKEOPTS} -C mpy-cross
297304
make ${MAKEOPTS} -C ports/unix "$@" submodules
@@ -478,6 +485,26 @@ function ci_unix_macos_run_tests {
478485
(cd tests && ./run-tests.py --exclude 'uasyncio_(basic|heaplock|lock|wait_task)' --exclude 'import_pkg7.py' --exclude 'urandom_basic.py')
479486
}
480487

488+
function ci_unix_qemu_mips_setup {
489+
sudo apt-get update
490+
sudo apt-get install gcc-mips-linux-gnu g++-mips-linux-gnu
491+
sudo apt-get install qemu-user
492+
qemu-mips --version
493+
}
494+
495+
function ci_unix_qemu_mips_build {
496+
# qemu-mips on GitHub Actions will seg-fault if not linked statically
497+
ci_unix_build_helper "${CI_UNIX_OPTS_QEMU_MIPS[@]}"
498+
}
499+
500+
function ci_unix_qemu_mips_run_tests {
501+
# Issues with MIPS tests:
502+
# - (i)listdir does not work, it always returns the empty list (it's an issue with the underlying C call)
503+
# - ffi tests do not work
504+
file ./ports/unix/micropython-coverage
505+
(cd tests && MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py --exclude 'vfs_posix.py' --exclude 'ffi_(callback|float|float2).py')
506+
}
507+
481508
########################################################################################
482509
# ports/windows
483510

0 commit comments

Comments
 (0)