[wininet/tests] Expose a problem with FtpGetFile

Paul Vriens paul.vriens.wine at gmail.com
Tue Mar 20 14:54:58 CDT 2007


Hi,

I was trying to change the ftp tests to only do the connections (and closing)
once. Unfortunately it had 2 new failures on Wine. Some digging revealed that
when we do an FtpOpenFile (maybe any other) after a FtpGetFile, in the same
session, there's a failure for FtpOpenFile.

Does anybody have an idea why the tests are so incredibly slow on Wine compared 
to any Windows version (minutes compared to seconds)?

Once this is fixed I can 'implement' the stuff I just mentioned.

Changelog
    Expose a problem with FtpGetFile

Cheers,

Paul.

-------------- next part --------------
>From 6389bf06849b80993b9771e31f5157ab2ebd52a2 Mon Sep 17 00:00:00 2001
From: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date: Tue, 20 Mar 2007 20:49:33 +0100
Subject: [PATCH] Expose a problem with FtpGetFile

---
 dlls/wininet/tests/ftp.c |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index 2eca664..be1f7a3 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -831,6 +831,39 @@ static void test_renamefile(void)
     InternetCloseHandle(hInternet);
 }
 
+static void test_multiple(void)
+{
+    BOOL      bRet;
+    HINTERNET hInternet, hFtp, hOpenFile;
+
+    hInternet = InternetOpen(NULL, 0, NULL, NULL, 0);
+    hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", "IEUser@", INTERNET_SERVICE_FTP, 0, 0);
+    if(!hFtp)
+    {
+        skip("No ftp connection could be made to ftp.winehq.org\n");
+        InternetCloseHandle(hInternet);
+        return;
+    }
+
+    /* A correct call */
+    bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
+    DeleteFileA("should_be_non_existing_deadbeef");
+
+    /* This call by itself succeeds in Wine for the test_openfile test */
+    SetLastError(0xdeadbeef);
+    hOpenFile = FtpOpenFileA(hFtp, "welcome.msg", GENERIC_READ, FTP_TRANSFER_TYPE_ASCII, 0);
+    todo_wine 
+    {
+    ok ( hOpenFile != NULL, "Expected FtpOpenFileA to succeed\n");
+    ok ( GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_FILE_NOT_FOUND,
+        "Expected ERROR_SUCCESS or ERROR_FILE_NOT_FOUND (win98), got %d\n", GetLastError());
+    }
+
+    InternetCloseHandle(hOpenFile);
+    InternetCloseHandle(hFtp);
+    InternetCloseHandle(hInternet);
+}
+
 START_TEST(ftp)
 {
     /* The first call should always be a proper InternetOpen, if not
@@ -850,4 +883,11 @@ START_TEST(ftp)
     test_putfile();
     test_removedir();
     test_renamefile();
+
+    /* A test that does two particular calls in one connection, this currently fails on Wine.
+     * The problem lies in FtpGetFile but is exposed in FtpOpenFile.
+     * Once this is fixed we should change the total test to setup and clear the connections
+     * only once. (and get rid of test_multiple).
+     */
+    test_multiple();
 }
-- 
1.4.4.2




More information about the wine-patches mailing list