Commit graph

374 commits

Author SHA1 Message Date
Flavio Ceolin
fdae5305f4 tests: logging: Add missing header
This test was not include log header that is being used.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-01-29 16:59:10 -05:00
Sebastian Bøe
fdac7b3319 cmake: Add target for generating header files
Before C sources can be compiled any generated header that they
include must be generated. Currently, the target 'offsets_h' happens
to depend directly or indirectly on all generated headers.

This means that to compile safely, one can simply depend on
'offsets_h'. But this is coincidental and might not be true in the
future.

To be able to safely depend on a target that represents all generated
headers being ready we introduce the target
'zephyr_generated_headers'.

Any third-party build scripts can now safely depend on
'zephyr_generated_headers' and be protected from any internal changes
to the build system, like the removal of offsets_h.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2020-01-29 11:44:57 -06:00
Peter A. Bigot
046bae60b6 samples: drivers: spi_flash: switch nrf52840_pca10056 to Nordic QSPI
Adjust the configuration file, disable the SPI
driver and enable the QSPI driver and flash node.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Signed-off-by: Kamil Lazowski <Kamil.Lazowski@nordicsemi.no>
2020-01-29 15:15:49 +01:00
Dominik Ermel
9c0fb144ee tests/fs: NFFS has been replaced with Littlefs in multifs tests
With removal of NFFS from Zaphyr it would be no longer possible to
test multifs with NFFS and LittleFS will be now used instead.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-01-21 17:30:03 +01:00
Andrzej Puzdrowski
cc81e02e17 tests/subsys/fs/multi-fs: suppres kconfig issue
This patch is for suppress CI Kconfig issues caused
by temporary dead code in this test-suie.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-21 15:32:47 +01:00
Andrzej Puzdrowski
b61e6d3787 tests/fs: remove nffs testsuite
NFFS was removed, so it tests need to be removed too.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-21 15:32:47 +01:00
Andrzej Puzdrowski
f7af1dc3a2 tests/subsys/fs: disable multi-fs testsuite
As multi-fs testsuite uses FS and NFFS it must be disabled
as NFFS was removed. Further thin test should be reworked to use
litlefs in place of NFFS.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-21 15:32:47 +01:00
Andrzej Puzdrowski
e446505473 tests/subsys/settings/functional/file: use littlefs
Switch to using LittleFS instead of NFFS, which was removed.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-21 15:32:47 +01:00
Andrzej Puzdrowski
04b2c170c1 tests/subsys/settings: remove nffs related testsuite
settings nffs targeted test were removed.
the file function settings suite was disabled as need some
rework in order to use litlefs.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-21 15:32:47 +01:00
Andrei Emeltchenko
484aeb3351 tests: usb: General cleanup
Remove unneeded headers and cleanups.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-01-07 21:05:44 +01:00
Andrei Emeltchenko
b8ea41e9d9 tests: usb: Use hexdump logger helper for bos test
Remove hexdump helper using standard logger one.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2020-01-07 21:05:44 +01:00
Alberto Escolar Piedras
5d94c98915 tests filesystem.fat.api: Do not run on native_posix_64
The FAT FS code clearly does not support platforms where
long is 64bits. See
https://github.com/zephyrproject-rtos/fatfs/blob/master/include/integer.h#L30

So, do not try to run it in native_posix_64
Fixes #21536
Fixes #19231

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2020-01-03 15:13:59 -05:00
Krzysztof Chruscinski
ffbd48e2c1 logging: Fix false strdup buffer freeing
Algorithm for freeing strdup buffers was only checking if argument
matches address within strdup buffer pool and was attempting freeing
even if format specifier was different than string.

Added fix where also format specifier is checked.

