Skip to content

Commit 99dffa2

Browse files
brudleysabhiram
authored andcommitted
Tweak block size for lfs tests while on SCORPIO_FLASH. (#27)
* Also skip leading slash test
1 parent a632ddc commit 99dffa2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,23 @@ static int clean_statvfs(const struct fs_mount_t *mp)
6262
stat.f_bsize, stat.f_frsize, stat.f_blocks, stat.f_bfree);
6363
zassert_equal(stat.f_bsize, 16,
6464
"bsize fail");
65+
#ifdef CONFIG_SCORPIO_FLASH
66+
/*
67+
* Scorpio emulates flash using 512 byte blocks vs 4k blocks.
68+
* 512 blocksize * 128 blocks == 64k
69+
* Silly that this is hardcoded.
70+
*/
71+
zassert_equal(stat.f_frsize, 512,
72+
"frsize fail");
73+
zassert_equal(stat.f_blocks, 128,
74+
"blocks fail");
75+
#else
76+
/* 4k blocksize * 16 blocks == 64k */
6577
zassert_equal(stat.f_frsize, 4096,
6678
"frsize fail");
6779
zassert_equal(stat.f_blocks, 16,
6880
"blocks fail");
81+
#endif
6982
zassert_equal(stat.f_bfree, stat.f_blocks - 2U,
7083
"bfree fail");
7184

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void test_util_path_init_base(void)
3838
"bad mnt init return");
3939
zassert_equal(strcmp(path.path, mnt.mnt_point), 0, "bad mnt init path");
4040

41+
#ifndef CONFIG_SCORPIO_FLASH
4142
if (IS_ENABLED(CONFIG_DEBUG)) {
4243
struct fs_mount_t invalid = {
4344
.mnt_point = "relative",
@@ -46,6 +47,14 @@ void test_util_path_init_base(void)
4647
/* Apparently no way to verify this without panic. */
4748
testfs_path_init(&path, &invalid, TESTFS_PATH_END);
4849
}
50+
#else
51+
/* This is a lame test that checks for leading slash in pathname
52+
* and actually asserts the machine when things are CORRECT if CONFIG_DEBUG is set.
53+
* Since we run with CONFIG_DEBUG, we assert (even when correct).
54+
*
55+
* Skip this for scorpio.
56+
*/
57+
#endif
4958
}
5059

5160
void test_util_path_init_overrun(void)

0 commit comments

Comments
 (0)