Skip to content

tests/gnrc_ndp: don't guess size of gnrc_pktsnip_t in pktbuf#16051

Merged
miri64 merged 2 commits intoRIOT-OS:masterfrom
miri64:tests/fix/avr-gnrc_ndp
Feb 19, 2021
Merged

tests/gnrc_ndp: don't guess size of gnrc_pktsnip_t in pktbuf#16051
miri64 merged 2 commits intoRIOT-OS:masterfrom
miri64:tests/fix/avr-gnrc_ndp

Conversation

@miri64
Copy link
Copy Markdown
Member

@miri64 miri64 commented Feb 19, 2021

Contribution description

From #12651

☐ tests/gnrc_ndp: no idea of the problems

The problem is that the tests makes some assumptions that do not hold true for every platform: For testing the "packet buffer is full" error case, it fills the packet buffer with just enough data to be able to progress the function under test to a certain point and then fail. For this it assumes the size of a gnrc_pktsnip_t to be 24 bytes. However, 24 bytes is only the right size for gnrc_pktsnip_t on 32-bit systems (and only if the struct does not change), on AVR e.g. it 9 bytes. By using the internal alignment function of pktbuf we are able to precisely tell the internal size of gnrc_pktsnip_t using the sizeof operator.

Testing procedure

Run

make -C tests/gnrc_ndp -j flash test

on an 8-bit platform (that fits it) and it should succeed now. Also try to run the test on several other platforms to make sure it does not introduce a regression.

Issues/PRs references

Should fix #12651 for good.

@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: tests Area: tests and testing framework CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Feb 19, 2021
@miri64 miri64 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Feb 19, 2021
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Feb 19, 2021

A cleaner approach could be to rewrite the whole test using a packet buffer mock to get into those error conditions, but this is the simpler approach for now ;-).

@fjmolinas
Copy link
Copy Markdown
Contributor

Test now passes on AVR:

START
main(): This is RIOT! (Version: 2021.04-devel-669-ga027d-pr-16051)
...........................................................................
OK (75 tests)

@fjmolinas
Copy link
Copy Markdown
Contributor

Running the test on some more platforms...

@miri64 miri64 force-pushed the tests/fix/avr-gnrc_ndp branch from a027d9d to cb8afd3 Compare February 19, 2021 10:54
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Feb 19, 2021

My latest fixup just fixes the static tests.

@fjmolinas
Copy link
Copy Markdown
Contributor

Ran the tests on multiple BOARD's all good https://ci.inria.fr/ci-riot-tribe/job/build-pipeline.jk/233/artifact/, the two boards that fail is because I setup wrong udev-rules form them, something I need to address when I'm at the office.

@fjmolinas
Copy link
Copy Markdown
Contributor

Please squash!

24 bytes is only the right size for `gnrc_pktsnip_t` on 32-bit systems
(and only if the struct does not change), on AVR e.g. it 9 bytes.
By using the internal alignment function of `pktbuf` we are able to
precisely tell the internal size of `gnrc_pktsnip_t` using the `sizeof`
operator.
@miri64 miri64 force-pushed the tests/fix/avr-gnrc_ndp branch from 5957127 to 455a607 Compare February 19, 2021 11:23
@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Feb 19, 2021

Squashed.

Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

ACK, thanks for the fix @miri64!

@miri64 miri64 merged commit 6c93f0e into RIOT-OS:master Feb 19, 2021
@miri64 miri64 deleted the tests/fix/avr-gnrc_ndp branch February 19, 2021 13:44
@kaspar030 kaspar030 added this to the Release 2021.04 milestone Apr 23, 2021
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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing tests on AVR (tested with atmega256rfr2-xpro)

3 participants