Author: fireball
Date: Mon Apr 18 21:56:44 2011
New Revision: 51394
URL:
http://svn.reactos.org/svn/reactos?rev=51394&view=rev
Log:
[KERNEL32_WINETEST]
- Sam Arun Raj Seeniraj: Added new test cases to QueryDosDevice(). Should be sent to Wine
(tm).
See issue #993 for more details.
Added:
trunk/rostests/winetests/kernel32/dosdev.c (with props)
Modified:
trunk/rostests/winetests/kernel32/CMakeLists.txt
trunk/rostests/winetests/kernel32/kernel32.rbuild
trunk/rostests/winetests/kernel32/testlist.c
Modified: trunk/rostests/winetests/kernel32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/CMakeL…
==============================================================================
--- trunk/rostests/winetests/kernel32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/kernel32/CMakeLists.txt [iso-8859-1] Mon Apr 18 21:56:44
2011
@@ -40,6 +40,7 @@
version.c
virtual.c
volume.c
+ dosdev.c
testlist.c
resource.rc)
Added: trunk/rostests/winetests/kernel32/dosdev.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/dosdev…
==============================================================================
--- trunk/rostests/winetests/kernel32/dosdev.c (added)
+++ trunk/rostests/winetests/kernel32/dosdev.c [iso-8859-1] Mon Apr 18 21:56:44 2011
@@ -1,0 +1,228 @@
+/*
+ * Unit test suite for virtual substituted drive functions.
+ *
+ * Copyright 2011 Sam Arun Raj
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#include "wine/test.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+
+static void test_DefineDosDeviceA1(void)
+{
+ /* Test using lowercase drive letters */
+ CHAR Target[MAX_PATH];
+ CHAR Drive[] = "m:";
+ BOOL Result;
+
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp");
+ ok(Result, "Failed to subst drive using lowercase drive letter");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp");
+ ok(Result, "Failed to remove subst drive using lowercase drive letter");
+
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(!Result, "Subst drive is present even after remove attempt");
+}
+
+static void test_DefineDosDeviceA2(void)
+{
+ /* Test using trailing \ against drive letter */
+ CHAR Target[MAX_PATH];
+ CHAR Drive[] = "Q:\\";
+ BOOL Result;
+
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp");
+ ok(!Result, "Subst drive using trailing path seperator");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp");
+ ok(!Result, "Subst drive using trailing path seperator");
+
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(!Result, "Subst drive is present when it should not be created in the first
place");
+}
+
+static void test_DefineDosDeviceA3(void)
+{
+ /* Test using arbitary string, not necessarily a DOS drive letter */
+ CHAR Target[MAX_PATH];
+ CHAR Drive[] = "!QHello:";
+ BOOL Result;
+
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp");
+ ok(Result, "Failed to subst drive using non-DOS drive name");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp");
+ ok(Result, "Failed to subst drive using non-DOS drive name");
+
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(!Result, "Subst drive is present even after remove attempt");
+}
+
+static void test_DefineDosDeviceA4(void)
+{
+ /* Test remove without using DDD_EXACT_MATCH_ON_REMOVE */
+ CHAR Target[MAX_PATH];
+ CHAR Drive[] = "M:";
+ BOOL Result;
+
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp");
+ ok(Result, "Failed to subst drive");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION, Drive, NULL);
+ ok(Result, "Failed to remove subst drive using NULL Target name");
+
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(!Result, "Subst drive is present even after remove attempt");
+}
+
+static void test_DefineDosDeviceA5(void)
+{
+ /* Test multiple adds and multiple removes in add order */
+ CHAR Target[MAX_PATH];
+ CHAR Drive[] = "M:";
+ BOOL Result;
+
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp1");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp2");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp3");
+ ok(Result, "Failed to subst drive");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp1");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp3") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp2");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp3") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp3");
+ ok(Result, "Failed to remove subst drive");
+
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(!Result, "Subst drive is present even after remove attempt");
+}
+
+static void test_DefineDosDeviceA6(void)
+{
+ /* Test multiple adds and multiple removes in reverse order */
+ CHAR Target[MAX_PATH];
+ CHAR Drive[] = "M:";
+ BOOL Result;
+
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp1");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp2");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp3");
+ ok(Result, "Failed to subst drive");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp3");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp2") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp2");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp1") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp1");
+ ok(Result, "Failed to remove subst drive");
+
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(!Result, "Subst drive is present even after remove attempt");
+}
+
+static void test_DefineDosDeviceA7(void)
+{
+ /* Test multiple adds and multiple removes out of order */
+ CHAR Target[MAX_PATH];
+ CHAR Drive[] = "M:";
+ BOOL Result;
+
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp1");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp2");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp3");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp4");
+ ok(Result, "Failed to subst drive");
+ Result = DefineDosDeviceA(0, Drive, "C:\\temp5");
+ ok(Result, "Failed to subst drive");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp2");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp5") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp5");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp4") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp1");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp4") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp3");
+ ok(Result, "Failed to remove subst drive");
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(Result, "Failed to query subst drive");
+ if (Result)
+ ok((_stricmp(Target, "\\??\\C:\\temp4") == 0), "Subst drive is not
pointing to correct target");
+
+ Result = DefineDosDeviceA(DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, Drive,
"C:\\temp4");
+ ok(Result, "Failed to remove subst drive");
+
+ Result = QueryDosDeviceA(Drive, Target, MAX_PATH);
+ ok(!Result, "Subst drive is present even after remove attempt");
+}
+
+START_TEST(dosdev)
+{
+ test_DefineDosDeviceA1();
+ test_DefineDosDeviceA2();
+ test_DefineDosDeviceA3();
+ test_DefineDosDeviceA4();
+ test_DefineDosDeviceA5();
+ test_DefineDosDeviceA6();
+ test_DefineDosDeviceA7();
+}
Propchange: trunk/rostests/winetests/kernel32/dosdev.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/winetests/kernel32/kernel32.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/kernel…
==============================================================================
--- trunk/rostests/winetests/kernel32/kernel32.rbuild [iso-8859-1] (original)
+++ trunk/rostests/winetests/kernel32/kernel32.rbuild [iso-8859-1] Mon Apr 18 21:56:44
2011
@@ -40,6 +40,7 @@
<file>version.c</file>
<file>virtual.c</file>
<file>volume.c</file>
+ <file>dosdev.c</file>
<file>testlist.c</file>
<file>resource.rc</file>
</module>
Modified: trunk/rostests/winetests/kernel32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/testli…
==============================================================================
--- trunk/rostests/winetests/kernel32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/kernel32/testlist.c [iso-8859-1] Mon Apr 18 21:56:44 2011
@@ -42,6 +42,7 @@
extern void func_virtual(void);
extern void func_version(void);
extern void func_volume(void);
+extern void func_dosdev(void);
const struct test winetest_testlist[] =
{
@@ -78,6 +79,7 @@
{ "virtual", func_virtual },
{ "version", func_version },
{ "volume", func_volume },
+ { "dosdev", func_dosdev },
{ 0, 0 }
};