Commit graph

141 commits

Author SHA1 Message Date
Marcin Niestroj 6bb3d32f32 tests: settings: nvs: remove unused settings handlers
There are three settings handlers defined, but just the first
one (`c_test_handlers[0]`) is registered and used in NVS specific tests.
Remove unused handlers, as it is really a dead code.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-08 17:38:35 +09:00
Marcin Niestroj f2b129d35c tests: settings: fcb: remove unused zephyr/sys/printk.h
There are no printk invocations from ztest, so drop that header.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-08 17:38:35 +09:00
Marcin Niestroj f34ed3d181 tests: settings: fcb: remove local test_config_insert{2,3} prototypes
Both functions are declared in `settings_test.h`, so there is no reason to
declare them locally as well.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-08 17:38:35 +09:00
Dominik Ermel 7c3a70a35b settings: file: Fix flash area erase offset
Incorrect erase start offset has been given.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-12-07 10:22:41 +00:00
Marcin Niestroj 47c8db5e63 tests: settings: remove passing -DTEST_${TEST} from cmake
This feature is not used in most tests, as there is no logic in C code that
utilizes `#ifdef TEST_x` statement.

The only test that does that is `tests/subsys/settings/fcb/` where `#ifdef
TEST_LONG` is used, so leave that test case untouched.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-07 10:19:57 +00:00
Marcin Niestroj 673b0665d3 tests: settings: file: remove declarations of ZTEST() routines
Remove declarations of ZTEST() routines in header file, because there is
simply no value in having it.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-12-06 09:45:50 -05:00
Anas Nashif ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Marcin Niestroj daee6cb4a9 settings: file: change FS (or file system) wording to File
Currently there is inconsistency in repository file names, APIs, Kconfig
options and documentation around file / file-system backend for settings
storage, as both "file" and "FS (file system)" are used. As an example,
there is `CONFIG_SETTINGS_FS` Kconfig option, but the file that implements
this settings backend is called `settings_file.c`. Another example are
names of static functions that implement settings storage API:
`settings_file_load()`, `settings_file_save()` and
`settings_fs_storage_get()`.

This backend is actually storing all settings in a single file, so it makes
sense to use "File" as the name of backend, instead of a more general
"FS" (which would make sense if several files would be used to store
settings).

Fix inconsistency in used wording in the tree and unify it to "settings
file backend". This naming is more precise to how the implementation looks.
It will also make it easier to grep through the codebase and analyze
existing code.

Deprecate settings_mount_fs_backend() function and all Kconfig options
starting with `CONFIG_SETTINGS_FS`.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2022-11-24 09:36:31 +01:00
Michał Barnaś dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Dominik Ermel 60e0c698f6 tests/settings: Switch from FLASH_AREA_ to FIXED_PARTITION_ macros
The commit switches flash area access from FLASH_AREA_ macros
to FIXED_PARTITION_ macros and to usage of DTS node labels,
to identify partitions, instead of label property.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-09-06 09:56:37 +02:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Meng xianglin cd288ff907 tests: settings: functional: move to new ztest API
All test cases in tests/subsys/settings/functional are moved
to new ztest API.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-08-26 11:56:51 +02:00
Meng xianglin 96484695e7 tests: settings: move to new ztest API
test cases in tests/subsys/settings/fcb, tests/subsys/settings/littlefs,
tests/subsys/setttings/nvs all depend on tests/subsys/settings/src and
tests/subsys/settings/fs, so update them in one commit.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-08-26 11:56:51 +02:00
Dominik Ermel f2a338c77b tests/settings: Small cleanup of settings_basic_test.c
Fixed indentation and some ifdefs.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-08-18 12:51:07 +02:00
Kun Li 80a9b7aefc tests: fcb_init: move testcases to new API
move fcb_init testcases to new API.

Signed-off-by: Kun Li <kun1x.li@intel.com>
2022-08-12 14:18:05 +01:00
Dominik Ermel d7c2a97fc5 tests/settings/fcb: Pick flash parameters from flash area device
The commit fixes code to pick flash parameters from flash area
device rather than chosen 'zephyr,flash'.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2022-08-03 05:01:30 +01:00
Gerard Marull-Paretas 5a44f2e33f include: add missing zephyr/ prefixes
Some files were missed during the migration. This patch adds the prefix
where missing.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-02 18:03:58 +01:00
Fabio Baltieri def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Andrzej Puzdrowski ccf8c547d0 settings: API for get storage instance used
Added API function +int settings_storage_get(void **storage)
which allows to get storage instance used by the
settings backed to store its records.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-08-02 15:15:10 +02:00
Andrzej Puzdrowski 18b44746aa tests/subsys/settings: cleanup raw subdirectory usage
./raw directories for each testsuite were remains after having
base64 encoding test variant beside which raw variant was existing.

