testing/sd_stress: Handle stale temporary directories#3499
Open
nightt5879 wants to merge 2 commits into
Open
Conversation
Fix apache#3205 by removing stale sdstress work directories left by previous interrupted or failed runs before starting a new test. The cleanup only removes entries matching the generated tmpNNN file pattern. If the directory contains any unexpected entry, the test fails instead of deleting user data. Also make create_dir() and remove_dir() use their path argument instead of the fixed temporary directory names. Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
Close the temporary file descriptor when create_files() fails after open(), and release the read buffer before returning from the path-length failure branch. This is logically separable from the apache#3205 stale-directory fix: it does not change how existing /sd/stress is handled, but keeps the same failure paths from leaking resources while the stress test exits after an error. The scope intentionally stays within sd_stress failure cleanup and does not touch SD/MMC transfer behavior or other testing drivers. Signed-off-by: Nightt <87569709+nightt5879@users.noreply.github.com>
xiaoxiang781216
approved these changes
May 24, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3205.
This PR makes
sdstressrecover from temporary directories left behind by an interrupted or failed previous run.Commit structure:
testing/sd_stress: Handle stale temporary directories) is the strict [BUG] testing/drivers/sd_stress: does not run properly when /sd/stress location exists. #3205 fix. It cleans stale/sd/stressand/sd/movedwork directories before starting a new test, but only removes files matching the app-generatedtmpNNNpattern. Unexpected entries make the cleanup fail instead of deleting user data. It also fixescreate_dir()/remove_dir()to use theirpathargument.testing/sd_stress: Harden file creation cleanup) is a logically separable extension. It closes the temp file descriptor oncreate_files()failures afteropen(), and releases the read buffer on the path-length failure branch.The second commit is logically separable and I am happy to drop it if maintainers consider it out of scope for #3205.
Out of scope:
-b 1024/ SD/MMC timeout behavior discussed in bcm2711/sdio: Support for EMMC interfaces on the BCM2711 nuttx#17245.sdstress-generatedtmpNNNfiles.Impact
Users no longer need to manually remove stale
sdstresstemporary directories before running the test again after an interrupted or failed run.Testing
Host:
Checks:
git diff --check upstream/master..HEAD: passcheckpatch.sh -c -u -m -g HEAD~2..HEAD: passsim:nshbuild withCONFIG_ALLOW_BSD_COMPONENTS=yandCONFIG_TESTING_SD_STRESS=y: passRegister: sdstressCC: sd_stress_main.cSIM elf with dynamic libs archive in nuttx.tgzNote:
.configprinted an expected override warning because the temporary test build appendedCONFIG_ALLOW_BSD_COMPONENTS=y/CONFIG_TESTING_SD_STRESS=yafter configuringsim:nsh.