From 94b82715a4c4887ffc73f9789e90bcd7fad22eb6 Mon Sep 17 00:00:00 2001 From: Paul Adelsbach Date: Thu, 9 Apr 2026 14:41:19 -0700 Subject: [PATCH] Cleanup sftp test artifacts at start of test --- tests/sftp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/sftp.c b/tests/sftp.c index 559a58be..0066c177 100644 --- a/tests/sftp.c +++ b/tests/sftp.c @@ -137,6 +137,20 @@ static int checkLsSize(void) } static const SftpTestCmd cmds[] = { + /* If a prior run was interrupted, files and directories + * created during the test may still exist in the working + * directory, causing mkdir to fail and ls checks to see + * unexpected entries. Remove them here before starting. + * These run as SFTP commands rather than local syscalls + * so they are portable across all platforms (Windows, + * Zephyr, POSIX). Failures are silently ignored since + * the files may not exist. */ + { "rm a/configure.ac", NULL }, + { "rmdir a", NULL }, + { "rm test-get", NULL }, + { "rm test-get-2", NULL }, + + /* --- test sequence starts here --- */ { "mkdir a", NULL }, { "cd a", NULL }, { "pwd", checkPwdInA },