Changeset 77660 in vbox for trunk/src/VBox
- Timestamp:
- Mar 11, 2019 9:09:43 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/fs/FsPerf.cpp
r77634 r77660 29 29 * Header Files * 30 30 *********************************************************************************************************************************/ 31 #ifdef RT_OS_OS2 32 # define INCL_BASE 33 # include <os2.h> 34 # undef RT_MAX 35 #endif 31 36 #include <iprt/alloca.h> 32 37 #include <iprt/asm.h> … … 1209 1214 1210 1215 /* Remove directory with subdirectories: */ 1211 #if defined(RT_OS_WINDOWS) 1216 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 1212 1217 RTTESTI_CHECK_RC(RTDirRemove(InDir(RT_STR_TUPLE("."))), VERR_DIR_NOT_EMPTY); 1213 1218 #else 1214 1219 RTTESTI_CHECK_RC(RTDirRemove(InDir(RT_STR_TUPLE("."))), VERR_INVALID_PARAMETER); /* EINVAL for '.' */ 1215 1220 #endif 1216 #if defined(RT_OS_WINDOWS) 1221 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 1217 1222 int rc = RTDirRemove(InDir(RT_STR_TUPLE(".."))); 1223 # ifdef RT_OS_WINDOWS 1218 1224 if (rc != VERR_DIR_NOT_EMPTY /*ntfs root*/ && rc != VERR_SHARING_VIOLATION /*ntfs weird*/) 1219 1225 RTTestIFailed("RTDirRemove(%s) -> %Rrc, expected VERR_DIR_NOT_EMPTY or VERR_SHARING_VIOLATION", g_szDir, rc); 1226 # else 1227 if (rc != VERR_DIR_NOT_EMPTY && rc != VERR_RESOURCE_BUSY /*IPRT/kLIBC fun*/) 1228 RTTestIFailed("RTDirRemove(%s) -> %Rrc, expected VERR_DIR_NOT_EMPTY or VERR_RESOURCE_BUSY", g_szDir, rc); 1229 1230 APIRET orc; 1231 RTTESTI_CHECK_MSG((orc = DosDelete((PCSZ)InEmptyDir(RT_STR_TUPLE(".")))) == ERROR_ACCESS_DENIED, 1232 ("DosDelete(%s) -> %u, expected %u\n", g_szEmptyDir, orc, ERROR_ACCESS_DENIED)); 1233 RTTESTI_CHECK_MSG((orc = DosDelete((PCSZ)InEmptyDir(RT_STR_TUPLE("..")))) == ERROR_ACCESS_DENIED, 1234 ("DosDelete(%s) -> %u, expected %u\n", g_szEmptyDir, orc, ERROR_ACCESS_DENIED)); 1235 RTTESTI_CHECK_MSG((orc = DosDelete((PCSZ)InEmptyDir(RT_STR_TUPLE("")))) == ERROR_PATH_NOT_FOUND, /* a little weird (fsrouter) */ 1236 ("DosDelete(%s) -> %u, expected %u\n", g_szEmptyDir, orc, ERROR_PATH_NOT_FOUND)); 1237 1238 # endif 1220 1239 #else 1221 1240 RTTESTI_CHECK_RC(RTDirRemove(InDir(RT_STR_TUPLE(".."))), VERR_DIR_NOT_EMPTY); … … 1323 1342 RTTESTI_CHECK_RC(RTFileDelete(InEmptyDir(RT_STR_TUPLE(".."))), VINF_SUCCESS /*WTF?!?*/); 1324 1343 RTTESTI_CHECK_RC(RTFileDelete(InEmptyDir(RT_STR_TUPLE(""))), VERR_ACCESS_DENIED); 1344 #elif defined(RT_OS_OS2) /* OS/2 has a busted unlink, it think it should remove directories too. */ 1345 RTTESTI_CHECK_RC(RTFileDelete(InDir(RT_STR_TUPLE("."))), VERR_DIR_NOT_EMPTY); 1346 int rc = RTFileDelete(InDir(RT_STR_TUPLE(".."))); 1347 if (rc != VERR_DIR_NOT_EMPTY && rc != VERR_FILE_NOT_FOUND && rc != VERR_RESOURCE_BUSY) 1348 RTTestIFailed("RTFileDelete(%s) -> %Rrc, expected VERR_DIR_NOT_EMPTY or VERR_FILE_NOT_FOUND or VERR_RESOURCE_BUSY", g_szDir, rc); 1349 RTTESTI_CHECK_RC(RTFileDelete(InDir(RT_STR_TUPLE(""))), VERR_DIR_NOT_EMPTY); 1350 APIRET orc; 1351 RTTESTI_CHECK_MSG((orc = DosDelete((PCSZ)InEmptyDir(RT_STR_TUPLE(".")))) == ERROR_ACCESS_DENIED, 1352 ("DosDelete(%s) -> %u, expected %u\n", g_szEmptyDir, orc, ERROR_ACCESS_DENIED)); 1353 RTTESTI_CHECK_MSG((orc = DosDelete((PCSZ)InEmptyDir(RT_STR_TUPLE("..")))) == ERROR_ACCESS_DENIED, 1354 ("DosDelete(%s) -> %u, expected %u\n", g_szEmptyDir, orc, ERROR_ACCESS_DENIED)); 1355 RTTESTI_CHECK_MSG((orc = DosDelete((PCSZ)InEmptyDir(RT_STR_TUPLE("")))) == ERROR_PATH_NOT_FOUND, 1356 ("DosDelete(%s) -> %u, expected %u\n", g_szEmptyDir, orc, ERROR_PATH_NOT_FOUND)); /* hpfs+jfs; weird. */ 1357 1325 1358 #else 1326 1359 RTTESTI_CHECK_RC(RTFileDelete(InEmptyDir(RT_STR_TUPLE("."))), VERR_IS_A_DIRECTORY); … … 1923 1956 cbActual = ~(size_t)0; 1924 1957 RTTESTI_CHECK_RC(RTFileRead(hFile1, pbBuf, off, &cbActual), VINF_SUCCESS); 1925 RTTESTI_CHECK_MSG(cbActual == off, ("%#zx vs %#zx ", cbActual, off));1958 RTTESTI_CHECK_MSG(cbActual == off, ("%#zx vs %#zx\n", cbActual, off)); 1926 1959 1927 1960 cbActual = ~(size_t)0; … … 1930 1963 1931 1964 RTTESTI_CHECK_RC(RTFileRead(hFile1, pbBuf, cbMaxRead, NULL), VERR_EOF); 1965 1966 /* Repeat using native APIs in case IPRT or other layers hid status codes: */ 1967 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 1968 RTTESTI_CHECK_RC(RTFileSeek(hFile1, cbFile - off, RTFILE_SEEK_BEGIN, NULL), VINF_SUCCESS); 1969 # ifdef RT_OS_OS2 1970 ULONG cbActual2 = ~(ULONG)0; 1971 APIRET orc = DosRead((HFILE)RTFileToNative(hFile1), pbBuf, cbMaxRead, &cbActual2); 1972 RTTESTI_CHECK_MSG(orc == NO_ERROR, ("orc=%u, expected 0\n", orc)); 1973 RTTESTI_CHECK_MSG(cbActual2 == off, ("%#x vs %#x\n", cbActual2, off)); 1974 # else 1975 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 1976 NTSTATUS rcNt = NtReadFile((HANDLE)RTFileToNative(hFile1), NULL /*hEvent*/, NULL /*ApcRoutine*/, NULL /*ApcContext*/, 1977 &Ios, pbBuf, (ULONG)cbMaxRead, NULL /*poffFile*/, NULL /*Key*/); 1978 if (off == 0) 1979 RTTESTI_CHECK_MSG(rcNt == STATUS_END_OF_FILE, ("rcNt=%#x, expected %#x\n", rcNt, STATUS_END_OF_FILE)); 1980 else 1981 RTTESTI_CHECK_MSG(rcNt == STATUS_SUCCESS, ("rcNt=%#x, expected 0 (off=%#x cbMaxRead=%#zx)\n", rcNt, off, cbMaxRead)); 1982 RTTESTI_CHECK_MSG(Ios.Information == off, ("%#zx vs %#x\n", Ios.Information, off)); 1983 # endif 1984 1985 # ifdef RT_OS_OS2 1986 cbActual2 = ~(ULONG)0; 1987 orc = DosRead((HFILE)RTFileToNative(hFile1), pbBuf, 1, &cbActual2); 1988 RTTESTI_CHECK_MSG(orc == NO_ERROR, ("orc=%u, expected 0\n", orc)); 1989 RTTESTI_CHECK_MSG(cbActual2 == 0, ("cbActual2=%u\n", cbActual2)); 1990 # else 1991 RTNT_IO_STATUS_BLOCK_REINIT(&Ios); 1992 rcNt = NtReadFile((HANDLE)RTFileToNative(hFile1), NULL /*hEvent*/, NULL /*ApcRoutine*/, NULL /*ApcContext*/, 1993 &Ios, pbBuf, 1, NULL /*poffFile*/, NULL /*Key*/); 1994 RTTESTI_CHECK_MSG(rcNt == STATUS_END_OF_FILE, ("rcNt=%#x, expected %#x\n", rcNt, STATUS_END_OF_FILE)); 1995 # endif 1996 1997 #endif 1932 1998 } 1933 1999 } … … 1947 2013 1948 2014 RTTESTI_CHECK_RC(RTFileRead(hFile1, pbBuf, cbMaxRead, NULL), VERR_EOF); 2015 2016 /* Repeat using native APIs in case IPRT or other layers hid status codes: */ 2017 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 2018 RTTESTI_CHECK_RC(RTFileSeek(hFile1, cbFile + off, RTFILE_SEEK_BEGIN, NULL), VINF_SUCCESS); 2019 # ifdef RT_OS_OS2 2020 ULONG cbActual2 = ~(ULONG)0; 2021 APIRET orc = DosRead((HFILE)RTFileToNative(hFile1), pbBuf, cbMaxRead, &cbActual2); 2022 RTTESTI_CHECK_MSG(orc == NO_ERROR, ("orc=%u, expected 0\n", orc)); 2023 RTTESTI_CHECK_MSG(cbActual2 == 0, ("%#x vs %#x\n", cbActual2, off)); 2024 # else 2025 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 2026 NTSTATUS rcNt = NtReadFile((HANDLE)RTFileToNative(hFile1), NULL /*hEvent*/, NULL /*ApcRoutine*/, NULL /*ApcContext*/, 2027 &Ios, pbBuf, (ULONG)cbMaxRead, NULL /*poffFile*/, NULL /*Key*/); 2028 RTTESTI_CHECK_MSG(rcNt == STATUS_END_OF_FILE, ("rcNt=%#x, expected %#x\n", rcNt, STATUS_END_OF_FILE)); 2029 # endif 2030 #endif 1949 2031 } 1950 2032 } … … 3326 3408 return RTTestSummaryAndDestroy(g_hTest); 3327 3409 } 3410
Note:
See TracChangeset
for help on using the changeset viewer.