Skip to content

tests/pkg_micro-ecc: Cleanup and AVR fixes#12797

Merged
maribu merged 1 commit intoRIOT-OS:masterfrom
maribu:tests_micro-ecc
Nov 25, 2019
Merged

tests/pkg_micro-ecc: Cleanup and AVR fixes#12797
maribu merged 1 commit intoRIOT-OS:masterfrom
maribu:tests_micro-ecc

Conversation

@maribu
Copy link
Copy Markdown
Member

@maribu maribu commented Nov 23, 2019

Contribution description

The test in tests/pkg_micro-ecc performed some huge allocation on the stack, including variable length arrays. Both should be avoided in general. But more specifically this causes a stack overflow on ATmega boards. This PRs moves the allocations from the stack to the data / bss segment to solve the stack overflow. In addition, the verbosity of the output is increased. (E.g. when running make term the terminal will only print the line once the \n is received, which is at the end of the test. The test takes about 10 minutes on an ATmega clocked at 8MHz, or about 5 minutes on an ATmega-Arduino clocked at 16 MHz. No user will wait for that time for output to appear on the terminal.)

Testing procedure

Run:

make BOARD=<foo> flash test -C tests/pkg_micro-ecc

It should still work with a non ATmega board and should now succeed with ATmega boards.

Issues/PRs references

Tick one item in #12651

@maribu maribu requested a review from aabadie November 23, 2019 23:23
@maribu maribu added Area: tests Area: tests and testing framework Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 23, 2019
@benpicco benpicco added the CI: run tests If set, CI server will run tests on hardware for the labeled PR label Nov 24, 2019
@aabadie aabadie requested a review from bergzand November 24, 2019 08:42
Copy link
Copy Markdown
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Again, nice work!
I have a couple of comments on the Python test script, see below. I'm also wondering if/why 16 test rounds are really needed. Decreasing to 4 would divide by 4 the whole test duration (2.5min instead of 10 on an AVR clocked at 8MHz).

@maribu
Copy link
Copy Markdown
Member Author

maribu commented Nov 25, 2019

I have not re-tested the code with the fixed applied, as I have the hardware setup at home. I can retest tonight.

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Nov 25, 2019

Please squash. I'll retest now but I think the code changes in this PR are good and can be merged.

@aabadie
Copy link
Copy Markdown
Contributor

aabadie commented Nov 25, 2019

Tested the automatic script on arduino-zero, atmega256rfr2 and native and all working (with #12797 (comment) applied).

@maribu
Copy link
Copy Markdown
Member Author

maribu commented Nov 25, 2019

I remembered that the ATmega2560 I have in my office has enough RAM/ROM and retested. It worked for me with the fix you suggested applied. I squashed the fix right in :-)

- Moved huge allocations from stack to data / bss
- Increased verbosity of messages (one line per round)
- Adapted test script to new output format
Copy link
Copy Markdown
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Re-tested on arduino-mega2560 and works like a charm now.

ACK

@maribu maribu merged commit b122926 into RIOT-OS:master Nov 25, 2019
@fjmolinas fjmolinas added this to the Release 2020.01 milestone Dec 13, 2019
@maribu maribu deleted the tests_micro-ecc branch February 6, 2020 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants