Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:32 29 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite: firmware testing remotely via MMB4L

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 11:55am 23 Apr 2023
Copy link to clipboard 
Print this post

Hi folks,

Even though this has to be in the running for the least interesting YouTube video ever I still wanted to post as it shows the (almost) culmination of three years playing with MMBasic; though I didn't know this was where I was going at the time.

It shows:

- Windows 10
- running the Windows Subsystem for Linux (WSL2)
- running MMBasic for Linux (MMB4L)
- running 'gonzo' my serial file transfer program/shell
- running a script
- that transpiles (using 'sptrans'),
    - sends, and
    - executes all my MMBasic firmware tests (using 'sptest')
    - to a remote PicoMite over the USB/serial link.

I wouldn't watch all (or indeed any) 12+ minutes of it.

   https://www.youtube.com/watch?v=Tg5I-5hEJSA

I've found no significant bugs in the RC6 firmware, though there are some odds and ends that I will probably bend Peter's ear about after I've just worked out some issues on my side.

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 899
Posted: 01:35pm 23 Apr 2023
Copy link to clipboard 
Print this post

Hi Tom,
Nice work. I was wondering what unit testing was about so I have previously had a look/play with your sptest suite. Looking forward to seeing the updated tests on GitHub.

Gerry
Latest F4 Latest H7
 
Kabron

Regular Member

Joined: 30/11/2017
Location: Germany
Posts: 65
Posted: 02:23pm 23 Apr 2023
Copy link to clipboard 
Print this post

Quality!!
Dangerous for eyes!
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4047
Posted: 03:52pm 23 Apr 2023
Copy link to clipboard 
Print this post

Comment from YouTube which I think must have been by @Kabron because it's the same avatar:

  Quote  Nothing understandable but very interesting


I'll try and explain.

I have a set of Unit Tests that I originally wrote whilst porting MMBasic to Linux (MMB4L). These are sets of fairly self-contained subroutines that each try to assert/test a single piece of MMBasic behaviour.

e.g. Here is a SUB to test the INC command operating on a scalar:

Sub test_inc_scalar()
 Local i%, f!, s$

 Inc i%
 assert_int_equals(1, i%)
 Inc i%, 2
 assert_int_equals(3, i%)
 Inc i%, -4
 assert_int_equals(-1, i%)

 Inc f!
 assert_float_equals(1.0, f!, 0.001)
 Inc f!, 3.21
 assert_float_equals(4.21, f!, 0.001)
 Inc f!, -5.19
 assert_float_equals(-0.98, f!, 0.001)

 Cat s$, "foo"
 assert_string_equals("foo", s$)
 Cat s$, "bar"
 assert_string_equals("foobar", s$)
End Sub


My 'sptest' framework automates the running of these tests and collects the result to present in an ANSI colour coded formatted report on the console.

In the past I've run these tests on MMB4L, MMB4W and the CMM2 and reported any failures and variations between the MMBasic platforms to @matherp ... many of these issues are in the boundary conditions, probably to Peter's annoyance because it would be rare for anyone to encounter them in production.

However running the tests on the PicoMite has presented a challenge because they depend on a fairly extensive framework (sptest) of #INCLUDEd libraries, e.g. the top of the file containing my tests for INC starts with:

#Include "../sptools/src/splib/system.inc"
#Include "../sptools/src/splib/array.inc"
#Include "../sptools/src/splib/list.inc"
#Include "../sptools/src/splib/string.inc"
#Include "../sptools/src/splib/file.inc"
#Include "../sptools/src/splib/vt100.inc"
#Include "../sptools/src/sptest/unittest.inc"


The PicoMite has no #INCLUDE support (yes I could mess with the LIBRARY now, but it would be awkward) so instead I use my transpiler (sptrans) in its simplest mode of operation to flatten out each test file into a single monolithic .bas file. Because 'sptrans' is quite slow and the PicoMite is a relative slouch I don't run sptrans on the PicoMite but instead use MMB4L (running in a WSL2 container on my fastest Windows machine).

Once transpiled the file has to be transferred to the PicoMite using XMODEM and executed.

Doing all this naively for 30+ test files would involve a lot of manual steps so I automate it using my shell and file transfer program (gonzo) running on MMB4L which can (a) find all the tests, and for each one, (b) transpile it, (c) xmodem send it to the PicoMite, (d) remotely execute it, and finally (e) capture the serial output (results) from the USB tethered PicoMite and present them to me in the MMB4L console.

All the tooling is written in MMBasic, except of course for MMB4L which is a port of Geoff and Peter's C code.

Any questions ?

Tom
Edited 2023-04-24 05:59 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024