MakeSureDirectoryPathExists conformance test
Wolfgang Schwotzer
wolfgang.schwotzer at gmx.net
Sun Sep 26 04:38:32 CDT 2004
Conformance test for dbghelp.dll:
The new directory dlls/dbghelp/tests has to be
created and the files
dlls/dbghelp/tests/Makefile.in
dlls/dbghelp/tests/path.c
have to be added before installing the patch.
It currently contains only tests for MakeSureDirectoryPathExists.
The tests are marked with todo_wine { } because currently they will fail
on wine.
-------------- next part --------------
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = dbghelp.dll
IMPORTS = dbghelp
CTESTS = \
path.c
@MAKE_TEST_RULES@
### Dependencies:
-------------- next part --------------
/*
* Unit test suite for dbghelp/path.c
*
* Copyright 2004 Wolfgang Schwotzer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/test.h"
#include <windows.h>
#include <dbghelp.h>
#include <stdio.h>
#define DIR1 "Directory1"
#define DIR2 "Directory2"
#define DIR3 "Directory3"
#define DIR4 "Directory4"
#define FILE1 "File.ext"
void test_MakeSureDirectoryPathExists(LPCSTR curdir)
{
CHAR path[MAX_PATH];
DWORD error = 0;
DWORD attr;
todo_wine {
strcpy(path, curdir);
strcat(path, "\\" DIR1);
SetLastError(0);
ok(MakeSureDirectoryPathExists(path),
"MakeSureDirectoryPathExists error=%ld\n", GetLastError());
attr = GetFileAttributes(path);
error = GetLastError();
ok(attr == INVALID_FILE_ATTRIBUTES && (error == ERROR_FILE_NOT_FOUND),
"MakeSureDirectoryPathExists should not create path=%s attr=%ld error=%ld\n", path, attr, error);
strcpy(path, curdir);
strcat(path, "\\" DIR1 "\\" DIR2 "\\" DIR3 "\\");
SetLastError(0);
ok(MakeSureDirectoryPathExists(path),
"MakeSureDirectoryPathExists error=%ld\n", GetLastError());
strcat(path, DIR4 "\\" FILE1);
SetLastError(0);
ok(MakeSureDirectoryPathExists(path),
"MakeSureDirectoryPathExists error=%ld\n", GetLastError());
attr = GetFileAttributes(path);
error = GetLastError();
ok(attr == INVALID_FILE_ATTRIBUTES && (error == ERROR_FILE_NOT_FOUND),
"MakeSureDirectoryPathExists should not create path=%s attr=%ld error=%ld\n", path, attr, error);
sprintf(path, "\\\\.\\%c:", curdir[0]);
strcat(path, curdir + 2);
strcat(path, "\\" DIR2 "\\" DIR3 "\\");
printf("%s\n", path);
SetLastError(0);
ok(MakeSureDirectoryPathExists(path),
"MakeSureDirectoryPathExists error=%ld\n", GetLastError());
/* do cleanup */
RemoveDirectoryA(path);
sprintf(path, "\\\\.\\%c:", curdir[0]);
strcat(path, curdir + 2);
strcat(path, "\\" DIR2);
RemoveDirectoryA(path);
strcpy(path, curdir);
strcat(path, "\\" DIR1 "\\" DIR2 "\\" DIR3 "\\" DIR4 "\\" FILE1);
RemoveDirectoryA(path);
strcpy(path, curdir);
strcat(path, "\\" DIR1 "\\" DIR2 "\\" DIR3 "\\" DIR4);
RemoveDirectoryA(path);
strcpy(path, curdir);
strcat(path, "\\" DIR1 "\\" DIR2 "\\" DIR3);
RemoveDirectoryA(path);
strcpy(path, curdir);
strcat(path, "\\" DIR1 "\\" DIR2);
RemoveDirectoryA(path);
strcpy(path, curdir);
strcat(path, "\\" DIR1);
RemoveDirectoryA(path);
} /* todo_wine */
}
START_TEST(path)
{
CHAR curdir[MAX_PATH];
ok(GetCurrentDirectoryA(MAX_PATH, curdir) > 0,
"Unable to get current directory, some tests will not be conducted");
test_MakeSureDirectoryPathExists(curdir);
}
-------------- next part --------------
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.312
diff -u -r1.312 configure.ac
--- configure.ac 23 Sep 2004 04:48:24 -0000 1.312
+++ configure.ac 26 Sep 2004 13:02:16 -0000
@@ -1561,6 +1561,7 @@
dlls/d3dx8/Makefile
dlls/d3dxof/Makefile
dlls/dbghelp/Makefile
+dlls/dbghelp/tests/Makefile
dlls/dciman32/Makefile
dlls/ddraw/Makefile
dlls/ddraw/tests/Makefile
Index: dlls/dbghelp/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in
--- dlls/dbghelp/Makefile.in 5 Apr 2004 22:21:27 -0000 1.1
+++ dlls/dbghelp/Makefile.in 26 Sep 2004 13:02:17 -0000
@@ -22,6 +22,8 @@
symbol.c \
type.c
+SUBDIRS = tests
+
@MAKE_DLL_RULES@
### Dependencies:
More information about the wine-patches
mailing list