Extended logger test to verify correctness of function which searches
for string format specifiers within a string.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-12-20 08:49:01 -05:00
Krzysztof Chruscinski
ee14a49e91 tests: logging: log_core: Extended test_log_strdup_gc
Extended test to pass address within strdup buffer but with
different format specifier (not string). That should not trigger
string buffer freeing. If it does system may collapse (e.g. cortex-m0
may use unaligned access).

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-12-20 08:49:01 -05:00
Emil Obalski
d65027d8c0 usb: samples: Application calling usb_enable by itself
User app is reponsible for issuing usb_enable and
making USB hardware operative.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-19 13:08:55 +01:00
Krzysztof Chruscinski
b29d141dab tests: subsys: logging: Add test suite for immediate mode
Added test suite with test cases which performs stress test
of the logger in immediate mode. There are multiple threads continuesly
logging and being preempted. Test verifies that system does not
ends up in assert or fault.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-12-18 13:08:46 -08:00
Johann Fischer
1ac67d1559 tests: usb: adapt descriptor test to new Serial Number placeholder
Adapt descriptor test to new Serial Number placeholder.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-12-18 11:12:28 +01:00
Andrzej Puzdrowski
beb229b803 tests/subsys/dfu/img_util: progressively erase testcase
Extended test by testcase for testing progressively erase feature.
native posix flash page size was set to 1 kB in order to by aligned
with native_posix partitions boundaries.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-12-15 10:26:36 -05:00
Ulf Magnusson
984bfae831 global: Remove leading/trailing blank lines in files
Remove leading/trailing blank lines in .c, .h, .py, .rst, .yml, and
.yaml files.

Will avoid failures with the new CI test in
https://github.com/zephyrproject-rtos/ci-tools/pull/112, though it only
checks changed files.

Move the 'target-notes' target in boards/xtensa/odroid_go/doc/index.rst
to get rid of the trailing blank line there. It was probably misplaced.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-11 19:17:27 +01:00
Dominik Ermel
a70a926432 tests: settings: Reducing duplicated code in FS tests
Common code has been moved out of FS specific source into common
source files.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2019-12-11 08:19:20 -05:00
Andrei Emeltchenko
5f629c8929 tests: logging: Remove unneeded excludes
Remove unneeded platform excludes.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-12-11 06:39:09 -06:00
Andrei Emeltchenko
62617d996e tests: logging: Fix build errors
Add filter "not CONFIG_LOG_IMMEDIATE" since the test relies on the
macros defined when CONFIG_LOG_IMMEDIATE not defined.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2019-12-11 06:39:09 -06:00
Anas Nashif
70758c4374 tests: fix test identifiers
The seasonal overhaul of test identifiers aligning the terms being used
and creating a structure. This is hopefully the last time we do this,
plan is to document the identifiers and enforce syntax.

The end-goal is to be able to generate a testsuite description from the
existing tests and sync it frequently with the testsuite in Testrail.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 15:53:44 -05:00
Emil Obalski
c1f5e11bb6 usb: Cleanup for multiplied defines
Some of defines are present in several header files.
Those defines are the same with value but with different naming.

Common defines are brought to usb_common.h

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2019-12-09 12:48:13 -05:00
Jan Van Winkel
8cd4a817d9 drivers/flash/flash_simulator: Added file back end for posix arch
Extended flash simulator for posix architecture to read/write data
from a binary file on the host file system.

Further enable the flash simulator by default on native_posix(_64)
boards and updated the documentation accordingly.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-12-09 11:56:21 -05:00
Dominik Ermel
0449c672bc tests: settings: Test setting FS back-end using Littlefs
The commit ports settings tests that use NFFS to use Littlefs.

