-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Introduction
There is overuse of "test" word in our samples often misleading users that they may be used as tests, while they are supposed to present how certain things work. This also makes samples work as tests for certain features; of course there is a "test" use case here, for example when samples are given various configuration options to test whether such application, where a sample presents simplified version of it, will still compile/work for user with given set of options.
Problem description
This isn't like major problem, but in places where we lack tests and have samples, very often the samples will function as good enough solution. When feature or API is extended, the sample should also get extended to show how to use new capabilities, it should not get extended to test API changes or extended to prevent regression where bugs are fixed; using samples for testing features or preventing regression makes them overly complicated and eclipses the true purpose, which is to provide user ramp up into using some features.
Proposed change
Desist from using "test" for describing any operations, that are not actually conditions required by the sample to function, in comments or printk logs, to avoid samples being used as alternative to actual tests, to encourage developers to deliver actual tests when features are added or bug fixed.
Concerns and Unresolved Questions
Probably none.
Alternatives
Leaving the mess and having discussions like here, with valid comment by @erwango #53598 (comment), appear from time to time.
Verified culprits
The flash API/drivers is one, for example:
zephyr/samples/drivers/soc_flash_nrf/src/main.c
Lines 48 to 49 in 9951971
| printf("\nNordic nRF5 Flash Testing\n"); | |
| printf("=========================\n"); |
with entire block of code with identifiers imply thy something is being tested here:
zephyr/samples/drivers/soc_flash_nrf/src/main.c
Lines 37 to 44 in 9951971
| uint32_t buf_array_1[4] = { TEST_DATA_WORD_0, TEST_DATA_WORD_1, | |
| TEST_DATA_WORD_2, TEST_DATA_WORD_3 }; | |
| uint32_t buf_array_2[4] = { TEST_DATA_WORD_3, TEST_DATA_WORD_1, | |
| TEST_DATA_WORD_2, TEST_DATA_WORD_0 }; | |
| uint32_t buf_array_3[8] = { TEST_DATA_WORD_0, TEST_DATA_WORD_1, | |
| TEST_DATA_WORD_2, TEST_DATA_WORD_3, | |
| TEST_DATA_WORD_0, TEST_DATA_WORD_1, | |
| TEST_DATA_WORD_2, TEST_DATA_WORD_3 }; |
another one is SPI flash sample:
zephyr/samples/drivers/spi_flash/src/main.c
Lines 44 to 45 in 9951971
| printf("\n%s SPI flash testing\n", flash_dev->name); | |
| printf("==========================\n"); |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status