Commit Graph

27 Commits

Author SHA1 Message Date
Anas Nashif a543ba1f4d tests: use integration_platforms where applicable
Use integration_platforms where coverage is provided using one or few
targets instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-26 17:52:02 -04:00
Dominik Ermel abb93d4089 fs: Prevent mounting file system re-using private data
The commit changes the fs_mount to not allow mounting same system,
with the same private data pointer, at two different mount paths.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-03-20 09:51:10 +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
Meng xianglin 26f0a4f594 tests: fs_api: move to new ztest API
all test cases in tests/subsys/fs/fs_api are moved to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-06 12:36:24 +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
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
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
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
Dominik Ermel e489bb18a4 fs: Fix fs_statvfs returning 0 when statvfs not implemented
The fs_statvfs is supposed to return, as all VFS functions, -ENOTSUP
error when underlying file-system driver does not implement the
API call.
The fs_statvfs was returning 0 for success and when API call is not
implemented, which means it is indistinguishable whether stat
structure has been filled by diver with any data or not touched at all.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-11-09 11:19:40 +01:00
Henrik Brix Andersen 265cdf8dc6 cmake: use find_package() instead of literal include in tests and samples
Convert remaining tests and samples to using find_package() instead of
literally including the CMake boilerplate code.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2021-11-01 10:33:09 -04: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 6fb7ac233c fs: Fix fs_opendir resource leak when invoked on fs_dir_t object in use
Fixes problem when fs_opendir invoked on fs_dir_t object,
which is already holding information on opened directory,
overwrites references to other memory objects within
the fs_dir_t object causing resource leak.
If fs_opendir is invoked on already used fs_dir_t object,
it will return
-EBUSY.

Note: The change requires that all fs_dir_t objects should be
initialized to 0.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-02-05 07:32:20 -05:00
Andrzej Puzdrowski 9fcf72f8b7 tests/subsys/fs/fs_api: remove dir-multi-open test
That whether a FS implementation allow to open
same directory multiple time is FS implementation
dependent. It shouldn't be tested. Such test was removed.

However need to test whether API transfers failures from
underlying FS properly.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-02-05 07:32:20 -05:00
Andrzej Puzdrowski 0f0cccd45b tests/subsys/fs/fs_api: Add fs_dir_t type variable init.
The commit adds initializations of fs_dir_t variables in preparation
for fs_opendir function change that will require fs_dir_t object, passed
to the function, to be initialized before first usage.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-02-05 07:32:20 -05:00
Andrzej Puzdrowski 109f1ab42b fs: Add fs_dir_t_init() function
The fs_dir_t_init() function has been added that should be used
for initialization of fs_dir_t structures before passing them
to fs_open and other functions.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-02-05 07:32:20 -05:00
Dominik Ermel d4666f537c fs: Fix fs_open resource leak when invoked on fs_file_t object in use
Fixes problem when fs_open invoked on fs_file_t object, which is already
holding information on opened file, overwrites references to other
memory objects within the fs_file_t object causing resource leak.
If fs_open is invoked on already used fs_file_t object, it will return
-EBUSY.

Note: The change requires that all fs_file_t objects should be
initialized to 0.

Fixes: #29478

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-29 08:04:51 -05:00
Dominik Ermel 40572fde20 fs: Add fs_file_t_init() function
The fs_file_t_init() function has been added that should be used
for initialization of fs_file_t structures before passing them
to fs_open and other functions.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-29 08:04:51 -05:00
Dominik Ermel a910b26587 tests/fs/fa_api: Fix order of checks and broken zassert messages
The commit fixes three things:
 - the order of zassert_* checks has been often incorrect, and some
   checks of values have been done after some other operations has
   been performed;
 - some operations have been missing checks at all;
 - most of zassert_* messages have been given ret parameter to be
   printed but it has been missing from format string.

This addresses:
Coverity CID :215714
GH Issue: #31668

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-28 09:28:20 -05:00
Dominik Ermel 738bddf765 tests: fs: Add tests for fs_tell/fs_seek ENOTSUP error
The fs_seek and fs_tell are expected to return -ENOTUSP if file system
driver lacks implementation of said funcions.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-01-09 08:33:24 -05:00
Meng xianglin 04d8d485e8 test: fs: improve code coverage for file system core
Refine test cases to improve code coverage

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2020-12-15 11:17:54 +01:00
iva kik 7140c21044 tests: fs: check for arguments NULLness
Before referencing mountp argument, check for it's NULLness

Fixes #29704

Signed-off-by: iva kik <megatheriumiva@gmail.com>
2020-11-17 14:52:39 -06:00
Dominik Ermel 86dcaebbe7 tests/fs/fs_api: Add API tests fo FS_MOUNT_FLAG_READ_ONLY
The commit adds read-only mount scenario tests to fs_api test
suite.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-11-06 13:10:13 -05:00
Dominik Ermel e7886c6634 fs: fs_unmount will return -ENOTSUP if not implemented by driver
The commit changes error handling by fs_unmount; the function will
return -EINVAL if mount point, described by mp, is not mounted or
-ENNOTSUP when unmounting is not supported by the driver; in the second
case it will also log error.

Additionally to the above changes, checks for correct mnt_path and
mnt_path, within fs_unmount, have been removed as they are not needed;
only the fs_mount_t->fs pointer is needed to decide whether system is
mounted or not.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-30 15:54:04 +01:00
Dominik Ermel 5faf3750bc fs: fs_mount parameter verification before mutex locked block
The commit moves fs_mount parameter verification above mutex lock.
The list of mount points is now checked before attempting to obtain
file system API pointer.
All modifications to mount point data structure, given as a parameter
to the fs_mount, are only applied after every other operation needed
have completed successfully, immediately before adding the mount point
to the list of mount points.
The fs_mount will a warning when mounted file system does not support
unmount.
When a file system does not provide mount function, the -ENOTSUP error
will be returned instead of -EINVAL.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-30 15:54:04 +01:00
Dominik Ermel 1241e67790 fs: Move fs_file_system_t declaration out of fs.h
The struct fs_file_system_t is only useful when defining file system
drivers and is not required for typical application development,
that is why it has been moved to separate file fs_sys.h.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-10-23 12:55:41 +02:00
Peter A. Bigot 338f0caca0 tests: fs: update for change in capability
FS_TYPE_END is no longer used as there is no hard-coded limit on the
number of file systems.  Replace with the limit used when only in-tree
file systems are enabled.

The test for unsupported file systems is no longer valid.  Instead
verify that attempting to register a file system when there is no room
for it fails as expected.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-09-03 21:49:34 +02:00
Meng xianglin 21638f054f test: fs: Test cases for file system interfaces
Focus on file system interfaces implemented in file system core,
not specific file system.

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2020-08-14 15:44:06 -04:00