GH Issue #18341

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2019-11-22 21:24:10 +01:00
Peter A. Bigot
17945358e8 tests/subsys/fs/littlefs: correct flash partition unit address
Unit addresses for partitions should correspond to the start address.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-11-09 15:26:06 +01:00
Peter Bigot
8bb99dc9ce tests: fcb: initialize buffers to avoid processing uninitialized values
Running the test under valgrind identified three places where an
uninitialized stack buffer was used as the source of data over which a
CRC was incidently calculated, causing an uninitialized value warning
in the CRC calculation.  Zero out the source buffers before using them
as a data source.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-11-06 16:58:57 -06:00
Andrzej Puzdrowski
858db136c9 tests/subsys/setting: cleanup deletion tests
Some cleanup in tests code as after duplicates filtering
was introduced there is no need to interpret 0-length readout in
settings h_set handler

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-11-01 17:53:35 +01:00
Max van Kessel
6ece516d7b tests: add test for invalid zcan_frame
To prevent invalid use of the union id in the zcan_frame struct

Signed-off-by: Max van Kessel <max_van_kessel@msn.com>
2019-10-28 12:57:10 +02:00
Daniel Leung
b7eb04b300 x86: consolidate x86_64 architecture, SoC and boards
There are two set of code supporting x86_64: x86_64 using x32 ABI,
and x86 long mode, and this consolidates both into one x86_64
architecture and SoC supporting truly 64-bit mode.

() Removes the x86_64:x32 architecture and SoC, and replaces
   them with the existing x86 long mode arch and SoC.
() Replace qemu_x86_64 with qemu_x86_long as qemu_x86_64.
() Updates samples and tests to remove reference to
   qemu_x86_long.
() Renames CONFIG_X86_LONGMODE to CONFIG_X86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-10-25 17:57:55 -04:00
Maksim Masalski
464c795949 tests: remove duplicate names for the filesystem tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-25 00:16:31 -04:00
Maksim Masalski
2c5be79e25 tests: remove duplicate names for the shell tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:24:49 -04:00
Maksim Masalski
813ef68554 tests: updated names for the tests
Some test cases have the same test case name.
To get rid of it, I decided to change test cases names
contained same names.
Please check my logic, how I give them names.
Usually trying to give name same as a directory folder.
There are still more test cases which necessary to change,
but I will make changes by small steps.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-23 23:15:41 -04:00
Andrzej Puzdrowski
9ac3755612 settings: (NVS) fetch sector size from driver
NVS back-end initialization should fetch size of the flash erase blocks
from the flash API instead of DT. This allows to work well when used
storage partition is not located in embedded memory.

NVS back-end sector multiplier configuration was set to 8K as
DT value for native posix targets
flash sector sizes is 1 B, while its flash driver supports 8k.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-22 10:52:36 -05:00
Marc Herbert
fa84cb7e5b tests/subsys/settings: build common code as zephyr_libraries
Stops leaking very long source paths in build directories; makes them
deterministic. Finishes what was started in commit b4282bf72d, see
rationale and code reviews there.

See also CMake issue https://gitlab.kitware.com/cmake/cmake/issues/19475
for more details.

Use the opportunity to remove the most obvious duplication.

Test with: sanitycheck -T $ZEPHYR_BASE/tests/subsys/settings/

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-22 11:11:11 +02:00
Marc Herbert
5990ce3805 tests/subsys/settings/functional: de-duplicate zephyr_include_
... and move it next to zephyr_library_sources()

Follow up to commit b4282bf72d.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-22 11:11:11 +02:00
Radoslaw Koppel
daff5e93f9 Test: Settings: Fix FCB delete test
This commit fixes the FCB delete test after PR #19541.
Now the entity callback is not called on deleted element.

Issue: #19963

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-21 08:51:57 -04:00
Kamil Piszczek
7cd1a1bd7b tests: settings: functional: nvs: adding posix targets
Added native_posix and native_posix_64 targets to the functional tests
of NVS.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-15 10:50:31 +02:00
Kamil Piszczek
ce413d1412 tests: settings: functional: nvs: removing duplicated config
Removed duplicated configuration for qemu_x86 which matches the default
one.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-15 10:50:31 +02:00
Radoslaw Koppel
687a02a02d settings: file: Duplicates filtering option
This commit adds a possibility to activate duplicates filtering
during direct loading.

JIRA: NCSDK-3017

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-14 12:05:42 +02:00
Radoslaw Koppel
0b0f375190 settings: fcb: Duplicates filtering option
This commit adds a possibility to activate duplicates filtering
during direct loading.

JIRA: NCSDK-3017

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-10-14 12:05:42 +02:00
Andrzej Puzdrowski
cfffd1f782 tests/subsys/settings/nffs: fix not initialized variables issues
A few settings module variables were not initialized before used.
Normally these variable are initialized in the back-end
initialization call which couldn't be done in affected unit tests.

This path initialize these variable via assignments in test code.

fixes #19722

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-11 13:30:36 +02:00
Peter Bigot
6e5db350b2 coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Marc Herbert
b4282bf72d tests/subsys/settings/functional: make common code a zephyr_library()
Stops leaking very long source paths in build directories; makes them
deterministic.

Besides satisfying a CMake requirement, the new empty_file.c provide a
clue that the actual test code is not in the directory of the test case.

See https://github.com/zephyrproject-rtos/hal_nordic/pull/6 and
https://gitlab.kitware.com/cmake/cmake/issues/19475 for more details.

- Test with a simple:

 sanitycheck -T $ZEPHYR_BASE/tests/subsys/settings/functional/

- Before:

CMakeFiles
├── app.dir
│   ├── HOME
│   │   └── JOHN
│   │       └── zephyrproject
│   │           └── zephyr
│   │               └── tests
│   │                   └── subsys
│   │                       └── settings
│   │                           └── functional
│   │                               └── src
│   │                                   └── settings_basic_test.c.obj

- After:

func_test_bindir/
├── CMakeFiles
│   └── settings_func_test.dir
│       └── settings_basic_test.c.obj
│
├── libsettings_func_test.a

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-10-06 19:03:22 -07:00
Peter Bigot
49d6837bec samples: move board overlay files into boards directory
Application board.overlay files tend to be paired with
boards/board.conf files that extend the functionality of a board.
Move the overlay files to the same location as the config files that
they work with.

A few overlay files that are paired with a prj_board.conf file in the
application root directory are left in place.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-01 20:38:24 -07:00
Charles E. Youse
ce46e0df4d cmake: samples/tests: update cmake_minimum_required() to 3.13.1
Some samples/tests are still referring to 3.8.x versions.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-27 23:09:24 -04:00
Anas Nashif
32a9435ea4 tests: tracing: add tests for tracing features
Mostly build tests now, will be extended to verify CTF output once we
have this feature in sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-09-27 14:42:22 -04:00
Kamil Piszczek
e11248baa6 tests: subsys: settings: nvs: intergrating tests with nvs backed
Integrated Settings module tests with the NVS backend. The batch of
tests is shared with other backends.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Kamil Piszczek
ef0e91aa8a tests: subsys: settings: functional: test name change for fcb & nvs
Changed the name of functional tests for NVS and FCB in the test
configuration file to avoid duplication with other test suites.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Kamil Piszczek
43943b94d7 tests: subsys: settings: tightening scope of common test functions
Limited the scope of helper functions that are used in the common test
source. Now it is easier to identify which functions are intended to be
used in the test suite.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-27 10:06:40 -07:00
Paul Sokolovsky
ae5a7bb579 tests: subsys: jwt: Remove unneeded CONFIG_PTHREAD_IPC option
As it stands, this option leads to conflict between Newlib and POSIX
headers. (Which needs to be resolved separately.)

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-09-25 20:56:29 -07:00
Radoslaw Koppel
6c2add5445 settings: Direct loading functionality
This commit allows loading data from settings permanent storage
directly to the given callback function.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-09-24 14:15:38 +02:00
Peter Bigot
d2ad8fca48 tests: exclude platforms with limited flash
Platforms with limited flash are now failing to link.  Add or increase
flash requirements for test cases to exclude the ones that will fail.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-09-23 17:49:46 -07:00
Jan Van Winkel
7a70fa8488 usb: tests: Pass correct lengths to hexdump in usb bos test
Pass correct length to hexdump in usb bos test to prevent overun
of global data.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-16 15:33:10 -05:00
Charles E. Youse
097c30c863 tests/subsys/logging/log_core: increase log buffer size
The test needs to cram at least 8 messages into the log buffer, but
with 64-bit pointers only 5 fit, so make the buffer a bit bigger.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-15 11:33:47 +08:00
Kumar Gala
69ba9dafcb tests/subsys/settings/fcb: Fix ifdef in ztest_test_suite
We don't allow an ifdef in ztest_test_suite because its a macro.  We
usually handle this by defining multiple blocks and ifdef around them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-09-13 10:27:49 -05:00
Andrew Boie
2192499fe0 tests: enable log in immediate mode by default
Fatal error reporting now only dumps to the log mechanism,
so enable it in immediate mode for all tests to ensure
that fatal errors are visible and no messages are lost.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-12 05:17:39 -04:00
Andrzej Puzdrowski
94a022c954 fcb: start using errno codes
Switch form using privater FCB error codes to
errno codes. FCB private codes convention were compatible
with <errno.h> codes:
- 0 mean success
- negative values mean errors
- similar error types.
There was no sense to kept private FCB error codes.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-09-08 12:42:53 +02:00
Jan Van Winkel
4539c4bee1 tests: littlefs: Added support for native posix
Added support for native posix boards to littlefs tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-08 12:35:39 +02:00
Kamil Piszczek
c05b0c74a3 tests: subsys: settings: functional: nvs & fcb split for CI
Splitted configuration for NVS & FCB so it is possible for the CI to
pick it up.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Kamil Piszczek
03c79fa10e tests: subsys: settings: functional: fix for nvs backend
Fixed build failure for the Settings NVS backend.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-09-08 12:35:15 +02:00
Andrzej Puzdrowski
6bae22d290 tests/subsys/fs/nvs: extend entry delete test
Extended case for testing deletion of the first entry while
it is the most recent one.
This extension allow to reproduce issue #18813 and shows that
the bugfix works well.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-09-02 12:31:42 +02:00
Carles Cufi
6f5dc33ef4 nvs: Fix deletion of the last entry added
Make sure that the last entry added is deleted correctly by storing the
fact that one was found in a local variable.

Fix by Laczen JMS <laczenjms@gmail.com>

Fixes #18813.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-09-02 12:31:42 +02:00
Carles Cufi
351bef1dd2 tests: settings: Fix coverity issue CID 203623
Mask the value passed to memset() to avoid an error from Coverity.

Fixes #18687.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-08-30 12:30:59 +02:00
Andrzej Puzdrowski
93702e2daf tests/subsys/settings/fcb_int: add storage preparation
The test assumes that storage is clear before it runs. This
might be not true as lot of devices are only partially erased by
'west flash'.

Patch introduce procedure for testing whether test runs the first
time and clear storage if so.

The procedure uses mark which is stored inside SoC embedded program
flash. It will not work one devices on which read/write to it is
impossible.

fixes #16463

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-24 00:58:41 +02:00
Andrzej Puzdrowski
bf4c969b62 tests/subsys/settings/fcb: deletion test
Add test for check whether deleted entry is recognized properly
after settings reload.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-20 13:18:38 +02:00
Peter Bigot
204c9971ab subsys/fs/littlefs: fix Coverity issues
Closes #18392 by asserting and returning an error if the block size is
not positive.

Closes #18458.  The diagnosis here was not relevant as an in-range EOS
is written before the buffer is used, but using the non-terminated
length is slightly more clear about intent and may avoid a read overrun
of the mount point.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-19 08:34:17 +02:00
Nicolas Pitre
7f74825958 riscv: add a qemu_riscv64 board
This emulates a RISC-V in 64-bit mode on a SiFive FE310 dev board.
Memory is tight so a few tests had to be disabled due to the extra
memory usage compared to qemu_riscv32.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-08-09 09:11:45 -05:00
Andrzej Puzdrowski
27109e6378 tests/subsys/settings/fcb: add check for target compatibility
Added tests of flash driver compatibility with fcb-backend.

For flash drivers which support write-block-size bigger than 1 B
test of unaligned data access uses native write-block-size
as it is dedicated to check whether settings works well on platform
which has 1 B access which is native on the current DUT.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-08 08:47:44 -05:00
Andrzej Puzdrowski
f46cf1d6d2 tests/subsys/fs/nvs: entry delete test
Added test for check behavior on deleting existent entry,
nonexistent entry and already deleted entry.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-08 11:07:48 +02:00
Andrzej Puzdrowski
84d657c217 tests/subsys/fs/nvs: init on full storage test
Added test for check wheter initialization works well when nvs
storage is full filled. Test also check weheter can delet any
entry from full filled NVS.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-08-08 11:07:48 +02:00
Peter A. Bigot
167eb53e74 subsys/fs/littlefs: allow customization of file system configuration
There's desire to be able to customize parameters on a per-filesystem
basis, which means we need a way to override the Kconfig defaults which
are global.  This also means the littlefs data structure cannot own the
cache and lookahead buffers.

Switch to using a macro to define the littlefs data structure.  The
default version uses the Kconfig constants.  A custom one takes
arguments providing the most likely partition-specific parameters.
Finally the user is free to bypass the helper macros and set any
parameters desired, though validation is limited and only present when
CONFIG_DEBUG is enabled.

Extend the test suite with a performance module, which confirms that
these settings have an impact proportional to the log of changes to the
cache or IO sizes.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-06 19:39:26 +02:00
Peter A. Bigot
a8b7a21524 subsys/fs: remove ambiguity in readdir results
Existing file system implementations do not provide the special "."
(current) and ".." (parent) directory entries in the readdir results.
littlefs does.

Remove these entries in the abstraction layer.  This simplifies code in
higher level consumers that aren't prepared to see them.  Consumers like
FUSE that need them can put them back without having to worry about
conflicts.

Closes issue #17951

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-06 19:39:26 +02:00
Peter A. Bigot
979fb85d50 tests/subsys/fs/littlefs: add tests
Verify all FS API calls using the nRF52840 development kit.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-08-06 19:39:26 +02:00
Anas Nashif
ffaba63b10 boards: remove arduino 101 and related boards
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Peter A. Bigot
c59bac35db tests/subsys/settings/functional: test external flash
Use the external flash on the Particle Xenon to confirm basic
functionality on a spi-nor device.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot
33b10aa76a tests/subsys/settings/functional: ensure settings area is cleared
The test assumes that the settings area is empty.  This happens
naturally when the area is in the SOC flash and the chip flash is
entirely erased when the test is programmed.  The test will fail if the
programmed board is reset and the test run again.

The test cannot pass by reprogramming when the storage area is in an
external flash device.

Make things repeatable for FCB by erasing the storage partition before
running the test.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-24 09:20:56 -04:00
Peter A. Bigot
765c06376c Revert "sys/util.h: helper macro to perform pointer difference"
This reverts commit 755cc644cc.

This approach is problematic in several ways.  First, `intptr_t` could
cause undefined behavior in the subtraction when the pointer converts to
a negative value.  Except in weird cases where the sign of the pointer
identifies a memory domain (like kernel vs userspace) I'm unaware of any
valid use of `intptr_t`.

Second, this macro was created to address a special need that cannot
rely on defined behavior: i.e. to ensure that data definitions are
placed in contiguous space and access is provided through linker-defined
symbols, for which the language required alignment and continuity is not
guaranteed.

