[riot-notifications] [RIOT-OS/RIOT] tests/periph_eeprom: use EEPROM_CLEAR_BYTE [backport 2019.01] (#11008)

Gaëtan Harter notifications at github.com
Tue Feb 12 18:08:44 CET 2019


# Backport of #11005

### Contribution description

When eeprom/clear was introduced, the pull request was not tested on an `atmega` board even if it had `atmega` specific modifications.

The test `tests/periph_eeprom` failed with this board because `EEPROM_CLEAR_BYTE` was not taken into account.

This PR handles this fix and related issues found on the way.

* Use of an array of pointer instead of an array
* Clean of now un-necessary casts (and why even cast something to `const pointer` as an argument ?)
* Use of `strncmp` to verify that two memory regions are equal even when checking for a region with 4 times 0.
* The fix to use `EEPROM_CLEAR_BYTE`

It can be reviewed commits by commits and can be split on demand.

This is a new feature from the release so would be nice to have it integrated with a fixed test during this one.

### Testing procedure


Run the `tests/periph_eeprom` on `arduino-mega2560` the test should now work. It fails on master with a failed assertion on the `clear` test:

```
CFLAGS=-DDEBUG_ASSERT_VERBOSE DEVELHELP=1 DOCKER="sudo docker" BUILD_IN_DOCKER=1 BOARD=arduino-mega2560 make flash test
...
> test
2019-02-12 16:46:01,069 - INFO #  test
2019-02-12 16:46:01,204 - INFO # /data/riotbuild/riotproject/tests/periph_eeprom/main.c:252 => Stack Pointer: 0x0a68
2019-02-12 16:46:01,225 - INFO # *** RIOT kernel panic:
2019-02-12 16:46:01,245 - INFO # FAILED ASSERTION.
2019-02-12 16:46:01,245 - INFO # 
2019-02-12 16:46:01,257 - INFO # *** halted.
```

It would be nice to also run the test on other supported boards

* Tested boards:
  * atmega family: 
    * [x] arduino-mega2560

I did not trigger murdock tests as `samr21-xpro` does not have the eeprom support.


### Issues/PRs references

This issue was found during the tests for the release https://github.com/RIOT-OS/Release-Specs/issues/98

Introduced by https://github.com/RIOT-OS/RIOT/pull/10056
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/11008

-- Commit Summary --

  * tests/periph_eeprom: fix 'results' type
  * tests/periph_eeprom: remove useless casts
  * tests/periph_eeprom: use memcmp
  * tests/periph_eeprom: use memcmp for cleared bytes
  * tests/periph_eeprom: take EEPROM_CLEAR_BYTE into account

-- File Changes --

    M tests/periph_eeprom/main.c (18)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/11008.patch
https://github.com/RIOT-OS/RIOT/pull/11008.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190212/7ffa741b/attachment.html>


More information about the notifications mailing list