Skip to content

Commit 138d2c0

Browse files
committed
Cleanup sftp test artifacts at start of test
1 parent d854f03 commit 138d2c0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/sftp.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,20 @@ static int checkLsSize(void)
137137
}
138138

139139
static const SftpTestCmd cmds[] = {
140+
/* If a prior run was interrupted, files and directories
141+
* created during the test may still exist in the working
142+
* directory, causing mkdir to fail and ls checks to see
143+
* unexpected entries. Remove them here before starting.
144+
* These run as SFTP commands rather than local syscalls
145+
* so they are portable across all platforms (Windows,
146+
* Zephyr, POSIX). Failures are silently ignored since
147+
* the files may not exist. */
148+
{ "rm a/configure.ac", NULL },
149+
{ "rmdir a", NULL },
150+
{ "rm test-get", NULL },
151+
{ "rm test-get-2", NULL },
152+
153+
/* --- test sequence starts here --- */
140154
{ "mkdir a", NULL },
141155
{ "cd a", NULL },
142156
{ "pwd", checkPwdInA },

0 commit comments

Comments
 (0)