A macro that calculates the span between linker symbols has very
different semantics than one that calculates the difference between
pointers.  Replace the global PTR_DIFF with a documented local macro
that tests what's necessary without risking integer overflow.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2019-07-17 03:44:03 -04:00
Nicolas Pitre
6609c12516 tests: enable native_posix_64 testing
Whenever conditions are applied to native_posix, they should apply to
native_posix_64 too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Nicolas Pitre
9fac66ca54 tests: usb: make 64-bit compatible
Let's use the PTR_DIFF() helper which performs pointer difference in a
64-bit compatible way, and use %zu for printing sizeof() results.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-12 17:39:43 -07:00
Nicolas Pitre
0aa796cbaa print format: adjust specifiers to be compatible with a 64-bit build
The size_t type is either compatible with an int on 32-bit target, or
a long on 64-bit targets. It could even be a long even on some 32-bit
targets. Let's use the z qualifier in the printf format to be compatible
with whatever flavor in use.

In case of pointers, let's just use %p with pointers directly and
avoid casts altogether.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-11 20:12:26 -07:00
Nicolas Pitre
d7e49ee3e7 tests: subsys: settings: fix pointer mismatch on 64-bit targets
This fixes the following error:
passing argument 5 of ‘fsutil_read_file’ from incompatible pointer type

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-11 09:40:20 +02:00
Kamil Piszczek
2222d14549 tests: settings: adding nvs backend configuration to functional tests
Added the NVS backend configuration to functional tests of the Settings
module.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-07-10 10:57:22 +02:00
Nicolas Pitre
6455ddbd4e test/usb: fix pointer type mismatch
The 4th argument of usb_dc_ep_write() should be a u32_t* not a size_t*.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-05 14:16:50 -04:00
Johann Fischer
ab8bcd2044 tests: usb: do not set device address
Forced attempt to set the device address is unpredictable
and also should not be done during testing.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2019-07-04 21:36:07 +02:00
Nicolas Pitre
70e77becb1 shell_history_test: make the test succeed on 64-bit targets
A buffer size of 128 bytes is just not quite big enough on 64-bit
targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-04 07:24:56 -04:00
Ioannis Glaropoulos
e8f2d86d94 tests: remove redundant CONFIG_HW_STACK_PROTECTION=y setting
CONFIG_TEST_HW_STACK_PROTECTION is set by default in tests,
and that one selects HW_STACK_PROTECTION option. Therefore,
we do not need to set that one explicitly in the test project
configuration files. We clean up some redundant occurrences of
CONFIG_HW_STACK_PROTECTION=y from the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-07-01 12:54:20 -07:00
Anas Nashif
5b0aa794b2 cleanup: include/: move misc/reboot.h to power/reboot.h
move misc/reboot.h to power/reboot.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
5eb90ec169 cleanup: include/: move misc/__assert.h to sys/__assert.h
move misc/__assert.h to sys/__assert.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
fe051a9055 cleanup: include/: move flash.h to drivers/flash.h
move flash.h to drivers/flash.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
c0c9396d44 cleanup: include/: move can.h to drivers/can.h
move can.h to drivers/can.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
4be2e9ebb6 cleanup: include/: move zephyr/jwt.h to data/jwt.h
move zephyr/jwt.h to data/jwt.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
0abdacf3a4 cleanup: include/: move json.h to data/json.h
move json.h to data/json.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
f641d099cc cleanup: include/: move disk_access.h to disk/disk_access.h
move disk_access.h to disk/disk_access.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
52e0efac97 cleanup: include/: move stats.h to stats/stats.h
move stats.h to stats/stats.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
f048792888 cleanup: include/: move nvs/nvs.h to fs/nvs.h
move nvs/nvs.h to fs/nvs.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif
d918c98e1d cleanup: include/: move fcb.h to fs/fcb.h
move fcb.h to fs/fcb.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00