Commit ba4cea40 authored by Marcin Niestroj's avatar Marcin Niestroj Committed by Carles Cufi
Browse files

tests: settings: file_littlefs: relax dependency on LittleFS



Do some internal renaming to relax dependency on using LittleFS
specifically, making this test likely to be run on any FS.

Rename device-tree partition name `littlefs_dev` ->
`settings_file_partition`, so as does not need to be LittleFS to be
mounted and used for File settings storage.

Rename `config_setup_littlefs()` to `config_setup_fs()`, which can be
implemented for any other FS of choice.

Change FS mount point from '/littlefs' to '/fs'.

Rename `settings_test_littlefs.c` -> `settings_test_fs.c`, as this one just
defines test suites and there is nothing LittleFS specific.

Build `settings_setup_littlefs.c` only when
`CONFIG_FILE_SYSTEM_LITTLEFS=y`, so that any other FS can be added at a
later point with its specific implementation of `config_setup_fs()`
function.

Signed-off-by: default avatarMarcin Niestroj <m.niestroj@emb.dev>
parent 413f8497
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@
	partitions {
		compatible = "fixed-partitions";

		littlefs_dev: partition@0 {
			label = "littlefs_dev";
		settings_file_partition: partition@0 {
			label = "settings_file_partition";
			reg = <0x00000000 0x00010000>;
		};
	};
+2 −2
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@
	partitions {
		compatible = "fixed-partitions";

		littlefs_dev: partition@0 {
			label = "littlefs_dev";
		settings_file_partition: partition@0 {
			label = "settings_file_partition";
			reg = <0x00000000 0x00010000>;
		};
	};
+2 −2
Original line number Diff line number Diff line
@@ -10,8 +10,8 @@
		#address-cells = <1>;
		#size-cells = <1>;

		littlefs_dev: partition@0 {
			label = "littlefs_dev";
		settings_file_partition: partition@0 {
			label = "settings_file_partition";
			reg = <0x00000000 0x00010000>;
		};
	};
+2 −3
Original line number Diff line number Diff line
@@ -11,6 +11,5 @@ zephyr_include_directories(
	${ZEPHYR_BASE}/tests/subsys/settings/file_littlefs/src
	)


FILE(GLOB mysources *.c)
target_sources(app PRIVATE ${mysources})
target_sources(app PRIVATE settings_test_fs.c)
target_sources_ifdef(CONFIG_FILE_SYSTEM_LITTLEFS app PRIVATE settings_setup_littlefs.c)
+2 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
#include <zephyr/fs/fs.h>
#include <zephyr/fs/littlefs.h>

#define LITTLEFS_PARTITION	littlefs_dev
#define LITTLEFS_PARTITION	settings_file_partition
#define LITTLEFS_PARTITION_ID	FIXED_PARTITION_ID(LITTLEFS_PARTITION)

/* LittleFS work area struct */
@@ -21,7 +21,7 @@ static struct fs_mount_t littlefs_mnt = {
	.mnt_point = TEST_FS_MPTR,
};

void *config_setup_littlefs(void)
void *config_setup_fs(void)
{
	int rc;
	const struct flash_area *fap;
Loading