fusion/tests: Skip tests when file creation fails
André Hentschel
nerv at dawncrow.de
Wed Aug 3 13:35:22 CDT 2011
---
dlls/fusion/tests/asmenum.c | 33 ++++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/dlls/fusion/tests/asmenum.c b/dlls/fusion/tests/asmenum.c
index cb6ea3d..2fef73f 100644
--- a/dlls/fusion/tests/asmenum.c
+++ b/dlls/fusion/tests/asmenum.c
@@ -147,13 +147,15 @@ static BOOL create_full_path(LPCSTR path)
return ret;
}
-static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
+static BOOL create_file_data(LPCSTR name, LPCSTR data, DWORD size)
{
HANDLE file;
DWORD written;
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
- ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
+ if (file == INVALID_HANDLE_VALUE)
+ return FALSE;
+
WriteFile(file, data, strlen(data), &written, NULL);
if (size)
@@ -163,10 +165,9 @@ static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
}
CloseHandle(file);
+ return TRUE;
}
-#define create_file(name, size) create_file_data(name, name, size)
-
static void test_CreateAssemblyEnum(void)
{
HRESULT hr;
@@ -409,19 +410,37 @@ static void test_enumerate_name(void)
CreateDirectoryA(path, NULL);
lstrcatA(path, "\\Wine.dll");
- create_file(path, 100);
+ if (!create_file_data(path, path, 100))
+ {
+ win_skip("Failed to open file %s, skipping name enumeration tests\n", path);
+ sprintf(path, "%s\\Wine\\1.0.0.0__16a3fcd171e93a8d", gac);
+ RemoveDirectoryA(path);
+ return;
+ }
sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d", gac);
CreateDirectoryA(path, NULL);
lstrcatA(path, "\\Wine.dll");
- create_file(path, 100);
+ if (!create_file_data(path, path, 100))
+ {
+ win_skip("Failed to open file %s, skipping name enumeration tests\n", path);
+ sprintf(path, "%s\\Wine\\1.0.1.2__16a3fcd171e93a8d", gac);
+ RemoveDirectoryA(path);
+ return;
+ }
sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0", gac);
CreateDirectoryA(path, NULL);
lstrcatA(path, "\\Wine.dll");
- create_file(path, 100);
+ if (!create_file_data(path, path, 100))
+ {
+ win_skip("Failed to open file %s, skipping name enumeration tests\n", path);
+ sprintf(path, "%s\\Wine\\1.0.1.2__123456789abcdef0", gac);
+ RemoveDirectoryA(path);
+ return;
+ }
/* test case sensitivity */
to_widechar(namestr, "wine");
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list