-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduce LFS_NAME_MAX to 1022, the maximum valid value LittleFS support…
…s. (#62)
- Loading branch information
Showing
3 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import pytest | ||
from littlefs import lfs, LittleFS | ||
|
||
|
||
def test_name_max_gt_1022(): | ||
"""Don't allow a `name_max > 1022`. | ||
From the LittleFS documentation: | ||
// Maximum name size in bytes, may be redefined to reduce the size of the | ||
// info struct. Limited to <= 1022. Stored in superblock and must be | ||
// respected by other littlefs drivers. | ||
Originally reported: | ||
https://github.com/jrast/littlefs-python/issues/61 | ||
""" | ||
|
||
with pytest.raises(ValueError): | ||
LittleFS(name_max=1023) | ||
|
||
|
||
def test_name_max_0(): | ||
"""Ensures that defaulting to ``LFS_NAME_MAX`` is valid. | ||
Originally reported: | ||
https://github.com/jrast/littlefs-python/issues/61 | ||
""" | ||
fs = LittleFS(name_max=0) | ||
stat = fs.fs_stat() | ||
assert stat.name_max == 1022 |