Commit graph

5 commits

Author SHA1 Message Date
Alessandro Gatti
b0fd0079f4 tests/micropython: Make tests behave in low memory condition.
This commit changes the "viper_ptr*_store_boundary" tests to make them
fail more gracefully in low memory conditions.

The original version of the tests compiled viper code blocks on the fly
when it needed them, making them fail at runtime on some boards that do
not come with enough memory for this test.  This clashes with
"run-tests.py"'s ability to look for a particular signature to mark
tests as skipped due to not enough memory.

Now compiled code blocks are generated at the beginning of the test
inside an appropriate exception handler.  In case of a memory error when
pre-compiling a code block, the running test exits reporting a low
memory condition to the test runner.  This allows to have clean test
runs on all platforms when it comes to viper pointer tests.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-08-26 10:47:17 +10:00
Alessandro Gatti
b1d5c656de tests/micropython: Remove big ints dependence for viper boundary tests.
This commit provides an implementation for viper boundary tests that can
work even without big int support.

Since it uses a fixed-size buffer to hold values to work with, this
should work on any platform as long as its integers are at least 32 bits
wide, regardless its configuration on how big integers can get.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-08-11 16:46:15 +10:00
Angus Gratton
096ff8b9ee tests/micropython: Rename viper boundary tests that depend on big int.
These tests all depend on generating arbitrarily long (>64-bit) integers.

It would be possible to have these tests work in this case I think, as the
results are always masked to shorter values.  But quite fiddly.  So just
rename them so they are automatically skipped if the target doesn't have
big int support.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-07-24 15:50:34 +10:00
Alessandro Gatti
0d435959e0 tests/micropython: Improve viper ptr boundary tests.
This commit reworks the Viper pointer boundary tests in order to make
them more accurate and easier to extend.

The tests are now easier to reason about in their output, using easier
to read values, and bit thresholds are now more configurable.  If a new
conditional code sequence is introduced, adding a new bit threshold is
just a matter of adding a value into a tuple at the beginning of the
relevant test file.

Load tests have also been made more accurate, with better function
templates to test register-indexed operations.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-07-01 15:43:02 +10:00
Alessandro Gatti
2260fe0828 tests/micropython/viper_ptr: Add tests for arch edge cases.
This commit adds a series of test cases to exercise the Viper code
generator load/store emitting capabilities on certain boundary
conditions.

The new test cases check whether the emitted load/store code performs
correctly when dealing with specific memory offsets, which trigger
specific code generation sequences on different architectures.

Right now the cases are for unsigned offsets whose bitmasks span up to
5, 8, and 12 bits (respectively Arm/Thumb, Xtensa, RV32).

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-05-21 02:00:40 +02:00