Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: create file then append data #173

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

zpg6
Copy link
Contributor

@zpg6 zpg6 commented Jan 17, 2025

Initiated from #172 - it was recommended to add a test case to further investigate my issue.

The added test confirms that opening a file as ReadWriteCreateOrAppend and then writing to it several times works properly.

@zpg6
Copy link
Contributor Author

zpg6 commented Jan 17, 2025

@thejpster - it seems to work fine. But how to better test that the underlying files have changed? Because when I run the same on a SPI device the file sizes increase but there's only an empty 0KB file on the SD card when I plug into Windows.

UPDATE: solution was to make sure you file.flush(). For a device like mine where power could turn off at any time, I just flush after each write and its fine.

@thejpster
Copy link
Member

Yes, to avoid excessive wear on solid-state drives, we don't update the directory entry until you close the file or you flush the file.

@zpg6
Copy link
Contributor Author

zpg6 commented Jan 18, 2025

@thejpster anything you'd like to see changed or added to make this a useful test? Otherwise can close.

@thejpster
Copy link
Member

I think flushing is already covered by

fn flush_file() {
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants