Skip to content

Commit 2eb992a

Browse files
de-nordicnashif
authored andcommitted
tests: fs: littlefs: 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 <[email protected]>
1 parent a1b1fa0 commit 2eb992a

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

tests/subsys/fs/littlefs/src/test_lfs_basic.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ static int create_write_hello(const struct fs_mount_t *mp)
7777
struct testfs_path path;
7878
struct fs_file_t file;
7979

80+
fs_file_t_init(&file);
8081
TC_PRINT("creating and writing file\n");
8182

8283
zassert_equal(fs_open(&file,
@@ -144,6 +145,7 @@ static int verify_hello(const struct fs_mount_t *mp)
144145
struct testfs_path path;
145146
struct fs_file_t file;
146147

148+
fs_file_t_init(&file);
147149
TC_PRINT("opening and verifying file\n");
148150

149151
zassert_equal(fs_open(&file,
@@ -175,6 +177,7 @@ static int seek_within_hello(const struct fs_mount_t *mp)
175177
struct testfs_path path;
176178
struct fs_file_t file;
177179

180+
fs_file_t_init(&file);
178181
TC_PRINT("seek and tell in file\n");
179182

180183
zassert_equal(fs_open(&file,
@@ -242,6 +245,7 @@ static int truncate_hello(const struct fs_mount_t *mp)
242245
struct testfs_path path;
243246
struct fs_file_t file;
244247

248+
fs_file_t_init(&file);
245249
TC_PRINT("truncate in file\n");
246250

247251
zassert_equal(fs_open(&file,
@@ -332,6 +336,7 @@ static int sync_goodbye(const struct fs_mount_t *mp)
332336
struct testfs_path path;
333337
struct fs_file_t file;
334338

339+
fs_file_t_init(&file);
335340
TC_PRINT("sync goodbye\n");
336341

337342
zassert_equal(fs_open(&file,
@@ -395,6 +400,7 @@ static int verify_goodbye(const struct fs_mount_t *mp)
395400
struct testfs_path path;
396401
struct fs_file_t file;
397402

403+
fs_file_t_init(&file);
398404
TC_PRINT("verify goodbye\n");
399405

400406
zassert_equal(fs_open(&file,

tests/subsys/fs/littlefs/src/test_lfs_dirops.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static int check_mkdir(struct fs_mount_t *mp)
6262
struct fs_file_t file;
6363
struct testfs_path fpath;
6464

65+
fs_file_t_init(&file);
6566
zassert_equal(fs_open(&file,
6667
testfs_path_extend(testfs_path_copy(&fpath,
6768
&dpath),

tests/subsys/fs/littlefs/src/test_lfs_perf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static int write_read(const char *tag,
3636
int rc;
3737
int rv = TC_FAIL;
3838

39+
fs_file_t_init(&file);
3940
TC_PRINT("clearing %s for %s write/read test\n",
4041
mp->mnt_point, tag);
4142
if (testfs_lfs_wipe_partition(mp) != TC_PASS) {

tests/subsys/fs/littlefs/src/testfs_mount_flags.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void test_fs_mount_flags(void)
2626
int ret = 0;
2727
struct fs_file_t fs;
2828

29+
fs_file_t_init(&fs);
2930
cleanup(mp);
3031

3132
/* Test FS_MOUNT_FLAG_NO_FORMAT flag */

tests/subsys/fs/littlefs/src/testfs_util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ int testfs_build(struct testfs_path *root,
232232
if (TESTFS_BCMD_IS_FILE(cp)) {
233233
struct fs_file_t file;
234234

235+
fs_file_t_init(&file);
235236
rc = fs_open(&file,
236237
testfs_path_extend(root,
237238
cp->name,
@@ -296,6 +297,7 @@ static int check_layout_entry(struct testfs_path *pp,
296297
if (statp->type == FS_DIR_ENTRY_FILE) {
297298
struct fs_file_t file;
298299

300+
fs_file_t_init(&file);
299301
rc = fs_open(&file, pp->path, FS_O_CREATE | FS_O_RDWR);
300302
if (rc < 0) {
301303
TC_PRINT("%s: content check open failed: %d\n",

0 commit comments

Comments
 (0)