This patch flatten the directories structures.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-08-01 18:02:41 +02:00
Andrzej Puzdrowski bcd4d0f2d8 tests/subsys/settings/littlefs: remove base64 variant
These tests are identical as RAW variant,
since the base64 settings encoding was removed (#26053)
from the settings.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-08-01 18:02:41 +02:00
Fabio Baltieri e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Alexander Mihajlovic 296d51511d tests: settings: Add tests for chosen zephyr,settings-partition
Add test cases using settings-partition chosen for both FCB and NVS.

Signed-off-by: Alexander Mihajlovic <a@abxy.se>
2022-03-24 08:16:46 -04:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Carles Cufi 4b8f1c04ab kconfig: Rename the ZTEST stack size option to align with the rest
All stack sizes should end with STACK_SIZE.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-22 08:23:05 -05:00
Yuval Peress d733153fe6 tests: settings: Update test project structures
Update the structure to reduce redundancies with additional config
files needed for native_posix platforms that replicate most of the
same config values.

Signed-off-by: Yuval Peress <peress@google.com>
2022-02-11 09:47:57 -05:00
Yuval Peress 7f90587e7e test: settings: functional: fix missing test_main
The functional tests for settings subsystem regressed with the
introduction of the weak test_main function. This was caused by
Issue #19582 since the common code was being linked as a library.

Update the logic of the common code to directly add the sources
to the `app` target. This resolved both Issue #19582 and #42396

Signed-off-by: Yuval Peress <peress@google.com>
2022-02-11 09:47:57 -05:00
Yuval Peress 7b1a56f40f tests: settings: Remove invalid config
Tests running on native_posix and native_posix_64 are selecting
CONFIG_STDOUT_CONSOLE, but this config value depends on
!NATIVE_APPLICATION. This configuration causes the CI to fail.

Signed-off-by: Yuval Peress <peress@google.com>
2022-02-11 09:47:57 -05:00
Anas Nashif ca565118ea tests: settings: provide correct test prototypes
More issues with missing prototypes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-02-07 12:39:42 -05:00
Anas Nashif 6b3cde2289 tests: settings: provide correct test prototypes
Add prototypes for renamed test functions. Issue was introduced in
677ffc883a.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-02-07 10:48:18 -05:00
Piotr Golyzniak 677ffc883a tests: settings: fix wrong test case names
Change test case names to proper one, which start from "test_"
characters.

Signed-off-by: Piotr Golyzniak <piotr.golyzniak@nordicsemi.no>
2022-02-07 09:29:09 -05:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Andrzej Puzdrowski da9e947f7a tests/subsys/setting/functional: ignore settings_delete() retval
Explicitly ignore return value of the settings_delete() call.

fixes #32921

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-05-20 19:44:35 +02:00
Gerard Marull-Paretas f163bdb280 power: move reboot functionality to os lib
Reboot functionality has nothing to do with PM, so move it out to the
subsys/os folder.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:34:00 -04:00
Andrzej Puzdrowski 53f9a931f4 tests/tree-wide: remove flash_write_protection_set() usage
flash_write_protection_set() was deprecated.
This patch removes usage of it.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Torsten Rasmussen a1e8456bfe tests: link settings_test_fs with kernel
This is needed because Zephyr libraries created after
`find_package(Zephyr)` are not pure Zephyr libraries, as they are not
in the `whole-archive` linking grouping.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-03-03 20:06:00 -05:00
Dominik Ermel 6bb3706606 tests/settings: Add fs_file_t type variable initializations
The commit adds initializations of fs_file_t variables in preparation
for fs_open function change that will require fs_file_t object, passed
to the function, to be initialized before first usage.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-29 08:04:51 -05:00
Ioannis Glaropoulos 792bec2be8 boards: arm: remove non-existing doc link from partition definitions
In the flash partition definitions for ARM boards,
the link to the legacy partition macros does not
exist any more. The commit cleans up the partition
definition by removing this link.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-10-27 15:01:19 -04:00
Kumar Gala 55be783c85 settings: Remove deprecated SETTINGS_USE_BASE64 support
Remove code and associated tests and Kconfig related to
SETTINGS_USE_BASE64 that was deprecated in Zephyr 2.2

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-10-01 07:05:27 -05:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Anas Nashif dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
David Leach 90c113b4df tests: settings: Fix coverity issue CID 211044
Check the return value of settings_subsys_init() call.

Fixes #26358

Signed-off-by: David Leach <david.leach@nxp.com>
2020-08-16 09:29:41 -04:00
Eug Krashtan a6ea1cffc9 boards: dts: Fix broken link in comment
Update broken hyperlink in comment to current location

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2020-07-31 09:00:32 -05:00
Dominik Ermel cac07629bf subsys/fs: Add open flags parameter to fs_open
The fs_open has been extended with support for open flags.
Currently supported flags are:
  FS_O_READ -- open for read
  FS_O_WRITE -- open for write
  FS_O_CREATE -- create file if it does not exist
  FS_O_APPEND -- move to the end of file before each write

The FAT FS and LittleFS front-ends within the Zephyr has also been
modified to utilize the flags.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-07-30 16:33:18 +02:00
Dominik Ermel b71613a33a tests: settings: Fix unchecked return value
A value returned by flash_area_erase has not been checked.

Fixes #25728
Coverity-CID: 210050

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-07-28 18:23:08 -04:00
Reto Schneider 0b4b3ae4dd cmake, samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming multiple projects
"NONE" defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names, small, manual adjustments
have been done.

See also 7eabab2f5d ("samples, tests: Use semi-accurate project names")

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2020-06-09 08:18:29 -04:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Andrzej Puzdrowski 48af970339 tests/subsys/settings/functional/nvs: add nrf52xx configuration
Added configuration which allows to run test-suite
on nrf52840dk_nrf52840 and nrf52dk_rf52832 boards.

fixes #25701

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-05-28 17:11:12 +02:00