tstShflCase.cpp revision 839420a60937c4af15f3356336b808fc46affdb7
/** @file
*
* Testcase for shared folder case conversion
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <stdio.h>
#define RTPathQueryInfo rtPathQueryInfo
static int iDirList = 0;
static int iDirFile = 0;
static char *pszDirList[] =
{
"c:",
"c:\\test dir",
"c:\\test dir\\SUBDIR",
};
static char *pszDirListC[] =
{
".",
"..",
"test dir"
};
static char *pszDirListTestdir[] =
{
".",
"..",
"SUBDIR",
"a.bat",
"aTestJe.bat",
"aTestje.bat",
"b.bat",
"c.bat",
"d.bat",
"e.bat",
"f.bat",
"g.bat",
"h.bat",
"x.bat",
"z.bat",
};
static char *pszDirListSUBDIR[] =
{
".",
"..",
"a.bat",
"aTestJe.bat",
"aTestje.bat",
"b.bat",
"c.bat",
"d.bat",
"e.bat",
"f.bat",
"g.bat",
"h.bat",
"x.bat",
"z.bat",
};
{
iDirList = 1;
else
iDirList = 2;
else
iDirList = 3;
else
AssertFailed();
return VINF_SUCCESS;
}
{
iDirFile = 0;
return VINF_SUCCESS;
}
int rtDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry, unsigned *pcbDirEntry, RTFSOBJATTRADD enmAdditionalAttribs)
{
switch(iDirList)
{
case 1:
return VERR_NO_MORE_FILES;
break;
case 2:
return VERR_NO_MORE_FILES;
break;
case 3:
return VERR_NO_MORE_FILES;
break;
}
return VINF_SUCCESS;
}
int rtPathQueryInfo(const char *pszPath, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
{
int cMax;
char **ppszDirList;
/* first try pszDirList */
for (int i=0;i<RT_ELEMENTS(pszDirList);i++)
{
return VINF_SUCCESS;
}
switch(iDirList)
{
case 1:
break;
case 2:
break;
case 3:
break;
default:
return VERR_FILE_NOT_FOUND;
}
for (int i=0;i<cMax;i++)
{
return VINF_SUCCESS;
}
return VERR_FILE_NOT_FOUND;
}
{
int rc = VERR_FILE_NOT_FOUND;
cbDirEntry = 4096;
if (pDirEntry == 0)
{
AssertFailed();
return VERR_NO_MEMORY;
}
/** @todo this is quite inefficient, especially for directories with many files */
*(pszStartComponent-1) = 0;
if (VBOX_FAILURE(rc))
goto end;
for(;;)
{
if (rc == VERR_NO_MORE_FILES)
break;
{
AssertFailed();
if (rc != VERR_NO_TRANSLATION)
break;
else
continue;
}
{
rc = VINF_SUCCESS;
break;
}
}
end:
if (pDirEntry)
return rc;
}
int testCase(char *pszFullPath)
{
int rc;
{
/* Find partial path that's valid */
while(src > pszFullPath)
{
if (*src == RTPATH_DELIMITER)
{
*src = 0;
*src = RTPATH_DELIMITER;
if (rc == VINF_SUCCESS)
{
#ifdef DEBUG
*src = 0;
*src = RTPATH_DELIMITER;
#endif
break;
}
}
src--;
}
if ( *src == RTPATH_DELIMITER
&& VBOX_SUCCESS(rc))
{
src++;
for(;;)
{
bool fEndOfString = true;
while(*end)
{
if (*end == RTPATH_DELIMITER)
break;
end++;
}
if (*end == RTPATH_DELIMITER)
{
fEndOfString = false;
*end = 0;
}
else
{
/* path component is invalid; try to correct the casing */
if (VBOX_FAILURE(rc))
break;
}
if (fEndOfString)
break;
*end = RTPATH_DELIMITER;
}
}
else
}
if (VBOX_SUCCESS(rc))
return rc;
}
{
char szTest[128];
return 0;
}