From 358826b58e1863857d110b30abb32257171d1009 Mon Sep 17 00:00:00 2001 From: Mike Kaufman Date: Mon, 21 Aug 2017 16:30:34 -0700 Subject: Fixing wcsstr function to account for cases where search string is longer than remaining target string. (#13504) --- src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/pal/tests') diff --git a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp index 8296a74983..16005a9f8e 100644 --- a/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/wcsstr/test1/test1.cpp @@ -21,6 +21,7 @@ int __cdecl main(int argc, char *argv[]) WCHAR *key1; WCHAR *key2; WCHAR key3[] = { 0 }; + WCHAR *key4; WCHAR *result; if (PAL_Initialize(argc, argv)) @@ -31,6 +32,7 @@ int __cdecl main(int argc, char *argv[]) string = convert("foo bar baz bar"); key1 = convert("bar"); key2 = convert("Bar"); + key4 = convert("arggggh!"); result = wcsstr(string, key1); if (result != string + 4) @@ -57,6 +59,14 @@ int __cdecl main(int argc, char *argv[]) convertC(key3), string, result); } + result = wcsstr(string, key4); + if (result != nullptr) + { + Fail("ERROR: Got incorrect result in scanning \"%s\" for \"%s\".\n" + "Expected to get pointer to null, got %#p\n", convertC(string), + convertC(key4), result); + } + PAL_Terminate(); return PASS; } -- cgit v1.2.3 From dfd90b728c3bc26c4e038a3dbd6075ce3f257d2b Mon Sep 17 00:00:00 2001 From: Justin Van Patten Date: Tue, 22 Aug 2017 07:09:08 -0700 Subject: Delete some dead PAL code (#13469) * Delete some dead PAL code GetComputerName and GetUserName are not used. * HAVE_GETPWUID_R can now be deleted --- .../tests/palsuite/miscellaneous/CMakeLists.txt | 1 - .../miscellaneous/GetComputerNameW/CMakeLists.txt | 4 -- .../GetComputerNameW/test1/CMakeLists.txt | 17 ------- .../miscellaneous/GetComputerNameW/test1/test.cpp | 53 ---------------------- .../GetComputerNameW/test1/testinfo.dat | 13 ------ .../miscellaneous/GetUserNameW/CMakeLists.txt | 4 -- .../GetUserNameW/test1/CMakeLists.txt | 17 ------- .../miscellaneous/GetUserNameW/test1/test.cpp | 52 --------------------- .../miscellaneous/GetUserNameW/test1/testinfo.dat | 13 ------ src/pal/tests/palsuite/paltestlist.txt | 1 - .../tests/palsuite/paltestlist_to_be_reviewed.txt | 2 - 11 files changed, 177 deletions(-) delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat (limited to 'src/pal/tests') diff --git a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt index 9352edef52..d437fc9320 100644 --- a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt @@ -9,7 +9,6 @@ add_subdirectory(FlushInstructionCache) add_subdirectory(FormatMessageW) add_subdirectory(FreeEnvironmentStringsW) add_subdirectory(GetCommandLineW) -add_subdirectory(GetComputerNameW) add_subdirectory(GetEnvironmentStringsW) add_subdirectory(GetEnvironmentVariableA) add_subdirectory(GetEnvironmentVariableW) diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt deleted file mode 100644 index fe5b72071e..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test.cpp -) - -add_executable(paltest_getcomputernamew_test1 - ${SOURCES} -) - -add_dependencies(paltest_getcomputernamew_test1 coreclrpal) - -target_link_libraries(paltest_getcomputernamew_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp deleted file mode 100644 index 7a00cad598..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Source : test.c -** -** Purpose: Positive Test for GetComputerName() function -** -** -**=========================================================*/ - -#define UNICODE -#include - -int __cdecl main(int argc, char *argv[]) -{ - - int HOST_NAME_MAX = 255; - WCHAR wzComputerName[HOST_NAME_MAX+1]; - DWORD dwSize = sizeof(wzComputerName)/sizeof(wzComputerName[0]); - - // Initialize the PAL and return FAILURE if this fails - if(0 != (PAL_Initialize(argc, argv))) - { - Fail ("ERROR: PAL_Initialize() call failed!\n"); - } - - if (0 == GetComputerName(wzComputerName, &dwSize)) - { - Fail("ERROR: GetComputerName failed with %d!\n", GetLastError()); - } - - // dwSize is the length of wzComputerName without NULL - if (dwSize < 0 || dwSize > (sizeof(wzComputerName)/sizeof(wzComputerName[0]) - 1)) - { - Fail("ERROR: GetComputerName returned %S with dwSize = %u whereas the passed in buffer size is %d!\n", - wzComputerName, dwSize, sizeof(wzComputerName)/sizeof(wzComputerName[0])); - } - - // dwSize is the length of wzComputerName without NULL - if (dwSize != wcslen(wzComputerName)) - { - Fail("ERROR: GetComputerName returned %S of length %d which is not equal to dwSize = %u!\n", - wzComputerName, wcslen(wzComputerName), dwSize); - } - - printf ("GetComputerName returned %S of length %u\n", wzComputerName, dwSize); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat deleted file mode 100644 index d45bca1c25..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Miscellaneous -Function = GetComputerNameW -Name = Test for GetComputerNameW -TYPE = DEFAULT -EXE1 = test -Description -= Check to ensure that GetComputerNameW returnes a decent value. - diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt deleted file mode 100644 index 6527b83d13..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test.cpp -) - -add_executable(paltest_getusernamew_test1 - ${SOURCES} -) - -add_dependencies(paltest_getusernamew_test1 coreclrpal) - -target_link_libraries(paltest_getusernamew_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp deleted file mode 100644 index 809f14c12d..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Source : test.c -** -** Purpose: Positive Test for GetUserName() function -** -** -**=========================================================*/ - -#define UNICODE -#include - -int __cdecl main(int argc, char *argv[]) -{ - - WCHAR wzUserName[UNLEN+1]; - DWORD dwSize = sizeof(wzUserName)/sizeof(wzUserName[0]); - - // Initialize the PAL and return FAILURE if this fails - if(0 != (PAL_Initialize(argc, argv))) - { - Fail ("ERROR: PAL_Initialize() call failed!\n"); - } - - if (0 == GetUserName(wzUserName, &dwSize)) - { - Fail("ERROR: GetUserName failed with %d!\n", GetLastError()); - } - - // dwSize is the length of wzUserName with NULL - if (dwSize <= 0 || dwSize > (sizeof(wzUserName)/sizeof(wzUserName[0]))) - { - Fail("ERROR: GetUserName returned %S with dwSize = %u whereas the passed in buffer size is %d!\n", - wzUserName, dwSize, sizeof(wzUserName)/sizeof(wzUserName[0])); - } - - // dwSize is the length of wzUserName with NULL - if (dwSize != wcslen(wzUserName)+1) - { - Fail("ERROR: GetUserName returned %S of length %d which is not equal to dwSize-1 = %u!\n", - wzUserName, wcslen(wzUserName), dwSize-1); - } - - printf ("GetUserName returned %S of length %u\n", wzUserName, dwSize-1); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat deleted file mode 100644 index 3e0aa48bd0..0000000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Miscellaneous -Function = GetUserNameW -Name = Test for GetUserNameW -TYPE = DEFAULT -EXE1 = test -Description -= Check to ensure that GetUserNameW returnes a decent value. - diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt index 1e580cd596..0c8892a4a0 100644 --- a/src/pal/tests/palsuite/paltestlist.txt +++ b/src/pal/tests/palsuite/paltestlist.txt @@ -653,7 +653,6 @@ miscellaneous/FormatMessageW/test3/paltest_formatmessagew_test3 miscellaneous/FreeEnvironmentStringsW/test1/paltest_freeenvironmentstringsw_test1 miscellaneous/FreeEnvironmentStringsW/test2/paltest_freeenvironmentstringsw_test2 miscellaneous/GetCommandLineW/test1/paltest_getcommandlinew_test1 -miscellaneous/GetComputerNameW/test1/paltest_getcomputernamew_test1 miscellaneous/GetEnvironmentStringsW/test1/paltest_getenvironmentstringsw_test1 miscellaneous/GetEnvironmentVariableA/test1/paltest_getenvironmentvariablea_test1 miscellaneous/GetEnvironmentVariableA/test2/paltest_getenvironmentvariablea_test2 diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index 3f9469d254..4dac7e94c6 100644 --- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -139,11 +139,9 @@ miscellaneous/FormatMessageW/test5/paltest_formatmessagew_test5 miscellaneous/FormatMessageW/test6/paltest_formatmessagew_test6 miscellaneous/GetCalendarInfoW/test1/paltest_getcalendarinfow_test1 miscellaneous/GetCalendarInfoW/test2/paltest_getcalendarinfow_test2 -miscellaneous/GetComputerNameW/test1/paltest_getcomputernamew_test1 miscellaneous/GetDateFormatW/GetDateFormatW_neg1/paltest_getdateformatw_getdateformatw_neg1 miscellaneous/GetDateFormatW/GetDateFormatW_neg2/paltest_getdateformatw_getdateformatw_neg2 miscellaneous/GetDateFormatW/test1/paltest_getdateformatw_test1 -miscellaneous/GetUserNameW/test1/paltest_getusernamew_test1 miscellaneous/InterLockedExchangeAdd/test1/paltest_interlockedexchangeadd_test1 miscellaneous/IsBadCodePtr/test1/paltest_isbadcodeptr_test1 miscellaneous/IsBadReadPtr/test1/paltest_isbadreadptr_test1 -- cgit v1.2.3 From c440335be80ee0762856d0be6e91ec3ea2f90504 Mon Sep 17 00:00:00 2001 From: Justin Van Patten Date: Mon, 28 Aug 2017 11:01:42 -0700 Subject: Delete dead PAL functions (#13613) * Remove duplicate define * Remove unused wincon.h defines * Delete unused LockFile/UnlockFile * Remove unused WszCryptGetDefaultProvider define * Remove unused defines * Remove unused defines * Delete unused GetDiskFreeSpace * Delete unused RegisterEventSource\DeregisterEventSource\ReportEvent * Remove unused defines * Delete unused AreFileApisANSI * Delete unused MoveFileW * Delete unused SetFileTime * Delete unused GetFileTime * Delete unused FileTimeToDosDateTime * Delete unused GetFileType * Delete unused GetConsoleCP * Delete unused GetExitCodeThread * Delete unused FlushViewOfFile * Delete unused RtlZeroMemory * Delete unused MoveFileA --- src/pal/tests/palsuite/README.txt | 6 - .../file_io/AreFileApisANSI/CMakeLists.txt | 4 - .../AreFileApisANSI/test1/AreFileApisANSI.cpp | 40 -- .../file_io/AreFileApisANSI/test1/CMakeLists.txt | 17 - .../file_io/AreFileApisANSI/test1/testinfo.dat | 13 - src/pal/tests/palsuite/file_io/CMakeLists.txt | 9 - .../file_io/FileTimeToDosDateTime/CMakeLists.txt | 4 - .../FileTimeToDosDateTime/test1/CMakeLists.txt | 17 - .../file_io/FileTimeToDosDateTime/test1/test1.cpp | 116 ----- .../FileTimeToDosDateTime/test1/testinfo.dat | 15 - .../palsuite/file_io/GetConsoleCP/CMakeLists.txt | 4 - .../file_io/GetConsoleCP/test1/CMakeLists.txt | 17 - .../file_io/GetConsoleCP/test1/GetConsoleCP.cpp | 35 -- .../file_io/GetConsoleCP/test1/testinfo.dat | 13 - .../file_io/GetDiskFreeSpaceW/CMakeLists.txt | 5 - .../file_io/GetDiskFreeSpaceW/test1/CMakeLists.txt | 17 - .../GetDiskFreeSpaceW/test1/GetDiskFreeSpaceW.cpp | 94 ---- .../file_io/GetDiskFreeSpaceW/test1/testinfo.dat | 13 - .../file_io/GetDiskFreeSpaceW/test2/CMakeLists.txt | 17 - .../GetDiskFreeSpaceW/test2/getdiskfreespacew.cpp | 65 --- .../file_io/GetDiskFreeSpaceW/test2/testinfo.dat | 12 - .../file_io/GetFileAttributesExW/test1/test1.cpp | 53 +-- .../palsuite/file_io/GetFileTime/CMakeLists.txt | 10 - .../file_io/GetFileTime/test1/CMakeLists.txt | 17 - .../file_io/GetFileTime/test1/GetFileTime.cpp | 180 -------- .../file_io/GetFileTime/test1/testinfo.dat | 14 - .../file_io/GetFileTime/test2/CMakeLists.txt | 17 - .../file_io/GetFileTime/test2/GetFileTime.cpp | 195 --------- .../file_io/GetFileTime/test2/testinfo.dat | 16 - .../file_io/GetFileTime/test3/CMakeLists.txt | 17 - .../file_io/GetFileTime/test3/GetFileTime.cpp | 142 ------ .../file_io/GetFileTime/test3/testinfo.dat | 14 - .../file_io/GetFileTime/test4/CMakeLists.txt | 17 - .../file_io/GetFileTime/test4/GetFileTime.cpp | 98 ----- .../file_io/GetFileTime/test4/testinfo.dat | 14 - .../file_io/GetFileTime/test5/CMakeLists.txt | 17 - .../file_io/GetFileTime/test5/getfiletime.cpp | 224 ---------- .../file_io/GetFileTime/test5/testinfo.dat | 15 - .../file_io/GetFileTime/test6/CMakeLists.txt | 17 - .../file_io/GetFileTime/test6/getfiletime.cpp | 281 ------------ .../file_io/GetFileTime/test6/testinfo.dat | 14 - .../file_io/GetFileTime/test7/CMakeLists.txt | 17 - .../file_io/GetFileTime/test7/getfiletime.cpp | 279 ------------ .../file_io/GetFileTime/test7/testinfo.dat | 15 - .../palsuite/file_io/GetFileType/CMakeLists.txt | 6 - .../file_io/GetFileType/test1/CMakeLists.txt | 17 - .../file_io/GetFileType/test1/GetFileType.cpp | 76 ---- .../file_io/GetFileType/test1/testinfo.dat | 13 - .../file_io/GetFileType/test2/CMakeLists.txt | 17 - .../file_io/GetFileType/test2/getfiletype.cpp | 95 ---- .../file_io/GetFileType/test2/testinfo.dat | 13 - .../file_io/GetFileType/test3/CMakeLists.txt | 17 - .../file_io/GetFileType/test3/getfiletype.cpp | 72 ---- .../file_io/GetFileType/test3/testinfo.dat | 13 - .../file_io/GetStdHandle/test1/GetStdHandle.cpp | 9 - .../palsuite/file_io/MoveFileA/CMakeLists.txt | 4 - .../file_io/MoveFileA/test1/CMakeLists.txt | 17 - .../file_io/MoveFileA/test1/ExpectedResults.txt | 1 - .../palsuite/file_io/MoveFileA/test1/MoveFileA.cpp | 469 -------------------- .../palsuite/file_io/MoveFileA/test1/testinfo.dat | 13 - .../palsuite/file_io/MoveFileW/CMakeLists.txt | 4 - .../file_io/MoveFileW/test1/CMakeLists.txt | 17 - .../file_io/MoveFileW/test1/ExpectedResults.txt | 1 - .../palsuite/file_io/MoveFileW/test1/MoveFileW.cpp | 478 --------------------- .../palsuite/file_io/MoveFileW/test1/testinfo.dat | 13 - .../palsuite/file_io/SetFileTime/CMakeLists.txt | 7 - .../file_io/SetFileTime/test1/CMakeLists.txt | 17 - .../file_io/SetFileTime/test1/SetFileTime.cpp | 129 ------ .../file_io/SetFileTime/test1/testinfo.dat | 15 - .../file_io/SetFileTime/test2/CMakeLists.txt | 17 - .../file_io/SetFileTime/test2/SetFileTime.cpp | 101 ----- .../file_io/SetFileTime/test2/testinfo.dat | 15 - .../file_io/SetFileTime/test3/CMakeLists.txt | 17 - .../file_io/SetFileTime/test3/SetFileTime.cpp | 66 --- .../file_io/SetFileTime/test3/testinfo.dat | 14 - .../file_io/SetFileTime/test4/CMakeLists.txt | 17 - .../file_io/SetFileTime/test4/SetFileTime.cpp | 108 ----- .../file_io/SetFileTime/test4/testinfo.dat | 14 - .../file_io/errorpathnotfound/CMakeLists.txt | 1 - .../file_io/errorpathnotfound/test2/test2.cpp | 76 +--- .../file_io/errorpathnotfound/test2/testinfo.dat | 2 +- .../file_io/errorpathnotfound/test4/CMakeLists.txt | 17 - .../file_io/errorpathnotfound/test4/test4.cpp | 351 --------------- .../file_io/errorpathnotfound/test4/testinfo.dat | 34 -- .../palsuite/filemapping_memmgt/CMakeLists.txt | 2 - .../filemapping_memmgt/LockFile/CMakeLists.txt | 10 - .../filemapping_memmgt/LockFile/LockFile.h | 152 ------- .../LockFile/test1/CMakeLists.txt | 32 -- .../filemapping_memmgt/LockFile/test1/helper.cpp | 86 ---- .../filemapping_memmgt/LockFile/test1/test1.cpp | 140 ------ .../filemapping_memmgt/LockFile/test1/testinfo.dat | 15 - .../LockFile/test2/CMakeLists.txt | 17 - .../filemapping_memmgt/LockFile/test2/test2.cpp | 94 ---- .../filemapping_memmgt/LockFile/test2/testinfo.dat | 13 - .../LockFile/test3/CMakeLists.txt | 32 -- .../filemapping_memmgt/LockFile/test3/helper.cpp | 102 ----- .../filemapping_memmgt/LockFile/test3/test3.cpp | 71 --- .../filemapping_memmgt/LockFile/test3/testinfo.dat | 16 - .../LockFile/test4/CMakeLists.txt | 17 - .../filemapping_memmgt/LockFile/test4/test4.cpp | 231 ---------- .../filemapping_memmgt/LockFile/test4/testinfo.dat | 14 - .../LockFile/test5/CMakeLists.txt | 32 -- .../filemapping_memmgt/LockFile/test5/helper.cpp | 122 ------ .../filemapping_memmgt/LockFile/test5/test5.cpp | 161 ------- .../filemapping_memmgt/LockFile/test5/testinfo.dat | 17 - .../LockFile/test6/CMakeLists.txt | 32 -- .../filemapping_memmgt/LockFile/test6/helper.cpp | 71 --- .../filemapping_memmgt/LockFile/test6/test6.cpp | 146 ------- .../filemapping_memmgt/LockFile/test6/testinfo.dat | 15 - .../LockFile/test7/CMakeLists.txt | 17 - .../filemapping_memmgt/LockFile/test7/test7.cpp | 135 ------ .../filemapping_memmgt/LockFile/test7/testinfo.dat | 13 - .../filemapping_memmgt/UnlockFile/CMakeLists.txt | 7 - .../filemapping_memmgt/UnlockFile/UnlockFile.h | 112 ----- .../UnlockFile/test1/CMakeLists.txt | 32 -- .../filemapping_memmgt/UnlockFile/test1/helper.cpp | 92 ---- .../filemapping_memmgt/UnlockFile/test1/test1.cpp | 154 ------- .../UnlockFile/test1/testinfo.dat | 17 - .../UnlockFile/test2/CMakeLists.txt | 17 - .../filemapping_memmgt/UnlockFile/test2/test2.cpp | 154 ------- .../UnlockFile/test2/testinfo.dat | 16 - .../UnlockFile/test3/CMakeLists.txt | 32 -- .../filemapping_memmgt/UnlockFile/test3/helper.cpp | 103 ----- .../filemapping_memmgt/UnlockFile/test3/test3.cpp | 142 ------ .../UnlockFile/test3/testinfo.dat | 17 - .../UnlockFile/test4/CMakeLists.txt | 17 - .../filemapping_memmgt/UnlockFile/test4/test4.cpp | 187 -------- .../UnlockFile/test4/testinfo.dat | 16 - src/pal/tests/palsuite/paltestlist.txt | 23 - .../tests/palsuite/paltestlist_to_be_reviewed.txt | 10 - src/pal/tests/palsuite/palverify.dat | 19 - 131 files changed, 3 insertions(+), 7568 deletions(-) delete mode 100644 src/pal/tests/palsuite/file_io/AreFileApisANSI/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/AreFileApisANSI.cpp delete mode 100644 src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/test1.cpp delete mode 100644 src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetConsoleCP/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetConsoleCP/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetConsoleCP/test1/GetConsoleCP.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetConsoleCP/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/GetDiskFreeSpaceW.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/getdiskfreespacew.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test1/GetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test2/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test2/GetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test2/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test3/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test3/GetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test3/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test4/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test4/GetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test4/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test5/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test5/getfiletime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test5/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test6/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test6/getfiletime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test6/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test7/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test7/getfiletime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileTime/test7/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test1/GetFileType.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test2/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test2/getfiletype.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test2/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test3/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test3/getfiletype.cpp delete mode 100644 src/pal/tests/palsuite/file_io/GetFileType/test3/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileA/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileA/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileA/test1/ExpectedResults.txt delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileA/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileW/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileW/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileW/test1/ExpectedResults.txt delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp delete mode 100644 src/pal/tests/palsuite/file_io/MoveFileW/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test1/SetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test2/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test2/SetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test2/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test3/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test3/SetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test3/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test4/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test4/SetFileTime.cpp delete mode 100644 src/pal/tests/palsuite/file_io/SetFileTime/test4/testinfo.dat delete mode 100644 src/pal/tests/palsuite/file_io/errorpathnotfound/test4/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/file_io/errorpathnotfound/test4/test4.cpp delete mode 100644 src/pal/tests/palsuite/file_io/errorpathnotfound/test4/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/LockFile.h delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/helper.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/test1.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/test2.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/helper.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/test3.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/test4.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/helper.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/test5.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/helper.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/test6.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/test7.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/UnlockFile.h delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/helper.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/test1.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/test2.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/helper.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/test3.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/testinfo.dat delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/test4.cpp delete mode 100644 src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/testinfo.dat (limited to 'src/pal/tests') diff --git a/src/pal/tests/palsuite/README.txt b/src/pal/tests/palsuite/README.txt index 577fc543f0..1cc930b9b0 100644 --- a/src/pal/tests/palsuite/README.txt +++ b/src/pal/tests/palsuite/README.txt @@ -15,7 +15,6 @@ 4. ADDITIONAL NOTES ON TESTING/SPECIFIC TEST CASE ISSUES C_runtime: _fdopen testing issues - File_IO: getfiletime/test5 File_IO: getfilesize/test1, setfilepointer/test(5,6,7) File_IO: gettempfilename(a,w)/test2 File_IO: setfileattributesa/test(1,4), setfileattributesw/test(1,4) @@ -93,11 +92,6 @@ The modes that will not be tested are as follows: -File_IO: getfiletime/test5 - -This test case is NTFS specific. - - File_IO: getfilesize/test1, getfilesizeex/test1 setfilepointer/test(5,6,7) These tests cases create a large number of temporary files which require diff --git a/src/pal/tests/palsuite/file_io/AreFileApisANSI/CMakeLists.txt b/src/pal/tests/palsuite/file_io/AreFileApisANSI/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/file_io/AreFileApisANSI/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/AreFileApisANSI.cpp b/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/AreFileApisANSI.cpp deleted file mode 100644 index ec61f0cb7d..0000000000 --- a/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/AreFileApisANSI.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: AreFileApisANSI.c -** -** Purpose: Tests the PAL implementation of the AreFileApisANSI function. -** The only possible return is TRUE. -** -** -**===================================================================*/ - - - -#include - - -int __cdecl main(int argc, char *argv[]) -{ - BOOL bRc = FALSE; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - bRc = AreFileApisANSI(); - - - if (bRc == FALSE) - { - Fail("AreFileApisANSI: ERROR: Function returned FALSE whereas only TRUE " - "is acceptable.\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/CMakeLists.txt deleted file mode 100644 index ac76e5dc12..0000000000 --- a/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - AreFileApisANSI.cpp -) - -add_executable(paltest_arefileapisansi_test1 - ${SOURCES} -) - -add_dependencies(paltest_arefileapisansi_test1 coreclrpal) - -target_link_libraries(paltest_arefileapisansi_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/testinfo.dat deleted file mode 100644 index 5e6b422ae4..0000000000 --- a/src/pal/tests/palsuite/file_io/AreFileApisANSI/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = AreFileApisANSI -Name = Positive Test for AreFileApisANSI -Type = DEFAULT -EXE1 = arefileapisansi -Description -=Ensure the return is TRUE because FALSE is not an option in FreeBSD - diff --git a/src/pal/tests/palsuite/file_io/CMakeLists.txt b/src/pal/tests/palsuite/file_io/CMakeLists.txt index 3d6eff1379..09fb686c1a 100644 --- a/src/pal/tests/palsuite/file_io/CMakeLists.txt +++ b/src/pal/tests/palsuite/file_io/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 2.8.12.2) -add_subdirectory(AreFileApisANSI) add_subdirectory(CompareFileTime) add_subdirectory(CopyFileA) add_subdirectory(CopyFileW) @@ -12,25 +11,20 @@ add_subdirectory(DeleteFileA) add_subdirectory(DeleteFileW) add_subdirectory(errorpathnotfound) add_subdirectory(FILECanonicalizePath) -add_subdirectory(FileTimeToDosDateTime) add_subdirectory(FindClose) add_subdirectory(FindFirstFileA) add_subdirectory(FindFirstFileW) add_subdirectory(FindNextFileA) add_subdirectory(FindNextFileW) add_subdirectory(FlushFileBuffers) -add_subdirectory(GetConsoleCP) add_subdirectory(GetConsoleOutputCP) add_subdirectory(GetCurrentDirectoryA) add_subdirectory(GetCurrentDirectoryW) -add_subdirectory(GetDiskFreeSpaceW) add_subdirectory(GetFileAttributesA) add_subdirectory(GetFileAttributesExW) add_subdirectory(GetFileAttributesW) add_subdirectory(GetFileSize) add_subdirectory(GetFileSizeEx) -add_subdirectory(GetFileTime) -add_subdirectory(GetFileType) add_subdirectory(GetFullPathNameA) add_subdirectory(GetFullPathNameW) add_subdirectory(GetLongPathNameW) @@ -41,10 +35,8 @@ add_subdirectory(GetTempFileNameA) add_subdirectory(GetTempFileNameW) add_subdirectory(gettemppatha) add_subdirectory(GetTempPathW) -add_subdirectory(MoveFileA) add_subdirectory(MoveFileExA) add_subdirectory(MoveFileExW) -add_subdirectory(MoveFileW) add_subdirectory(ReadFile) add_subdirectory(RemoveDirectoryA) add_subdirectory(RemoveDirectoryW) @@ -56,6 +48,5 @@ add_subdirectory(SetEndOfFile) add_subdirectory(SetFileAttributesA) add_subdirectory(SetFileAttributesW) add_subdirectory(SetFilePointer) -add_subdirectory(SetFileTime) add_subdirectory(WriteFile) diff --git a/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/CMakeLists.txt b/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/CMakeLists.txt deleted file mode 100644 index 9d5c678be3..0000000000 --- a/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_filetimetodosdatetime_test1 - ${SOURCES} -) - -add_dependencies(paltest_filetimetodosdatetime_test1 coreclrpal) - -target_link_libraries(paltest_filetimetodosdatetime_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/test1.cpp b/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/test1.cpp deleted file mode 100644 index 5f2c81ff98..0000000000 --- a/src/pal/tests/palsuite/file_io/FileTimeToDosDateTime/test1/test1.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: test1.c -** -** Purpose: Tests that FileTimeToDosDateTime successfully converts values. -** Makes sure values are rounded up, and the limits of the function -** pass. Also tests that values outside the valid range fail. -** -** -**===================================================================*/ - -#include - -typedef struct -{ - DWORD FileTimeLow; - DWORD FileTimeHigh; - WORD FatDate; - WORD FatTime; -} testCase; - -int __cdecl main(int argc, char **argv) -{ - FILETIME FileTime; - WORD ResultDate; - WORD ResultTime; - BOOL ret; - int i; - - testCase testCases[] = - { - /* Test a normal time */ - {0x9BE00100, 0x1B4A02C, 0x14CF, 0x55AF}, /* 12/15/2000, 10:45:30 AM*/ - /* Test that 12/15/2000, 10:45:29 Gets rounded up */ - {0x9B476A80, 0x1B4A02C, 0x14CF, 0x55AF}, /* 12/15/2000, 10:45:30 AM*/ - /* Test that 12/15/2000, 10:45:31 Gets rounded up */ - {0x9C789780, 0x1B4A02C, 0x14CF, 0x55B0}, /* 12/15/2000, 10:45:32 AM*/ - - /* Test the upper and lower limits of the function */ - {0xE1D58000, 0x1A8E79F, 0x0021, 0x0000}, /* 1/1/1980, 12:00:00 AM*/ - {0xb9de1300, 0x1e9eede, 0x739f, 0xbf7d}, /* 12/31/2037, 11:59:58 PM*/ - - /* Tests that should fail */ - {0, 0, 0, 0}, - {0xE0A45300, 0x1A8E79F, 0, 0}, - {0x66D29301, 0x23868B8, 0, 0} - - /* All this accomplishes is for the date to overflow. - Likely the only reason it fails in Windows is bacause the - resulting date falls outside of the legal range. Under BSD, - it falls into a legal range. This being that BSD calculates time - from 1900 to 2037, not 1980 to 2107. - {0xFFFFFFFF, 0xFFFFFFF, 0, 0} - */ - }; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - for (i=0; i - - -int __cdecl main(int argc, char *argv[]) -{ - UINT uiCP = 0; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - uiCP = GetConsoleCP(); - if ((uiCP != CP_ACP) && (uiCP != GetACP()) && (uiCP != 437)) /*437 for MSDOS*/ - { - Fail("GetConsoleCP: ERROR -> The invalid code page %d was returned.\n", - uiCP); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetConsoleCP/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/GetConsoleCP/test1/testinfo.dat deleted file mode 100644 index 608a01b2ef..0000000000 --- a/src/pal/tests/palsuite/file_io/GetConsoleCP/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetConsoleCP -Name = Positive Test for GetConsoleCP (test 1) -Type = DEFAULT -EXE1 = getconsolecp -Description -= Test GetConsoleCP. Apparently there are only two possible -= return values: CP_ACP or 1252 diff --git a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/CMakeLists.txt deleted file mode 100644 index ef14ea5352..0000000000 --- a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test2) - diff --git a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/CMakeLists.txt deleted file mode 100644 index e0238707e5..0000000000 --- a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - GetDiskFreeSpaceW.cpp -) - -add_executable(paltest_getdiskfreespacew_test1 - ${SOURCES} -) - -add_dependencies(paltest_getdiskfreespacew_test1 coreclrpal) - -target_link_libraries(paltest_getdiskfreespacew_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/GetDiskFreeSpaceW.cpp b/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/GetDiskFreeSpaceW.cpp deleted file mode 100644 index c1445f654f..0000000000 --- a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/GetDiskFreeSpaceW.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetDiskFreeSpaceW.c (test 1) -** -** Purpose: Tests the PAL implementation of the GetDiskFreeSpaceW function. -** -** -**===================================================================*/ - -#include - - -int __cdecl main(int argc, char *argv[]) -{ - DWORD dwSectorsPerCluster; /* sectors per cluster */ - DWORD dwBytesPerSector; /* bytes per sector */ - DWORD dwSectorsPerCluster_02; /* sectors per cluster */ - DWORD dwBytesPerSector_02; /* bytes per sector */ - DWORD dwNumberOfFreeClusters; /* free clusters */ - DWORD dwTotalNumberOfClusters; /* total clusters */ - BOOL bRc = FALSE; - WCHAR szwRootPath[10] = {'/','\0'}; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* test the NULL option which translates to the current drive */ - bRc = GetDiskFreeSpaceW(NULL, - &dwSectorsPerCluster, - &dwBytesPerSector, - &dwNumberOfFreeClusters, - &dwTotalNumberOfClusters); - if (bRc != TRUE) - { - Fail("GetDiskFreeSpaceW: ERROR -> Failed with error code: %ld\n", - GetLastError()); - } - else if (dwSectorsPerCluster == 0) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwSectorsPerCluster returned 0\n"); - } - else if (dwBytesPerSector == 0) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwBytesPerSector returned 0\n"); - } - - /* test the root directory to the current drive */ - bRc = GetDiskFreeSpaceW(szwRootPath, - &dwSectorsPerCluster_02, - &dwBytesPerSector_02, - &dwNumberOfFreeClusters, - &dwTotalNumberOfClusters); - if (bRc != TRUE) - { - Fail("GetDiskFreeSpaceW: ERROR -> Failed with error code: %ld\n", - GetLastError()); - } - else if (dwSectorsPerCluster == 0) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwSectorsPerCluster returned 0\n"); - } - else if (dwBytesPerSector == 0) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwBytesPerSector returned 0\n"); - } - /* - ** make sure the values returned for NULL path and root path - ** are the same - */ - else if (dwSectorsPerCluster_02 != dwSectorsPerCluster) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwSectorsPerCluster for NULL path " - "(%u) should have been the same as the root path (%u).\n", - dwSectorsPerCluster, - dwSectorsPerCluster_02); - } - else if (dwBytesPerSector_02 != dwBytesPerSector) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwBytesPerSector for NULL path " - "(%u) should have been the same as the root path (%u).\n", - dwBytesPerSector, - dwBytesPerSector_02); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/testinfo.dat deleted file mode 100644 index 61b0e55fae..0000000000 --- a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetDiskFreeSpaceW -Name = Positive Test for GetDiskFreeSpaceW (test 1) -Type = DEFAULT -EXE1 = getdiskfreespacew -Description -= Test GetDiskFreeSpaceW. lpNumberOfFreeClusters and -= lpTotalNumberOfClusters are to be ignored diff --git a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/CMakeLists.txt deleted file mode 100644 index fb6a08789b..0000000000 --- a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - getdiskfreespacew.cpp -) - -add_executable(paltest_getdiskfreespacew_test2 - ${SOURCES} -) - -add_dependencies(paltest_getdiskfreespacew_test2 coreclrpal) - -target_link_libraries(paltest_getdiskfreespacew_test2 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/getdiskfreespacew.cpp b/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/getdiskfreespacew.cpp deleted file mode 100644 index 83dcb54b51..0000000000 --- a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/getdiskfreespacew.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetDiskFreeSpaceW.c (test 2) -** -** Purpose: Tests the PAL implementation of the GetDiskFreeSpaceW -** function on valid non-root paths. -** -** -**===================================================================*/ - -#include - - -int __cdecl main(int argc, char *argv[]) -{ - DWORD dwSectorsPerCluster; /* sectors per cluster */ - DWORD dwBytesPerSector; /* bytes per sector */ - DWORD dwNumberOfFreeClusters; /* free clusters */ - DWORD dwTotalNumberOfClusters; /* total clusters */ - BOOL bRc = FALSE; - WCHAR szwCurrentPath[MAX_LONGPATH]; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* get the current directory so we are sure to have a valid path */ - if (!GetCurrentDirectoryW(MAX_LONGPATH, szwCurrentPath)) - { - Fail("GetDiskFreeSpaceW: ERROR -> GetCurrentDirectoryW failed with " - "error code: %u.\n", - GetLastError()); - } - - /* test the current path*/ - bRc = GetDiskFreeSpaceW(szwCurrentPath, - &dwSectorsPerCluster, - &dwBytesPerSector, - &dwNumberOfFreeClusters, - &dwTotalNumberOfClusters); - if (bRc != TRUE) - { - Fail("GetDiskFreeSpaceW: ERROR -> Failed with error code: %u for " - "the path \"%S\".\n", - GetLastError(), - szwCurrentPath); - } - else if (dwSectorsPerCluster == 0) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwSectorsPerCluster returned 0\n"); - } - else if (dwBytesPerSector == 0) - { - Fail("GetDiskFreeSpaceW: ERROR -> dwBytesPerSector returned 0\n"); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/testinfo.dat b/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/testinfo.dat deleted file mode 100644 index 0a687240ea..0000000000 --- a/src/pal/tests/palsuite/file_io/GetDiskFreeSpaceW/test2/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetDiskFreeSpaceW -Name = Positive Test for GetDiskFreeSpaceW (test 2) -Type = DEFAULT -EXE1 = getdiskfreespacew -Description -= Test GetDiskFreeSpaceW with valid non-root paths diff --git a/src/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp b/src/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp index 7a622b628c..af279ed1ef 100644 --- a/src/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp +++ b/src/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp @@ -9,8 +9,7 @@ ** Purpose: Tests the PAL implementation of the GetFileAttributesExW function. ** Call the function on a normal directory and file and a read-only directory ** and file and a hidden file and directory. -** Ensure that the attributes returned are correct, and the -** file times and file sizes. +** Ensure that the returned attributes and file sizes are correct. ** ** **===================================================================*/ @@ -24,24 +23,6 @@ typedef enum Item IS_FILE }ItemType; -/* - This is a helper function which takes two FILETIME structures and - checks to see if they contain the exact same time. -*/ -int IsEqualFileTime(FILETIME FirstTime, FILETIME SecondTime) -{ - - ULONG64 TimeOne, TimeTwo; - - TimeOne = ((((ULONG64)FirstTime.dwHighDateTime)<<32) | - ((ULONG64)FirstTime.dwLowDateTime)); - - TimeTwo = ((((ULONG64)SecondTime.dwHighDateTime)<<32) | - ((ULONG64)SecondTime.dwLowDateTime)); - - return(TimeOne == TimeTwo); -} - /* This function takes a structure and checks that the information within the structure is correct. The 'Attribs' are the expected file attributes, 'TheType' is IS_DIR or IS_FILE and the 'Name' is the @@ -88,38 +69,6 @@ void VerifyInfo(WIN32_FILE_ATTRIBUTE_DATA InfoStruct, GetLastError()); } - - - /* Get the FileTime of the file in question */ - if(GetFileTime(hFile, &CorrectCreation, - &CorrectAccess, &CorrectModify) == 0) - { - Fail("ERROR: GetFileTime failed to get the filetime of the " - "file. GetLastError() returned %d.", - GetLastError()); - } - - /* Check that the Creation, Access and Last Modified times are all - the same in the structure as what GetFileTime just returned. - */ - if(!IsEqualFileTime(CorrectCreation, InfoStruct.ftCreationTime)) - { - Fail("ERROR: The creation time of the file " - "does not match the creation time given from " - "GetFileTime.\n"); - } - if(!IsEqualFileTime(CorrectAccess, InfoStruct.ftLastAccessTime)) - { - Fail("ERROR: The access time of the file " - "does not match the access time given from " - "GetFileTime.\n"); - } - if(!IsEqualFileTime(CorrectModify, InfoStruct.ftLastWriteTime)) - { - Fail("ERROR: The write time of the file " - "does not match the last write time given from " - "GetFileTime.\n"); - } if(InfoStruct.nFileSizeLow != GetFileSize(hFile,NULL)) { diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/CMakeLists.txt deleted file mode 100644 index 19ee487a6a..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) -add_subdirectory(test5) -add_subdirectory(test6) -add_subdirectory(test7) - diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/test1/CMakeLists.txt deleted file mode 100644 index 3c95a5d992..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - GetFileTime.cpp -) - -add_executable(paltest_getfiletime_test1 - ${SOURCES} -) - -add_dependencies(paltest_getfiletime_test1 coreclrpal) - -target_link_libraries(paltest_getfiletime_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test1/GetFileTime.cpp b/src/pal/tests/palsuite/file_io/GetFileTime/test1/GetFileTime.cpp deleted file mode 100644 index fb7bcb8513..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test1/GetFileTime.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileTime.c -** -** Purpose: Tests the PAL implementation of the GetFileTime function. -** This test checks the time of a file, writes to it, then checks the -** time again to ensure that write time has increased. It -** also checks that creation time is the same under WIN32 and has -** increased under FreeBSD. -** -** Depends: -** CreateFile -** WriteFile -** CloseHandle -** -** -**===================================================================*/ - - -#include - - -int __cdecl main(int argc, char **argv) -{ - - FILETIME Creation,LastAccess,LastWrite; - HANDLE TheFileHandle; - ULONG64 FirstWrite, SecondWrite, FirstCreationTime, SecondCreationTime; - DWORD temp; - BOOL result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Open the file to get a HANDLE */ - TheFileHandle = - CreateFile( - "the_file", // File Name - GENERIC_READ|GENERIC_WRITE, // Access Mode - 0, // Share Mode - NULL, // SD - OPEN_ALWAYS, // Howto Create - FILE_ATTRIBUTE_NORMAL, // File Attributes - NULL // Template file - ); - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the file. The error number " - "returned was %d.",GetLastError()); - } - - - /* Get the Last Write, Creation and Access File time of that File */ - if(!GetFileTime(TheFileHandle,&Creation,&LastAccess,&LastWrite)) - { - Fail("ERROR: GetFileTime returned 0, indicating failure."); - } - - /* Convert the structure to an ULONG64 */ - - FirstCreationTime = ((((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - FirstWrite = ((((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - /* Sleep for 3 seconds, this will ensure the time changes */ - Sleep(3000); - - /* Write to the file -- this should change write access and - last access - */ - - result = WriteFile(TheFileHandle, // File handle - "something", // String to write - 9, // Bytes to write - &temp, // Bytes written - NULL); - - if(result == 0) - { - Fail("ERROR: Failed to write to file. The file must be " - "written to in order to test that the write time is " - "updated."); - } - - /* Close the File, so the changes are recorded */ - result = CloseHandle(TheFileHandle); - - if(result == 0) - { - Fail("ERROR: Failed to close the file handle."); - } - - - /* Reopen the file */ - TheFileHandle = - CreateFile( - "the_file", /* file name */ - GENERIC_READ|GENERIC_WRITE, /* access mode */ - 0, /* share mode */ - NULL, /* SD */ - OPEN_ALWAYS, /* how to create */ - FILE_ATTRIBUTE_NORMAL, /* file attributes */ - NULL /* handle to template file */ - ); - - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to re-open the file. The error number " - "returned was %d.",GetLastError()); - } - - - - /* Call GetFileTime again */ - if(!GetFileTime(TheFileHandle,&Creation,&LastAccess,&LastWrite)) - { - Fail("ERROR: GetFileTime returned 0, indicating failure."); - } - - /* Store the results in a ULONG64 */ - - SecondCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - SecondWrite = ( (((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - - /* Now -- to test. We'll ensure that the Second - LastWrite time is larger than the first. It tells us that - time is passing, which is good! - */ - - if(FirstWrite >= SecondWrite) - { - Fail("ERROR: The last-write-file-time after writing did not " - "increase from the original. The second value should be " - "larger."); - } - -#if WIN32 - /* Then we can check to make sure that the creation time - hasn't changed. This should always stay the same. - */ - - if(FirstCreationTime != SecondCreationTime) - { - Fail("ERROR: The creation time after writing should not " - "not change from the original. The second value should be " - "equal."); - } -#else - /* Then we can check to make sure that the creation time - has changed. Under FreeBSD it changes whenever the file is - access or written. - */ - - if(FirstCreationTime >= SecondCreationTime) - { - Fail("ERROR: The creation time after writing should be " - "greater than the original. The second value should be " - "larger."); - } - -#endif - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileTime/test1/testinfo.dat deleted file mode 100644 index 50cd35214d..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test1/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileTime -Name = Positive Test for GetFileTime -TYPE = DEFAULT -EXE1 = getfiletime -Description -= Test the GetFileTime function. Open a file and get the time. Then write -= to that file. This will change the write and under FreeBSD -= the creation time. Ensure that all of these are increasing. diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test2/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/test2/CMakeLists.txt deleted file mode 100644 index 329d8c6553..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test2/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - GetFileTime.cpp -) - -add_executable(paltest_getfiletime_test2 - ${SOURCES} -) - -add_dependencies(paltest_getfiletime_test2 coreclrpal) - -target_link_libraries(paltest_getfiletime_test2 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test2/GetFileTime.cpp b/src/pal/tests/palsuite/file_io/GetFileTime/test2/GetFileTime.cpp deleted file mode 100644 index 5b14a1e357..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test2/GetFileTime.cpp +++ /dev/null @@ -1,195 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileTime.c -** -** Purpose: Tests the PAL implementation of the GetFileTime function -** Test to see that access date either stays the same or increases -** when a read is performed. Write -** and creation time should stay unchanged. Note: Under FreeBSD -** the Creation time should not change with just a read. -** -** Depends: -** FileTimeToDosDateTime -** CreateFile -** ReadFile -** CloseHandle -** -** -**===================================================================*/ - - -#include - - -int __cdecl main(int argc, char **argv) -{ - - FILETIME Creation,LastAccess,LastWrite; - HANDLE TheFileHandle; - ULONG64 FirstWrite, SecondWrite, - FirstCreationTime, SecondCreationTime; - DWORD temp; - char ReadBuffer[10]; - BOOL result; - WORD DosDateOne, DosDateTwo, DosTime; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Open the file to get a HANDLE */ - TheFileHandle = - CreateFile( - "the_file", - GENERIC_READ, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the file. The error number " - "returned was %d.",GetLastError()); - } - - - /* Get the Last Write, Creation and Access File time of that File */ - if(GetFileTime(TheFileHandle,&Creation,&LastAccess,&LastWrite)==0) - { - Fail("ERROR: GetFileTime returned 0, indicating failure."); - } - - /* Call FileTimeToDosDateTime so we can aquire just the date - portion of the Last Access FILETIME. - */ - if(FileTimeToDosDateTime(&LastAccess, &DosDateOne, &DosTime) == 0) - { - Fail("ERROR: FiletimeToDosDateTime failed, returning 0. " - "GetLastError returned %d.\n",GetLastError()); - } - - /* Convert the structure to an ULONG64 */ - - FirstCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - FirstWrite = ( (((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - /* Sleep for 3 seconds, this will ensure the time changes */ - Sleep(3000); - - /* Read from the file -- this should change - last access, but we'll only check the date portion, because some file - systems have a resolution of a day. - */ - - result = ReadFile(TheFileHandle, // handle to file - &ReadBuffer, // data buffer - 2, // number of bytes to read - &temp, // number of bytes read - NULL); - - if(result == 0) - { - Fail("ERROR: Failed to read from the file."); - } - - - /* Close the File, so the changes are recorded */ - result = CloseHandle(TheFileHandle); - - if(result == 0) - { - Fail("ERROR: Failed to close the file handle."); - } - - - /* Reopen the file */ - TheFileHandle = - CreateFile("the_file", /* file name */ - GENERIC_READ, /* access mode */ - 0, /* share mode */ - NULL, /* SD */ - OPEN_ALWAYS, /* how to create */ - FILE_ATTRIBUTE_NORMAL, /* file attributes */ - NULL /* handle to template file */ - ); - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to re-open the file. The error number " - "returned was %d.",GetLastError()); - } - - /* Call GetFileTime again */ - if(GetFileTime(TheFileHandle,&Creation,&LastAccess,&LastWrite) == 0) - { - Fail("ERROR: GetFileTime returned 0, indicating failure."); - } - - /* Get the Date of the LastAccessTime here again. */ - if(FileTimeToDosDateTime(&LastAccess, &DosDateTwo, &DosTime) == 0) - { - Fail("ERROR: FileTimeToDosDateTime failed, returning 0. " - "GetLastError returned %d.\n",GetLastError()); - } - - - /* Store the results in a ULONG64 */ - - SecondCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - SecondWrite = ( (((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - /* Now -- to test. We'll ensure that the Second - LastWrite time is the same as the first. This shouldn't - have changed. - */ - - if(FirstWrite != SecondWrite) - { - Fail("ERROR: The last-write-file-time after reading " - "increased from the original. The second value should be " - "equal."); - } - - - /* - For LastAccessTime, just check that the date is greater or equal - for the second over the first. The time is not conisered on some - file systems. (such as fat32) - */ - - if(DosDateOne > DosDateTwo) - { - Fail("ERROR: The last-access-time after reading should have " - "stayed the same or increased, but it did not.\n"); - } - - - /* Check to ensure CreationTime hasn't changed. This should not - have changed in either environment. - */ - - if(FirstCreationTime != SecondCreationTime) - { - Fail("ERROR: The creation time after reading should not " - "not change from the original. The second value should be " - "equal."); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test2/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileTime/test2/testinfo.dat deleted file mode 100644 index a60dcf45a4..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test2/testinfo.dat +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileTime -Name = Positive Test for GetFileTime -TYPE = DEFAULT -EXE1 = getfiletime -Description -= Tests the PAL implementation of the GetFileTime function -= Test to see that access date either stays the same or increases -= when a read is performed. Write -= and creation time should stay unchanged. Note: Under FreeBSD -= the Creation time should not change with just a read. diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test3/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/test3/CMakeLists.txt deleted file mode 100644 index d154a8810b..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test3/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - GetFileTime.cpp -) - -add_executable(paltest_getfiletime_test3 - ${SOURCES} -) - -add_dependencies(paltest_getfiletime_test3 coreclrpal) - -target_link_libraries(paltest_getfiletime_test3 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test3/GetFileTime.cpp b/src/pal/tests/palsuite/file_io/GetFileTime/test3/GetFileTime.cpp deleted file mode 100644 index a3f46c2bf8..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test3/GetFileTime.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileTime.c -** -** Purpose: Tests the PAL implementation of the GetFileTime function -** Test to see that creation time is changed when two different files -** are created. -** -** Depends: -** CreateFile -** ReadFile -** CloseHandle -** -** -**===================================================================*/ - - -#include - - -int __cdecl main(int argc, char **argv) -{ - - FILETIME Creation; - HANDLE TheFileHandle, SecondFileHandle; - ULONG64 FirstCreationTime, SecondCreationTime; - BOOL result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Open the file to get a HANDLE */ - TheFileHandle = - CreateFile( - "the_file", - GENERIC_READ, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the file. The error number " - "returned was %d.",GetLastError()); - } - - - /* Get the Creation time of the File */ - if(GetFileTime(TheFileHandle,&Creation,NULL,NULL)==0) - { - Fail("ERROR: GetFileTime returned 0, indicating failure. " - "Two of the params were NULL in this case, did they " - "cause the probleM?"); - } - - /* Convert the structure to an ULONG64 */ - - FirstCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - - /* Close the File, so the changes are recorded */ - result = CloseHandle(TheFileHandle); - - if(result == 0) - { - Fail("ERROR: Failed to close the file handle."); - } - - - /* Sleep for 3 seconds, this will ensure the time changes */ - Sleep(3000); - - - - /* Open another file */ - SecondFileHandle = - CreateFile("the_other_file", /* file name */ - GENERIC_READ, /* access mode */ - 0, /* share mode */ - NULL, /* SD */ - CREATE_ALWAYS, /* how to create */ - FILE_ATTRIBUTE_NORMAL, /* file attributes */ - NULL /* handle to template file */ - ); - - if(SecondFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the second file. The error number " - "returned was %d.",GetLastError()); - } - - - /* Call GetFileTime again */ - if(GetFileTime(SecondFileHandle,&Creation,NULL,NULL) == 0) - { - Fail("ERROR: GetFileTime returned 0, indicating failure. " - "Perhaps the NULLs in the function broke it?"); - } - - /* Close the File*/ - result = CloseHandle(SecondFileHandle); - - if(result == 0) - { - Fail("ERROR: Failed to close the file handle."); - } - - - /* Store the results in a ULONG64 */ - - SecondCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - - - /* Now -- to test. We ensure that the FirstCreationTime is - less than the SecondCreationTime - */ - - - if(FirstCreationTime >= SecondCreationTime) - { - Fail("ERROR: The creation time of the two files should be " - "different. The first file should have a creation " - "time less than the second."); - } - - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test3/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileTime/test3/testinfo.dat deleted file mode 100644 index 6d1eba739d..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test3/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileTime -Name = Positive Test for GetFileTime -TYPE = DEFAULT -EXE1 = getfiletime -Description -= Test the GetFileTime function. This test creates two files and compares -= their creation times. They should be different. It also tries to get the -= file time of an invalid handle, which should cause the function to tail. diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test4/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/test4/CMakeLists.txt deleted file mode 100644 index 416db15a06..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test4/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - GetFileTime.cpp -) - -add_executable(paltest_getfiletime_test4 - ${SOURCES} -) - -add_dependencies(paltest_getfiletime_test4 coreclrpal) - -target_link_libraries(paltest_getfiletime_test4 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test4/GetFileTime.cpp b/src/pal/tests/palsuite/file_io/GetFileTime/test4/GetFileTime.cpp deleted file mode 100644 index ffba516e35..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test4/GetFileTime.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileTime.c -** -** Purpose: Tests the PAL implementation of the GetFileTime function -** Test to see that passing NULL values to GetFileTime works and that -** calling the function on a bad HANDLE causes the correct failure. -** -** Depends: -** CreateFile -** CloseHandle -** -** -**===================================================================*/ - - -#include - - -int __cdecl main(int argc, char **argv) -{ - - FILETIME Creation,LastWrite,LastAccess; - HANDLE TheFileHandle; - BOOL result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Open the file to get a HANDLE */ - TheFileHandle = - CreateFile( - "the_file", - GENERIC_READ, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the file. The error number " - "returned was %d.",GetLastError()); - } - - /* Pass all NULLs, this is useless but should still work. */ - if(GetFileTime(TheFileHandle,NULL,NULL,NULL)==0) - { - Fail("ERROR: GetFileTime returned 0, indicating failure. " - "Three of the params were NULL in this case, did they " - "cause the problem?"); - } - - - /* Get the Creation time of the File */ - if(GetFileTime(TheFileHandle,&Creation,NULL,NULL)==0) - { - Fail("ERROR: GetFileTime returned 0, indicating failure. " - "Two of the params were NULL in this case, did they " - "cause the probleM?"); - } - - /* Get the Creation, LastWrite time of the File */ - if(GetFileTime(TheFileHandle,&Creation,&LastWrite,NULL)==0) - { - Fail("ERROR: GetFileTime returned 0, indicating failure. " - "One of the params were NULL in this case, did it " - "cause the problem?"); - } - - - /* Close the File, so the changes are recorded */ - result = CloseHandle(TheFileHandle); - - if(result == 0) - { - Fail("ERROR: Failed to close the file handle."); - } - - /* Call GetFileTime again */ - if(GetFileTime(TheFileHandle,&Creation,&LastWrite,&LastAccess) != 0) - { - Fail("ERROR: GetFileTime returned non zero, indicating success. " - "It was passed an invalid file HANDLE and should have " - "failed."); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test4/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileTime/test4/testinfo.dat deleted file mode 100644 index af90558cae..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test4/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileTime -Name = Positive Test for GetFileTime -TYPE = DEFAULT -EXE1 = getfiletime -Description -= Test the GetFileTime function. This test gets the file time of a given -= file while passing all the combonations of NULL as parameters. The -= function should handle these as unneeded times, and still succeed. diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test5/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/test5/CMakeLists.txt deleted file mode 100644 index 4072a52fbc..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test5/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - getfiletime.cpp -) - -add_executable(paltest_getfiletime_test5 - ${SOURCES} -) - -add_dependencies(paltest_getfiletime_test5 coreclrpal) - -target_link_libraries(paltest_getfiletime_test5 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test5/getfiletime.cpp b/src/pal/tests/palsuite/file_io/GetFileTime/test5/getfiletime.cpp deleted file mode 100644 index d8196d84bc..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test5/getfiletime.cpp +++ /dev/null @@ -1,224 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileTime.c -** -** Purpose: Test the PAL implementation of GetFileTime. This test -** creates a file and compares create and write times between -** writes, but before the close, and verifies the results are -** as expected -** -** Depends: -** CreateFile -** WriteFile -** CloseHandle -** -** -**===================================================================*/ - - -#include - - -int __cdecl main(int argc, char **argv) -{ - FILETIME Creation; - FILETIME LastAccess; - FILETIME LastWrite; - HANDLE hFile; - ULONG64 FirstWrite; - ULONG64 SecondWrite; - ULONG64 FirstCreationTime; - ULONG64 SecondCreationTime; - DWORD temp; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Open the file to get a HANDLE */ - hFile = CreateFile("test.tmp", - GENERIC_READ|GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to create the file. The error number " - "returned was %u.\n", - GetLastError()); - } - - /* Write to the file -- this should change write access and - last access - */ - if(!WriteFile(hFile, "something", 9, &temp, NULL)) - { - Trace("ERROR: Failed to write to file. The file must be " - "written to in order to test that the write time is " - "updated. GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - FlushFileBuffers(hFile); - - /* Get the Last Write, Creation and Access File time of that File */ - if(!GetFileTime(hFile, &Creation, &LastAccess, &LastWrite)) - { - Trace("ERROR: GetFileTime returned 0, indicating failure." - " GetLastError returned %u\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Convert the structure to an ULONG64 */ - - FirstCreationTime = ((((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - FirstWrite = ((((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - /* Sleep for 3 seconds, this will ensure the time changes */ - Sleep(3000); - - /* Write to the file again -- this should change write access and - last access - */ - if(!WriteFile(hFile, "something", 9, &temp, NULL)) - { - Trace("ERROR: Failed to write to file. The file must be " - "written to in order to test that the write time is " - "updated. GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - - FlushFileBuffers(hFile); - - /* Call GetFileTime again */ - if(!GetFileTime(hFile,&Creation,&LastAccess,&LastWrite)) - { - Trace("ERROR: GetFileTime returned 0, indicating failure." - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Store the results in a ULONG64 */ - - SecondCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - SecondWrite = ( (((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - - /* Now -- to test. We'll ensure that the Second - LastWrite time is larger than the first. It tells us that - time is passing, which is good! - */ - - if(FirstWrite >= SecondWrite) - { - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("ERROR: The last-write-file-time after writing did not " - "increase from the original. The second value should be " - "larger.\n"); - } - -#if WIN32 - /* Then we can check to make sure that the creation time - hasn't changed. This should always stay the same. - */ - - if(FirstCreationTime != SecondCreationTime) - { - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("ERROR: The creation time after writing should not " - "not change from the original. The second value should be " - "equal.\n"); - } -#else - /* Then we can check to make sure that the creation time - has changed. Under FreeBSD it changes whenever the file is - access or written. - */ - - if(FirstCreationTime >= SecondCreationTime) - { - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("ERROR: The creation time after writing should be " - "greater than the original. The second value should be " - "larger.\n"); - } - -#endif - - /* Close the File */ - if(!CloseHandle(hFile)) - { - Fail("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test5/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileTime/test5/testinfo.dat deleted file mode 100644 index fd4112b1fa..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test5/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileTime -Name = Positive Test for GetFileTime -TYPE = DEFAULT -EXE1 = getfiletime -Description -= Test the PAL implementation of GetFileTime. This test -= creates a file and compares create and write times between -= writes, but before the close, and verifies the results are -= as expected diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test6/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/test6/CMakeLists.txt deleted file mode 100644 index 83d652461b..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test6/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - getfiletime.cpp -) - -add_executable(paltest_getfiletime_test6 - ${SOURCES} -) - -add_dependencies(paltest_getfiletime_test6 coreclrpal) - -target_link_libraries(paltest_getfiletime_test6 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test6/getfiletime.cpp b/src/pal/tests/palsuite/file_io/GetFileTime/test6/getfiletime.cpp deleted file mode 100644 index 3eedddf82d..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test6/getfiletime.cpp +++ /dev/null @@ -1,281 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileTime.c -** -** Purpose: Tests the PAL implementation of the GetFileTime function. -** Perform two reads from a file without closing until the end -** of the test and verify that only the access times change. -** Note: Under Win32, modify time changes as well so we will -** check that it doesn't go backwards -** -** Depends: -** FileTimeToDosDateTime -** CreateFile -** ReadFile -** WriteFile -** CloseHandle -** -** -**===================================================================*/ - - -#include - - -int __cdecl main(int argc, char **argv) -{ - - FILETIME Creation; - FILETIME LastAccess; - FILETIME LastWrite; - HANDLE hFile; - ULONG64 FirstWrite = (ULONG64)0; - ULONG64 SecondWrite = (ULONG64)0; - ULONG64 FirstCreationTime = (ULONG64)0; - ULONG64 SecondCreationTime = (ULONG64)0; - DWORD temp; - char ReadBuffer[10]; - WORD DosDateOne; - WORD DosDateTwo; - WORD DosTime; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - memset(&Creation, 0, sizeof(FILETIME)); - memset(&LastAccess, 0, sizeof(FILETIME)); - memset(&LastWrite, 0, sizeof(FILETIME)); - - /* Create the file to get a HANDLE */ - hFile = CreateFile("test.tmp", - GENERIC_READ|GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to create the file. The error number " - "returned was %u.\n", - GetLastError()); - } - - /* give us something to read from the file */ - if(!WriteFile(hFile, "something", 9, &temp, NULL)) - { - Trace("ERROR: Failed to write to file. " - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* let's do a read to set the file times for our test */ - if(!ReadFile(hFile, &ReadBuffer, 2, &temp, NULL)) - { - Trace("ERROR: Failed to read from the file. " - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Get the Last Write, Creation and Access File time of the file */ - if(GetFileTime(hFile, &Creation, &LastAccess, &LastWrite)==0) - { - Trace("ERROR: GetFileTime returned 0, indicating failure." - " GetLastError returned %u\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Call FileTimeToDosDateTime so we can aquire just the date - portion of the Last Access FILETIME. - */ - if(FileTimeToDosDateTime(&LastAccess, &DosDateOne, &DosTime) == 0) - { - Trace("ERROR: FiletimeToDosDateTime failed, returning 0. " - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Convert the structure to an ULONG64 */ - FirstCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - FirstWrite = ( (((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - /* Sleep for 3 seconds, this will ensure the time changes */ - Sleep(3000); - - /* Read from the file -- this should change - last access, but we'll only check the date portion, because some file - systems have a resolution of a day. - */ - memset(&Creation, 0, sizeof(FILETIME)); - memset(&LastAccess, 0, sizeof(FILETIME)); - memset(&LastWrite, 0, sizeof(FILETIME)); - - if(!ReadFile(hFile, &ReadBuffer, 2, &temp, NULL)) - { - Trace("ERROR: Failed to read from the file. " - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - - /* Call GetFileTime to get the updated time values*/ - if(GetFileTime(hFile, &Creation, &LastAccess, &LastWrite) == 0) - { - Trace("ERROR: GetFileTime returned 0, indicating failure. " - "GetLastError returned %d.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Get the Date of the LastAccessTime here again. */ - if(FileTimeToDosDateTime(&LastAccess, &DosDateTwo, &DosTime) == 0) - { - Trace("ERROR: FileTimeToDosDateTime failed, returning 0. " - "GetLastError returned %d.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - - /* Store the results in a ULONG64 */ - SecondCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - SecondWrite = ( (((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - /* Now -- to test. We'll ensure that the SecondWrite - time is not less than the FirstWrite time - */ - - if(SecondWrite < FirstWrite) - { - Trace("ERROR: The write-file-time (%I64d) after the first read " - "is less than the write-file-time (%I64d) after the second " - "read.\n", - FirstWrite, - LastWrite); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* - For LastAccessTime, just check that the date is greater or equal - for the second over the first. The time is not conisered on some - file systems. (such as fat32) - */ - - if(DosDateOne > DosDateTwo) - { - Trace("ERROR: The last-access-time after reading should have " - "stayed the same or increased, but it did not.\n"); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - - /* Check to ensure CreationTime hasn't changed. This should not - have changed in either environment. - */ - - if(FirstCreationTime != SecondCreationTime) - { - Trace("ERROR: The creation time after reading should not " - "not change from the original. The second value should be " - "equal.\n"); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Close the File, so the changes are recorded */ - if(!CloseHandle(hFile)) - { - Fail("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test6/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileTime/test6/testinfo.dat deleted file mode 100644 index 844043689c..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test6/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileTime -Name = Positive Test for GetFileTime -TYPE = DEFAULT -EXE1 = getfiletime -Description -= Tests the PAL implementation of the GetFileTime function. -= Perform two reads from a file without closing until the end -= of the test and verify that only the access times change. diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test7/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileTime/test7/CMakeLists.txt deleted file mode 100644 index 34a08db686..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test7/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - getfiletime.cpp -) - -add_executable(paltest_getfiletime_test7 - ${SOURCES} -) - -add_dependencies(paltest_getfiletime_test7 coreclrpal) - -target_link_libraries(paltest_getfiletime_test7 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test7/getfiletime.cpp b/src/pal/tests/palsuite/file_io/GetFileTime/test7/getfiletime.cpp deleted file mode 100644 index d33175b8ec..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test7/getfiletime.cpp +++ /dev/null @@ -1,279 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileTime.c -** -** Purpose: Test the PAL implementation of GetFileTime. This test -** creates a file and compares create and write times after -** the buffers are flushed, but before the close, and verifies -** the results are as expected -** -** Depends: -** CreateFile -** WriteFile -** FlushFileBuffers -** CloseHandle -** -** -**===================================================================*/ - - -#include - - -int __cdecl main(int argc, char **argv) -{ - FILETIME Creation; - FILETIME LastAccess; - FILETIME LastWrite; - HANDLE hFile; - ULONG64 FirstWrite; - ULONG64 SecondWrite; - ULONG64 FirstAccess; - ULONG64 SecondAccess; - ULONG64 FirstCreationTime; - ULONG64 SecondCreationTime; - DWORD temp; - const char* someText = "1234567890123456789012345678901234567890"; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Open the file to get a HANDLE */ - hFile = CreateFile("test.tmp", - GENERIC_READ|GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to create the file. The error number " - "returned was %u.\n", - GetLastError()); - } - - /* Write to the file -- this should change write access and - last access - */ - if(!WriteFile(hFile, someText, strlen(someText), &temp, NULL)) - { - Trace("ERROR: Failed to write to file. The file must be " - "written to in order to test that the write time is " - "updated. GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Flush the buffers */ - if(!FlushFileBuffers(hFile)) - { - Trace("ERROR: The FlushFileBuffers function failed. " - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Get the Last Write, Creation and Access File time of that File */ - if(!GetFileTime(hFile, &Creation, &LastAccess, &LastWrite)) - { - Trace("ERROR: GetFileTime returned 0, indicating failure." - " GetLastError returned %u\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Convert the structures to an ULONG64 */ - FirstCreationTime = ((((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - FirstWrite = ((((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - FirstAccess = ((((ULONG64)LastAccess.dwHighDateTime)<<32) | - ((ULONG64)LastAccess.dwLowDateTime)); - - /* Sleep for 3 seconds, this will ensure the time changes */ - Sleep(3000); - - /* Write to the file again so we have something to flush */ - if(!WriteFile(hFile, someText, strlen(someText), &temp, NULL)) - { - Trace("ERROR: Failed to write to file. The file must be " - "written to in order to test that the write time is " - "updated. GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Flush the buffers forcing the access/mod time to change */ - if(!FlushFileBuffers(hFile)) - { - Trace("ERROR: The FlushFileBuffers function failed. " - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - - /* Call GetFileTime again */ - if(!GetFileTime(hFile,&Creation,&LastAccess,&LastWrite)) - { - Trace("ERROR: GetFileTime returned 0, indicating failure." - "GetLastError returned %u.\n", - GetLastError()); - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail(""); - } - - /* Store the results in a ULONG64 */ - - SecondCreationTime = ( (((ULONG64)Creation.dwHighDateTime)<<32) | - ((ULONG64)Creation.dwLowDateTime)); - - SecondWrite = ( (((ULONG64)LastWrite.dwHighDateTime)<<32) | - ((ULONG64)LastWrite.dwLowDateTime)); - - SecondAccess = ((((ULONG64)LastAccess.dwHighDateTime)<<32) | - ((ULONG64)LastAccess.dwLowDateTime)); - - - /* Now -- to test. We'll ensure that the Second - LastWrite and access times are larger than the first. - It tells us that time is passing, which is good! - */ - - if(FirstWrite >= SecondWrite) - { - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("ERROR: The write-file-time (%I64d) after the first flush " - "should be less than the write-file-time (%I64d) after the second " - "flush.\n", - FirstWrite, - LastWrite); - - } - - - if(SecondAccess < FirstAccess) - { - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("ERROR: The access-file-time (%I64d) after the first flush " - "should be less than or equal to the access-file-time (%I64d) " - "after the second flush.\n", - FirstAccess, - LastAccess); - } - -#if WIN32 - /* Then we can check to make sure that the creation time - hasn't changed. This should always stay the same. - */ - - if(FirstCreationTime != SecondCreationTime) - { - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("ERROR: The creation time after writing should not " - "not change from the original. The second value should be " - "equal.\n"); - } -#else - /* Then we can check to make sure that the creation time - has changed. Under FreeBSD it changes whenever the file is - access or written. - */ - - if(FirstCreationTime >= SecondCreationTime) - { - /* Close the File */ - if(!CloseHandle(hFile)) - { - Trace("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - Fail("ERROR: The creation time after writing should be " - "greater than the original. The second value should be " - "larger.\n"); - } - -#endif - - /* Close the File */ - if(!CloseHandle(hFile)) - { - Fail("ERROR: Failed to close the file handle. " - "GetLastError returned %u.\n", - GetLastError()); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/file_io/GetFileTime/test7/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileTime/test7/testinfo.dat deleted file mode 100644 index 774f759adc..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileTime/test7/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileTime -Name = Positive Test for GetFileTime -TYPE = DEFAULT -EXE1 = getfiletime -Description -= Test the PAL implementation of GetFileTime. This test -= creates a file and compares create and write times after -= the buffers are flushed, but before the close, and verifies -= the results are as expected diff --git a/src/pal/tests/palsuite/file_io/GetFileType/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileType/CMakeLists.txt deleted file mode 100644 index 1962ade358..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test2) -add_subdirectory(test3) - diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileType/test1/CMakeLists.txt deleted file mode 100644 index c0acc6e484..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - GetFileType.cpp -) - -add_executable(paltest_getfiletype_test1 - ${SOURCES} -) - -add_dependencies(paltest_getfiletype_test1 coreclrpal) - -target_link_libraries(paltest_getfiletype_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test1/GetFileType.cpp b/src/pal/tests/palsuite/file_io/GetFileType/test1/GetFileType.cpp deleted file mode 100644 index 6558c00bdd..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test1/GetFileType.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: GetFileType.c (test 1) -** -** Purpose: Tests the PAL implementation of the GetFileType function. -** -** -**===================================================================*/ - -#include - -const char* szTextFile = "text.txt"; - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE hFile = NULL; - DWORD dwRc = 0; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - - /* test FILE_TYPE_UNKNOWN */ - dwRc = GetFileType(hFile); - if (dwRc != FILE_TYPE_UNKNOWN) - { - Fail("GetFileType: ERROR -> Was expecting a return type of " - "FILE_TYPE_UNKNOWN but the function returned %ld.\n", - dwRc); - } - - - /* create a test file */ - hFile = CreateFile(szTextFile, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(hFile == INVALID_HANDLE_VALUE) - { - Fail("GetFileType: ERROR -> Unable to create file \"%s\".\n", - szTextFile); - } - - dwRc = GetFileType(hFile); - if (CloseHandle(hFile) != TRUE) - { - Fail("GetFileType: ERROR -> Unable to close file \"%s\".\n", - szTextFile); - } - if (!DeleteFileA(szTextFile)) - { - Fail("GetFileType: ERROR -> Unable to delete file \"%s\".\n", - szTextFile); - } - - if (dwRc != FILE_TYPE_DISK) - { - Fail("GetFileType: ERROR -> Was expecting a return type of " - "FILE_TYPE_DISK but the function returned %ld.\n", - dwRc); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileType/test1/testinfo.dat deleted file mode 100644 index f12a81a20b..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileType -Name = Positive Test for GetFileType (test 1) -Type = DEFAULT -EXE1 = getfiletype -Description -= Test GetFileType on a NULL handle and a valid handle to a file - diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test2/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileType/test2/CMakeLists.txt deleted file mode 100644 index 1f2ee78f75..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test2/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - getfiletype.cpp -) - -add_executable(paltest_getfiletype_test2 - ${SOURCES} -) - -add_dependencies(paltest_getfiletype_test2 coreclrpal) - -target_link_libraries(paltest_getfiletype_test2 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test2/getfiletype.cpp b/src/pal/tests/palsuite/file_io/GetFileType/test2/getfiletype.cpp deleted file mode 100644 index c9d4eb6572..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test2/getfiletype.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: getfiletype.c -** -** Purpose: Test the PAL implementation of GetFileType to ensure it -** recognizes opened pipes. -** -** Depends: CreatePipe -** CloseHandle -** -** -**===================================================================*/ - -#include - - -int __cdecl main(int argc, char **argv) -{ - HANDLE hReadPipe = NULL; - HANDLE hWritePipe = NULL; - BOOL bRetVal = FALSE; - DWORD dwFileType; - SECURITY_ATTRIBUTES lpPipeAttributes; - - /*Initialize the PAL*/ - if ((PAL_Initialize(argc, argv)) != 0) - { - return (FAIL); - } - - /* - ** create a pipe and make sure GetFileType returns the correct value - */ - - /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/ - lpPipeAttributes.nLength = sizeof(lpPipeAttributes); - lpPipeAttributes.lpSecurityDescriptor = NULL; - lpPipeAttributes.bInheritHandle = TRUE; - - /*Create a Pipe*/ - bRetVal = CreatePipe(&hReadPipe, /* read handle*/ - &hWritePipe, /* write handle */ - &lpPipeAttributes, /* security attributes*/ - 0); /* pipe size*/ - if (bRetVal == FALSE) - { - Fail("ERROR: %u :Unable to create pipe.\n", GetLastError()); - } - - // Get the file type - dwFileType = GetFileType(hReadPipe); - if (dwFileType != FILE_TYPE_PIPE) - { - if (!CloseHandle(hWritePipe)) - { - Trace("ERROR: %u : Unable to close write pipe handle " - "hWritePipe=0x%lx\n", GetLastError(), hWritePipe); - } - if (!CloseHandle(hReadPipe)) - { - Trace("ERROR: %u : Unable to close read pipe handle " - "hReadPipe=0x%lx\n", GetLastError(), hReadPipe); - } - Fail("ERROR: GetFileType returned %u for a pipe instead of the " - "expected FILE_TYPE_PIPE (%u).\n", - dwFileType, - FILE_TYPE_PIPE); - } - - /*Close write pipe handle*/ - if (!CloseHandle(hWritePipe)) - { - if (!CloseHandle(hReadPipe)) - { - Trace("ERROR: %u : Unable to close read pipe handle " - "hReadPipe=0x%lx\n", GetLastError(), hReadPipe); - } - Fail("ERROR: %u : Unable to close write pipe handle " - "hWritePipe=0x%lx\n", GetLastError(), hWritePipe); - } - - /*Close Read pipe handle*/ - if (!CloseHandle(hReadPipe)) - { - Fail("ERROR: %u : Unable to close read pipe handle " - "hReadPipe=0x%lx\n", GetLastError(), hReadPipe); - } - - PAL_Terminate(); - return (PASS); -} diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test2/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileType/test2/testinfo.dat deleted file mode 100644 index eb1361d3f6..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test2/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileType -Name = Test for GetFileType -TYPE = DEFAULT -EXE1 = getfiletype -Description -= Test the PAL implementation of GetFileType to ensure it -= recognizes opened pipes. diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test3/CMakeLists.txt b/src/pal/tests/palsuite/file_io/GetFileType/test3/CMakeLists.txt deleted file mode 100644 index ed70e6c96c..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test3/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - getfiletype.cpp -) - -add_executable(paltest_getfiletype_test3 - ${SOURCES} -) - -add_dependencies(paltest_getfiletype_test3 coreclrpal) - -target_link_libraries(paltest_getfiletype_test3 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test3/getfiletype.cpp b/src/pal/tests/palsuite/file_io/GetFileType/test3/getfiletype.cpp deleted file mode 100644 index 6a95585bab..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test3/getfiletype.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: getfiletype.c -** -** Purpose: Test the PAL implementation of the GetFileType on a handle -** to a console. -** -** -**===================================================================*/ - -#include - - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE hFile; -#if WIN32 - char *lpFileName = "CONIN$"; -#else - char *lpFileName = "/dev/null"; -#endif - DWORD dwFileType; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* get a handle to the console */ - hFile = CreateFile(lpFileName, - GENERIC_READ, - FILE_SHARE_READ, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (hFile == INVALID_HANDLE_VALUE) - { - Fail("GetFileType: ERROR: CreateFile failed to open %s with " - "error %u.\n", - lpFileName, - GetLastError()); - } - - /* Get the file type */ - if ((dwFileType = GetFileType(hFile)) != FILE_TYPE_CHAR) - { - if (!CloseHandle(hFile)) - { - Trace("GetFileType: ERROR: %u : Unable to close the handle " - "hFile=0x%lx\n", GetLastError(), hFile); - } - Fail("GetFileType: ERROR: GetFileType returned %u for a device " - "instead of the expected FILE_TYPE_CHAR (%u).\n", - dwFileType, - FILE_TYPE_CHAR); - } - - if (!CloseHandle(hFile)) - { - Fail("GetFileType: ERROR: %u : Unable to close the handle " - "hFile=0x%lx\n", GetLastError(), hFile); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/GetFileType/test3/testinfo.dat b/src/pal/tests/palsuite/file_io/GetFileType/test3/testinfo.dat deleted file mode 100644 index 9ffd4c2b15..0000000000 --- a/src/pal/tests/palsuite/file_io/GetFileType/test3/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = GetFileType -Name = Test for GetFileTYpe -TYPE = DEFAULT -EXE1 = getfiletype -Description -= Test the PAL implementation of the GetFileType on a handle -= to a console. diff --git a/src/pal/tests/palsuite/file_io/GetStdHandle/test1/GetStdHandle.cpp b/src/pal/tests/palsuite/file_io/GetStdHandle/test1/GetStdHandle.cpp index f4fe03195d..47b1eba599 100644 --- a/src/pal/tests/palsuite/file_io/GetStdHandle/test1/GetStdHandle.cpp +++ b/src/pal/tests/palsuite/file_io/GetStdHandle/test1/GetStdHandle.cpp @@ -96,15 +96,6 @@ int __cdecl main(int argc, char *argv[]) GetLastError()); } - /* check if the file type is correct for the handle */ - if((dwFileType = GetFileType(hFile)) != FILE_TYPE_CHAR) - { - Fail("GetStdHandle: ERROR -> GetFileType returned %u for " - "STD_ERROR_HANDLE instead of the expected FILE_TYPE_CHAR (%u).\n", - dwFileType, - FILE_TYPE_CHAR); - } - /* check to see if we can CloseHandle works on the STD_ERROR_HANDLE */ if (!CloseHandle(hFile)) { diff --git a/src/pal/tests/palsuite/file_io/MoveFileA/CMakeLists.txt b/src/pal/tests/palsuite/file_io/MoveFileA/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileA/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/file_io/MoveFileA/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/MoveFileA/test1/CMakeLists.txt deleted file mode 100644 index b8f445b1e7..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileA/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - MoveFileA.cpp -) - -add_executable(paltest_movefilea_test1 - ${SOURCES} -) - -add_dependencies(paltest_movefilea_test1 coreclrpal) - -target_link_libraries(paltest_movefilea_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/MoveFileA/test1/ExpectedResults.txt b/src/pal/tests/palsuite/file_io/MoveFileA/test1/ExpectedResults.txt deleted file mode 100644 index 43b67af6b2..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileA/test1/ExpectedResults.txt +++ /dev/null @@ -1 +0,0 @@ -0101000001010000 \ No newline at end of file diff --git a/src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp b/src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp deleted file mode 100644 index 6d1337af03..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp +++ /dev/null @@ -1,469 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: MoveFileA.c -** -** Purpose: Tests the PAL implementation of the MoveFileA function. -** -** -**===================================================================*/ - -#include - -LPSTR lpSource[4] = {"src_existing.txt", - "src_non-existant.txt", - "src_dir_existing", - "src_dir_non-existant"}; -LPSTR lpDestination[4] = {"dst_existing.txt", - "dst_non-existant.txt", - "dst_dir_existing", - "dst_dir_non-existant"}; - - -/* Create all the required test files */ -int createExisting(void) -{ - FILE* tempFile = NULL; - DWORD dwError; - BOOL bRc = FALSE; - char szBuffer[100]; - - /* create the src_existing file */ - tempFile = fopen(lpSource[0], "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileA test file: src_existing.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create %s\n", lpSource[0]); - return FAIL; - } - - /* create the src_dir_existing directory and files */ - bRc = CreateDirectoryA(lpSource[2], NULL); - if (bRc != TRUE) - { - Trace("MoveFileA: ERROR: couldn't create \"%s\" because of " - "error code %ld\n", - lpSource[2], - GetLastError()); - return FAIL; - } - - memset(szBuffer, 0, 100); - sprintf_s(szBuffer, _countof(szBuffer), "%s/test01.txt", lpSource[2]); - tempFile = fopen(szBuffer, "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileA test file: %s\n", szBuffer); - fclose(tempFile); - } - else - { - Trace("ERROR[%ld]:MoveFileA couldn't create %s\n", GetLastError(), szBuffer); - return FAIL; - } - - memset(szBuffer, 0, 100); - sprintf_s(szBuffer, _countof(szBuffer), "%s/test02.txt", lpSource[2]); - tempFile = fopen(szBuffer, "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileA test file: %s\n", szBuffer); - fclose(tempFile); - } - else - { - Trace("ERROR[%ld]: couldn't create %s\n", GetLastError(), szBuffer); - return FAIL; - } - - - /* create the dst_existing file */ - tempFile = fopen(lpDestination[0], "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileA test file: dst_existing.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR[%ld]:MoveFileA couldn't create \"%s\"\n", GetLastError(), lpDestination[0]); - return FAIL; - } - - /* create the dst_dir_existing directory and files */ - bRc = CreateDirectoryA(lpDestination[2], NULL); - if (bRc != TRUE) - { - dwError = GetLastError(); - Trace("Error[%ld]:MoveFileA: couldn't create \"%s\"\n", GetLastError(), lpDestination[2]); - return FAIL; - } - - tempFile = fopen("dst_dir_existing/test01.txt", "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileA test file: dst_dir_existing/test01.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create dst_dir_existing/test01.txt\n"); - return FAIL; - } - tempFile = fopen("dst_dir_existing/test02.txt", "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileA test file: dst_dir_existing/test02.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR[%ul]: couldn't create dst_dir_existing/test02.txt\n", GetLastError()); - return FAIL; - } - - return PASS; -} - - - -void removeDirectoryHelper(LPSTR dir, int location) -{ - DWORD dwAtt = GetFileAttributesA(dir); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - if(!RemoveDirectoryA(dir)) - { - Fail("ERROR: Failed to remove Directory [%s], Error Code [%d], location [%d]\n", dir, GetLastError(), location); - } - } -} - -void removeFileHelper(LPSTR pfile, int location) -{ - FILE *fp; - fp = fopen( pfile, "r"); - - if (fp != NULL) - { - if(fclose(fp)) - { - Fail("ERROR: Failed to close the file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location); - } - - if(!DeleteFileA(pfile)) - { - Fail("ERROR: Failed to delete file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location); - } - else - { - // Trace("Success: deleted file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); - } - } - -} - - -/* remove all created files in preparation for the next test */ -void removeAll(void) -{ - char szTemp[40]; - DWORD dwAtt; - - /* get rid of source dirs and files */ - removeFileHelper(lpSource[0], 1); - removeFileHelper(lpSource[1], 2); - - dwAtt = GetFileAttributesA(lpSource[2]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[2]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[2]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpSource[2], 103); - } - else - { - removeFileHelper(lpSource[2], 17); - } - - - dwAtt = GetFileAttributesA(lpSource[3]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[3]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[3]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpSource[3], 103); - } - else - { - removeFileHelper(lpSource[3], 17); - } - - /* get rid of destination dirs and files */ - dwAtt = GetFileAttributesA(lpDestination[0]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[0]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[0]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[0], 103); - } - else - { - removeFileHelper(lpDestination[0], 17); - } - - dwAtt = GetFileAttributesA(lpDestination[1]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[1]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[1]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[1], 103); - } - else - { - removeFileHelper(lpDestination[1], 17); - } - - dwAtt = GetFileAttributesA(lpDestination[2]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[2]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[2]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[2], 103); - } - else - { - removeFileHelper(lpDestination[2], 17); - } - - dwAtt = GetFileAttributesA(lpDestination[3]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[3]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[3]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[3], 103); - } - else - { - removeFileHelper(lpDestination[3], 17); - } - -} - - - - - -int __cdecl main(int argc, char *argv[]) -{ - BOOL bRc = TRUE; - BOOL bSuccess = TRUE; - char results[40]; - FILE* resultsFile = NULL; - int nCounter = 0; - int i, j; - char tempSource[] = {'t','e','m','p','k','.','t','m','p','\0'}; - char tempDest[] = {'t','e','m','p','2','.','t','m','p','\0'}; - HANDLE hFile; - DWORD result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* read in the expected results to compare with actual results */ - memset (results, 0, 20); - resultsFile = fopen("expectedresults.txt", "r"); - if (resultsFile == NULL) - { - Fail("MoveFileA ERROR[%ul]: Unable to open \"expectedresults.txt\"\n", GetLastError()); - } - - fgets(results, 20, resultsFile); - fclose(resultsFile); - - /* clean the slate */ - removeAll(); - - if (createExisting() != 0) - { - removeAll(); - } - - - /* lpSource loop */ - for (i = 0; i < 4; i++) - { - /* lpDestination loop */ - for (j = 0; j < 4; j++) - { - bRc = MoveFileA(lpSource[i], lpDestination[j]); - if (!( - ((bRc == TRUE) && (results[nCounter] == '1')) - || - ((bRc == FALSE ) && (results[nCounter] == '0')) ) - ) - { - Trace("MoveFileA: FAILED: test[%d][%d]: \"%s\" -> \"%s\"\n", - i, j, lpSource[i], lpDestination[j]); - bSuccess = FALSE; - } - - /* undo the last move */ - removeAll(); - createExisting(); - - nCounter++; - } - } - - removeAll(); - if (bSuccess == FALSE) - { - Fail("MoveFileA: Test Failed"); - } - - /* create the temp source file */ - hFile = CreateFileA(tempSource, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, 0); - - if( hFile == INVALID_HANDLE_VALUE ) - { - Fail("Error[%ul]:MoveFileA: CreateFile failed to " - "create the file correctly.\n", GetLastError()); - } - - bRc = CloseHandle(hFile); - if(!bRc) - { - Trace("MoveFileA: CloseHandle failed to close the " - "handle correctly. ERROR:%u\n",GetLastError()); - - /* delete the created file */ - bRc = DeleteFileA(tempSource); - if(!bRc) - { - Fail("Error[%ul]:MoveFileA: DeleteFileA failed to delete the" - "file correctly.\n", GetLastError()); - } - Fail(""); - } - - /* set the file attributes to be readonly */ - bRc = SetFileAttributesA(tempSource, FILE_ATTRIBUTE_READONLY); - if(!bRc) - { - Trace("MoveFileA: SetFileAttributes failed to set file " - "attributes correctly. GetLastError returned %u\n",GetLastError()); - /* delete the created file */ - bRc = DeleteFileA(tempSource); - if(!bRc) - { - Fail("Error[%ul]:MoveFileA: DeleteFileA failed to delete the" - "file correctly.\n", GetLastError()); - } - Fail(""); - } - - /* move the file to the new location */ - bRc = MoveFileA(tempSource, tempDest); - if(!bRc) - { - /* delete the created file */ - bRc = DeleteFileA(tempSource); - if(!bRc) - { - Fail("Error[%ul]:MoveFileA: DeleteFileA failed to delete the" - "file correctly.\n", GetLastError()); - } - - Fail("Error[%ul]:MoveFileA(%S, %S): GetFileAttributes " - "failed to get the file's attributes.\n", - GetLastError(), tempSource, tempDest); - } - - /* check that the newly moved file has the same file attributes - as the original */ - result = GetFileAttributesA(tempDest); - if(result == 0) - { - /* delete the created file */ - bRc = DeleteFileA(tempDest); - if(!bRc) - { - Fail("Error[%ul]:MoveFileA: DeleteFileA failed to delete the" - "file correctly.\n", GetLastError()); - } - - Fail("Error[%ul]:MoveFileA: GetFileAttributes failed to get " - "the file's attributes.\n", GetLastError()); - } - - if((result & FILE_ATTRIBUTE_READONLY) != FILE_ATTRIBUTE_READONLY) - { - /* delete the newly moved file */ - bRc = DeleteFileA(tempDest); - if(!bRc) - { - Fail("Error[%ul]:MoveFileA: DeleteFileA failed to delete the" - "file correctly.\n", GetLastError()); - } - - Fail("Error[%ul]MoveFileA: GetFileAttributes failed to get " - "the correct file attributes.\n", GetLastError()); - } - - /* set the file attributes back to normal, to be deleted */ - bRc = SetFileAttributesA(tempDest, FILE_ATTRIBUTE_NORMAL); - if(!bRc) - { - /* delete the newly moved file */ - bRc = DeleteFileA(tempDest); - if(!bRc) - { - Fail("Error[%ul]:MoveFileA: DeleteFileA failed to delete the" - "file correctly.\n", GetLastError()); - } - - Fail("Error[%ul]:MoveFileA: SetFileAttributes failed to set " - "file attributes correctly.\n", GetLastError()); - } - - /* delete the newly moved file */ - bRc = DeleteFileA(tempDest); - if(!bRc) - { - Fail("Error[%ul]:MoveFileA: DeleteFileA failed to delete the" - "file correctly.\n", GetLastError()); - } - - PAL_Terminate(); - - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/MoveFileA/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/MoveFileA/test1/testinfo.dat deleted file mode 100644 index 685072fcd9..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileA/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = MoveFileA -Name = Positive Test for MoveFileA -TYPE = DEFAULT -EXE1 = movefilea -Description -=Performs a number of MoveFileA tests and uses the -=file ExpectedResults.txt to determine if the test passed/failed diff --git a/src/pal/tests/palsuite/file_io/MoveFileW/CMakeLists.txt b/src/pal/tests/palsuite/file_io/MoveFileW/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileW/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/file_io/MoveFileW/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/MoveFileW/test1/CMakeLists.txt deleted file mode 100644 index 03b7ab907c..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileW/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - MoveFileW.cpp -) - -add_executable(paltest_movefilew_test1 - ${SOURCES} -) - -add_dependencies(paltest_movefilew_test1 coreclrpal) - -target_link_libraries(paltest_movefilew_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/MoveFileW/test1/ExpectedResults.txt b/src/pal/tests/palsuite/file_io/MoveFileW/test1/ExpectedResults.txt deleted file mode 100644 index 43b67af6b2..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileW/test1/ExpectedResults.txt +++ /dev/null @@ -1 +0,0 @@ -0101000001010000 \ No newline at end of file diff --git a/src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp b/src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp deleted file mode 100644 index 8a7fae5983..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp +++ /dev/null @@ -1,478 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: MoveFileW.c -** -** Purpose: Tests the PAL implementation of the MoveFileW function. -** -** -**===================================================================*/ - -#include - -LPSTR lpSource[4] = {"src_existing.txt", - "src_non-existant.txt", - "src_dir_existing", - "src_dir_non-existant"}; -LPSTR lpDestination[4] = {"dst_existing.txt", - "dst_non-existant.txt", - "dst_dir_existing", - "dst_dir_non-existant"}; - - -/* Create all the required test files */ -int createExisting(void) -{ - FILE* tempFile = NULL; - DWORD dwError; - BOOL bRc = FALSE; - WCHAR* wPtr = NULL; - char szBuffer[100]; - - /* create the src_existing file */ - tempFile = fopen(lpSource[0], "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFile test file: src_existing.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create %s\n", lpSource[0]); - return FAIL; - } - - /* create the src_dir_existing directory and files */ - wPtr = convert(lpSource[2]); - bRc = CreateDirectoryW(wPtr, NULL); - free(wPtr); - if (bRc != TRUE) - { - Trace("MoveFileW: ERROR: couldn't create \"%s\" because of " - "error code %ld\n", - lpSource[2], - GetLastError()); - return FAIL; - } - - memset(szBuffer, 0, 100); - sprintf_s(szBuffer, _countof(szBuffer), "%s/test01.txt", lpSource[2]); - tempFile = fopen(szBuffer, "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileW test file: %s\n", szBuffer); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create %s\n", szBuffer); - return FAIL; - } - - memset(szBuffer, 0, 100); - sprintf_s(szBuffer, _countof(szBuffer), "%s/test02.txt", lpSource[2]); - tempFile = fopen(szBuffer, "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileW test file: %s\n", szBuffer); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create %s\n", szBuffer); - return FAIL; - } - - - /* create the dst_existing file */ - tempFile = fopen(lpDestination[0], "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileW test file: dst_existing.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create \"%s\"\n", lpDestination[0]); - return FAIL; - } - - /* create the dst_dir_existing directory and files */ - wPtr = convert(lpDestination[2]); - bRc = CreateDirectoryW(wPtr, NULL); - free(wPtr); - if (bRc != TRUE) - { - dwError = GetLastError(); - Trace("MoveFileW: ERROR: couldn't create \"%s\"\n", lpDestination[2]); - return FAIL; - } - - tempFile = fopen("dst_dir_existing/test01.txt", "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileW test file: dst_dir_existing/test01.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create dst_dir_existing/test01.txt\n"); - return FAIL; - } - tempFile = fopen("dst_dir_existing/test02.txt", "w"); - if (tempFile != NULL) - { - fprintf(tempFile, "MoveFileW test file: dst_dir_existing/test02.txt\n"); - fclose(tempFile); - } - else - { - Trace("ERROR: couldn't create dst_dir_existing/test02.txt\n"); - return FAIL; - } - - return PASS; -} - -void removeDirectoryHelper(LPSTR dir, int location) -{ - DWORD dwAtt = GetFileAttributesA(dir); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - if(!RemoveDirectoryA(dir)) - { - Fail("ERROR: Failed to remove Directory [%s], Error Code [%d], location [%d]\n", dir, GetLastError(), location); - } - } -} - -void removeFileHelper(LPSTR pfile, int location) -{ - FILE *fp; - fp = fopen( pfile, "r"); - - if (fp != NULL) - { - if(fclose(fp)) - { - Fail("ERROR: Failed to close the file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location); - } - - if(!DeleteFileA(pfile)) - { - Fail("ERROR: Failed to delete file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location); - } - else - { - // Trace("Success: deleted file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); - } - } - -} - -/* remove all created files in preparation for the next test */ -void removeAll(void) -{ - char szTemp[40]; - DWORD dwAtt; - - /* get rid of source dirs and files */ - removeFileHelper(lpSource[0], 1); - removeFileHelper(lpSource[1], 2); - - dwAtt = GetFileAttributesA(lpSource[2]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[2]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[2]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpSource[2], 103); - } - else - { - removeFileHelper(lpSource[2], 17); - } - - - dwAtt = GetFileAttributesA(lpSource[3]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[3]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[3]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpSource[3], 103); - } - else - { - removeFileHelper(lpSource[3], 17); - } - - /* get rid of destination dirs and files */ - dwAtt = GetFileAttributesA(lpDestination[0]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[0]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[0]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[0], 103); - } - else - { - removeFileHelper(lpDestination[0], 17); - } - - dwAtt = GetFileAttributesA(lpDestination[1]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[1]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[1]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[1], 103); - } - else - { - removeFileHelper(lpDestination[1], 17); - } - - dwAtt = GetFileAttributesA(lpDestination[2]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[2]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[2]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[2], 103); - } - else - { - removeFileHelper(lpDestination[2], 17); - } - - dwAtt = GetFileAttributesA(lpDestination[3]); - if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) - { - sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[3]); - removeFileHelper(szTemp, 18); - - sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[3]); - removeFileHelper(szTemp, 19); - removeDirectoryHelper(lpDestination[3], 103); - } - else - { - removeFileHelper(lpDestination[3], 17); - } - -} - - - - - -int __cdecl main(int argc, char *argv[]) -{ - BOOL bRc = TRUE; - BOOL bSuccess = TRUE; - char results[40]; - FILE* resultsFile = NULL; - int nCounter = 0; - int i, j; - WCHAR* wSource = NULL; - WCHAR* wDest = NULL; - WCHAR tempSource[] = {'t','e','m','p','k','.','t','m','p','\0'}; - WCHAR tempDest[] = {'t','e','m','p','2','.','t','m','p','\0'}; - HANDLE hFile; - DWORD result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* read in the expected results to compare with actual results */ - memset (results, 0, 20); - resultsFile = fopen("expectedresults.txt", "r"); - if (resultsFile == NULL) - { - Fail("MoveFileW ERROR: Unable to open \"expectedresults.txt\"\n"); - } - - fgets(results, 20, resultsFile); - fclose(resultsFile); - - /* clean the slate */ - removeAll(); - - if (createExisting() != 0) - { - removeAll(); - } - - - /* lpSource loop */ - for (i = 0; i < 4; i++) - { - /* lpDestination loop */ - for (j = 0; j < 4; j++) - { - - wSource = convert(lpSource[i]); - wDest = convert(lpDestination[j]); - bRc = MoveFileW(wSource, wDest); - free(wSource); - free(wDest); - if (!( - ((bRc == TRUE) && (results[nCounter] == '1')) - || - ((bRc == FALSE ) && (results[nCounter] == '0')) ) - ) - { - Trace("MoveFileW: FAILED: test[%d][%d]: \"%s\" -> \"%s\"\n", - i, j, lpSource[i], lpDestination[j]); - bSuccess = FALSE; - } - - /* undo the last move */ - removeAll(); - createExisting(); - - nCounter++; - } - } - - removeAll(); - if (bSuccess == FALSE) - { - Fail("MoveFileW: Test Failed"); - } - - /* create the temp source file */ - hFile = CreateFileW(tempSource, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, 0); - - if( hFile == INVALID_HANDLE_VALUE ) - { - Fail("MoveFileW: CreateFile failed to " - "create the file correctly.\n"); - } - - bRc = CloseHandle(hFile); - if(!bRc) - { - Trace("MoveFileW: CloseHandle failed to close the " - "handle correctly. ERROR:%u\n",GetLastError()); - - /* delete the created file */ - bRc = DeleteFileW(tempSource); - if(!bRc) - { - Fail("MoveFileW: DeleteFileW failed to delete the" - "file correctly.\n"); - } - Fail(""); - } - - /* set the file attributes to be readonly */ - bRc = SetFileAttributesW(tempSource, FILE_ATTRIBUTE_READONLY); - if(!bRc) - { - Trace("MoveFileW: SetFileAttributes failed to set file " - "attributes correctly. GetLastError returned %u\n",GetLastError()); - /* delete the created file */ - bRc = DeleteFileW(tempSource); - if(!bRc) - { - Fail("MoveFileW: DeleteFileW failed to delete the" - "file correctly.\n"); - } - Fail(""); - } - - /* move the file to the new location */ - bRc = MoveFileW(tempSource, tempDest); - if(!bRc) - { - /* delete the created file */ - bRc = DeleteFileW(tempSource); - if(!bRc) - { - Fail("MoveFileW: DeleteFileW failed to delete the" - "file correctly.\n"); - } - - Fail("MoveFileW(%S, %S): GetFileAttributes " - "failed to get the file's attributes.\n", - tempSource, tempDest); - } - - /* check that the newly moved file has the same file attributes - as the original */ - result = GetFileAttributesW(tempDest); - if(result == 0) - { - /* delete the created file */ - bRc = DeleteFileW(tempDest); - if(!bRc) - { - Fail("MoveFileW: DeleteFileW failed to delete the" - "file correctly.\n"); - } - - Fail("MoveFileW: GetFileAttributes failed to get " - "the file's attributes.\n"); - } - - if((result & FILE_ATTRIBUTE_READONLY) != FILE_ATTRIBUTE_READONLY) - { - /* delete the newly moved file */ - bRc = DeleteFileW(tempDest); - if(!bRc) - { - Fail("MoveFileW: DeleteFileW failed to delete the" - "file correctly.\n"); - } - - Fail("MoveFileW: GetFileAttributes failed to get " - "the correct file attributes.\n"); - } - - /* set the file attributes back to normal, to be deleted */ - bRc = SetFileAttributesW(tempDest, FILE_ATTRIBUTE_NORMAL); - if(!bRc) - { - /* delete the newly moved file */ - bRc = DeleteFileW(tempDest); - if(!bRc) - { - Fail("MoveFileW: DeleteFileW failed to delete the" - "file correctly.\n"); - } - - Fail("MoveFileW: SetFileAttributes failed to set " - "file attributes correctly.\n"); - } - - /* delete the newly moved file */ - bRc = DeleteFileW(tempDest); - if(!bRc) - { - Fail("MoveFileW: DeleteFileW failed to delete the" - "file correctly.\n"); - } - - PAL_Terminate(); - - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/MoveFileW/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/MoveFileW/test1/testinfo.dat deleted file mode 100644 index 8852a03ca2..0000000000 --- a/src/pal/tests/palsuite/file_io/MoveFileW/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = MoveFileW -Name = Positive Test for MoveFileW -TYPE = DEFAULT -EXE1 = movefilew -Description -=Performs a number of MoveFileW tests and uses the -=file ExpectedResults.txt to determine if the test passed/failed diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/CMakeLists.txt b/src/pal/tests/palsuite/file_io/SetFileTime/CMakeLists.txt deleted file mode 100644 index a3847f8ca9..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) - diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test1/CMakeLists.txt b/src/pal/tests/palsuite/file_io/SetFileTime/test1/CMakeLists.txt deleted file mode 100644 index e9d8dce966..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - SetFileTime.cpp -) - -add_executable(paltest_setfiletime_test1 - ${SOURCES} -) - -add_dependencies(paltest_setfiletime_test1 coreclrpal) - -target_link_libraries(paltest_setfiletime_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test1/SetFileTime.cpp b/src/pal/tests/palsuite/file_io/SetFileTime/test1/SetFileTime.cpp deleted file mode 100644 index 4711aeba89..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test1/SetFileTime.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: SetFileTime.c -** -** Purpose: Tests the PAL implementation of the SetFileTime function. -** This test first sets a valid file time on the file which is opened. -** Then it calls GetFileTime, and compares the values. They should -** be the same. Note: Access time isn't checked in this test. It will -** be dealt with seperatly due to odd behaviour. -** -** Depends: -** CreateFile -** GetFileTime -** -** -**===================================================================*/ - -#include - -int __cdecl main(int argc, char **argv) -{ - -#if WIN32 - FILETIME Creation; - FILETIME SetCreation; -#endif - FILETIME LastWrite; - FILETIME SetLastWrite; - HANDLE TheFileHandle; - BOOL result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Populate some FILETIME structures with values - These values are valid Creation, Access and Write times - which I generated, and should work properly. - */ -#if WIN32 - SetCreation.dwLowDateTime = 458108416; - SetCreation.dwHighDateTime = 29436904; -#endif - - SetLastWrite.dwLowDateTime = -1995099136; - SetLastWrite.dwHighDateTime = 29436915; - - - /* Open the file to get a HANDLE */ - TheFileHandle = CreateFile("the_file", - GENERIC_READ|GENERIC_WRITE, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the file. The error number " - "returned was %d.\n",GetLastError()); - } - - /* Set the new file time */ -#if WIN32 - result = SetFileTime(TheFileHandle, - &SetCreation, NULL, &SetLastWrite); -#else - result = SetFileTime(TheFileHandle, - NULL, NULL, &SetLastWrite); -#endif - if(result == 0) - { - Fail("ERROR: SetFileTime failed when trying to set the " - "new file time. The GetLastError was %d.\n",GetLastError()); - } - - - /* Then get the file time of the file */ -#if WIN32 - result = GetFileTime(TheFileHandle, &Creation, NULL, &LastWrite); -#else - result = GetFileTime(TheFileHandle, NULL, NULL, &LastWrite); -#endif - - if(result == 0) - { - Fail("ERROR: GetFileTime failed, and this tests depends " - "upon it working properly, in order to ensure that the " - "file time was set with SetFileTime. GetLastError() " - "returned %d.\n",GetLastError()); - } - - /* Compare the write time we Set to the write time aquired with - Get. They should be the same. - */ - - if(LastWrite.dwLowDateTime != SetLastWrite.dwLowDateTime || - LastWrite.dwHighDateTime != SetLastWrite.dwHighDateTime) - { - Fail("ERROR: After setting the write time, it is not " - "equal to what it was set to. Either Set of GetFileTime are " - "broken.\n"); - } - - /* Within FreeBSD, the Creation time is ignored when SetFileTime - is called. Since FreeBSD has no equivalent. For that reason, - it is not checked with the following test. - */ - -#if WIN32 - if(Creation.dwHighDateTime != SetCreation.dwHighDateTime || - Creation.dwLowDateTime != SetCreation.dwLowDateTime) - { - Fail("ERROR: After setting the file time, the Creation " - "time is not what it should be. Either Set or GetFileTime " - "are broken."); - } -#endif - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test1/testinfo.dat b/src/pal/tests/palsuite/file_io/SetFileTime/test1/testinfo.dat deleted file mode 100644 index 09dfa0b623..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test1/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = SetFileTime -Name = Positive Test for SetFileTime -TYPE = DEFAULT -EXE1 = setfiletime -Description -= Test the SetFileTime function. -= This test calls SetFileTime and sets a file to a given time. It then -= calls GetFileTime, and compares the values of the two, which should be -= equal diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test2/CMakeLists.txt b/src/pal/tests/palsuite/file_io/SetFileTime/test2/CMakeLists.txt deleted file mode 100644 index 12ec26c9f8..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test2/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - SetFileTime.cpp -) - -add_executable(paltest_setfiletime_test2 - ${SOURCES} -) - -add_dependencies(paltest_setfiletime_test2 coreclrpal) - -target_link_libraries(paltest_setfiletime_test2 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test2/SetFileTime.cpp b/src/pal/tests/palsuite/file_io/SetFileTime/test2/SetFileTime.cpp deleted file mode 100644 index e950153bb0..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test2/SetFileTime.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: SetFileTime.c -** -** Purpose: Tests the PAL implementation of the SetFileTime -** This test first tries to SetFileTime on a HANDLE which doesn't have -** GENERIC_WRITE set, which should fail. -** -** -** Depends: -** CreateFile -** CloseHandle -** -** -**===================================================================*/ - -#include - - - - -int __cdecl main(int argc, char **argv) -{ - - FILETIME SetCreation,SetLastAccess,SetLastWrite; - HANDLE TheFileHandle; - BOOL result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Populate some FILETIME structures with values - These values are valid Creation, Access and Write times - which I generated, and should work properly. - - The access times are not seperated into WIN32 and FreeBSD here, - but it should be fine, as no comparisons are being done in this - test. - */ - - SetCreation.dwLowDateTime = 458108416; - SetCreation.dwHighDateTime = 29436904; - - SetLastAccess.dwLowDateTime = 341368832; - SetLastAccess.dwHighDateTime = 29436808; - - SetLastWrite.dwLowDateTime = -1995099136; - SetLastWrite.dwHighDateTime = 29436915; - - -/* Open the file to get a HANDLE, without GENERIC WRITE */ - - TheFileHandle = - CreateFile( - "the_file", - GENERIC_READ, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the file. The error number " - "returned was %d.",GetLastError()); - } - - /* This SetFileTime should fail, because the HANDLE isn't set with - GENERIC_WRITE - */ - result = SetFileTime(TheFileHandle, - &SetCreation,&SetLastAccess,&SetLastWrite); - - if(result != 0) - { - Fail("ERROR: SetFileTime should have failed, but returned a " - "non-zero result. The File HANDLE passed was no set Writable " - "which should cause failure."); - } - - result = CloseHandle(TheFileHandle); - - if(result == 0) - { - Fail("ERROR: CloseHandle failed. This test depends upon " - "it working."); - } - - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test2/testinfo.dat b/src/pal/tests/palsuite/file_io/SetFileTime/test2/testinfo.dat deleted file mode 100644 index f1699facaf..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test2/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = SetFileTime -Name = Negative Test for SetFileTime -TYPE = DEFAULT -EXE1 = setfiletime -Description -= Test the SetFileTime function. -= This test first tries to SetFileTime on a HANDLE which doesn't have -= GENERIC_WRITE set, which should fail. Then it attempts to set the file -= time with bad FILETIME structures, which should also fail diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test3/CMakeLists.txt b/src/pal/tests/palsuite/file_io/SetFileTime/test3/CMakeLists.txt deleted file mode 100644 index ca0ed659f5..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test3/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - SetFileTime.cpp -) - -add_executable(paltest_setfiletime_test3 - ${SOURCES} -) - -add_dependencies(paltest_setfiletime_test3 coreclrpal) - -target_link_libraries(paltest_setfiletime_test3 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test3/SetFileTime.cpp b/src/pal/tests/palsuite/file_io/SetFileTime/test3/SetFileTime.cpp deleted file mode 100644 index 97f49495d7..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test3/SetFileTime.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: SetFileTime.c -** -** Purpose: Tests the PAL implementation of the SetFileTime function. -** This test checks to ensure that the function fails when passed an -** invalid file HANDLE -** -** -**===================================================================*/ - - - -#include - - - - -int __cdecl main(int argc, char **argv) -{ - - FILETIME SetCreation, SetLastWrite, SetLastAccess; - HANDLE TheFileHandle = NULL; - BOOL result; - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Populate some FILETIME structures with values - These values are valid Creation, Access and Write times - which I generated, and should work properly. - */ - - SetCreation.dwLowDateTime = 458108416; - SetCreation.dwHighDateTime = 29436904; - - SetLastAccess.dwLowDateTime = 341368832; - SetLastAccess.dwHighDateTime = 29436808; - - SetLastWrite.dwLowDateTime = -1995099136; - SetLastWrite.dwHighDateTime = 29436915; - - - /* Pass this function an invalid file HANDLE and it should - fail. - */ - - result = SetFileTime(TheFileHandle, - &SetCreation,&SetLastAccess,&SetLastWrite); - - if(result != 0) - { - Fail("ERROR: Passed an invalid file HANDLE to SetFileTime, but it " - "returned non-zero. This should return zero for failure."); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test3/testinfo.dat b/src/pal/tests/palsuite/file_io/SetFileTime/test3/testinfo.dat deleted file mode 100644 index e27280469e..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test3/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = SetFileTime -Name = Negative Test for SetFileTime -TYPE = DEFAULT -EXE1 = setfiletime -Description -= Test the SetFileTime function. -= This test checks to ensure that the function fails when passed an -= invalid file HANDLE diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test4/CMakeLists.txt b/src/pal/tests/palsuite/file_io/SetFileTime/test4/CMakeLists.txt deleted file mode 100644 index 432ebe594f..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test4/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - SetFileTime.cpp -) - -add_executable(paltest_setfiletime_test4 - ${SOURCES} -) - -add_dependencies(paltest_setfiletime_test4 coreclrpal) - -target_link_libraries(paltest_setfiletime_test4 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test4/SetFileTime.cpp b/src/pal/tests/palsuite/file_io/SetFileTime/test4/SetFileTime.cpp deleted file mode 100644 index 3edd2403c4..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test4/SetFileTime.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: SetFileTime.c -** -** Purpose: Tests the PAL implementation of the SetFileTime function -** This passes a variety of NULL values as parameters to the function. -** It should still succeed. -** -** Depends: -** CreateFile -** - -** -**===================================================================*/ - -#include - - - -int __cdecl main(int argc, char **argv) -{ -#if WIN32 - FILETIME Creation; -#endif - FILETIME LastWrite,LastAccess; - HANDLE TheFileHandle; - - - if (0 != PAL_Initialize(argc,argv)) - { - return FAIL; - } - - /* Populate some FILETIME structures with values - These values are valid Creation, Access and Write times - which I generated, and should work properly. - - These values aren't being used for comparison, so they should - work ok, even though they weren't generated specifically for - FreeBSD or WIN32 ... - */ -#if WIN32 - Creation.dwLowDateTime = 458108416; - Creation.dwHighDateTime = 29436904; -#endif - LastAccess.dwLowDateTime = 341368832; - LastAccess.dwHighDateTime = 29436808; - - LastWrite.dwLowDateTime = -1995099136; - LastWrite.dwHighDateTime = 29436915; - - /* Open the file to get a HANDLE */ - TheFileHandle = - CreateFile( - "the_file", - GENERIC_READ|GENERIC_WRITE, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - - if(TheFileHandle == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Failed to open the file. The error number " - "returned was %d.",GetLastError()); - } - - /* Pass all NULLs, this is useless but should still work. */ - if(SetFileTime(TheFileHandle,NULL,NULL,NULL)==0) - { - Fail("ERROR: SetFileTime returned 0, indicating failure. " - "Three of the params were NULL in this case, did they " - "cause the problem?"); - } - -#if WIN32 - /* Set the Creation time of the File */ - if(SetFileTime(TheFileHandle,&Creation,NULL,NULL)==0) - { - Fail("ERROR: SetFileTime returned 0, indicating failure. " - "Two of the params were NULL in this case, did they " - "cause the problem?"); - } -#endif - -#if WIN32 - /* Set the Creation, LastWrite time of the File */ - if(SetFileTime(TheFileHandle,&Creation,&LastWrite,NULL)==0) -#else - /* Set the LastWrite time of the File */ - if(SetFileTime(TheFileHandle,NULL,&LastWrite,NULL)==0) -#endif - { - Fail("ERROR: SetFileTime returned 0, indicating failure. " - "One of the params were NULL in this case, did it " - "cause the problem?"); - } - - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/file_io/SetFileTime/test4/testinfo.dat b/src/pal/tests/palsuite/file_io/SetFileTime/test4/testinfo.dat deleted file mode 100644 index a3dfdd02f0..0000000000 --- a/src/pal/tests/palsuite/file_io/SetFileTime/test4/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = file_io -Function = SetFileTime -Name = Positive Test for SetFileTime -TYPE = DEFAULT -EXE1 = setfiletime -Description -= Test the SetFileTime function. -= This passes a variety of NULL values as parameters to the function. -= It should still succeed diff --git a/src/pal/tests/palsuite/file_io/errorpathnotfound/CMakeLists.txt b/src/pal/tests/palsuite/file_io/errorpathnotfound/CMakeLists.txt index a3847f8ca9..1962ade358 100644 --- a/src/pal/tests/palsuite/file_io/errorpathnotfound/CMakeLists.txt +++ b/src/pal/tests/palsuite/file_io/errorpathnotfound/CMakeLists.txt @@ -3,5 +3,4 @@ cmake_minimum_required(VERSION 2.8.12.2) add_subdirectory(test1) add_subdirectory(test2) add_subdirectory(test3) -add_subdirectory(test4) diff --git a/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/test2.cpp b/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/test2.cpp index 5c2ab86b99..b9177ece4e 100644 --- a/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/test2.cpp +++ b/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/test2.cpp @@ -18,7 +18,7 @@ ** Functions covered by this test are: -** MoveFileW, FindFirstFileA, FindFirstFileW, +** FindFirstFileA, FindFirstFileW, ** GetFileAttributesA, GetFileAttributesW, @@ -95,80 +95,6 @@ int __cdecl main(int argc, char *argv[]) - /*...................Test MoveFileW.............................*/ - - - - /* test with an invalid path */ - - bRc = MoveFileW(wBadFilePath,wDest); - - if(!bRc) - - { - - if(GetLastError()!= ERROR_PATH_NOT_FOUND) - - { - - Trace("MoveFileW: calling GetLastError() after moving a file" - - " with wrong path returned [%u] while it should return [%u]\n" - - ,GetLastError(), ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - testPass = FALSE; - - } - - - - /* test with invalid file name */ - - bRc = MoveFileW(wBadFileName,wDest); - - if(!bRc) - - { - - if(GetLastError()!= ERROR_FILE_NOT_FOUND) - - { - - Trace("MoveFileW: calling GetLastError() after moving a file" - - " with wrong name returned [%u] while it should return [%u]\n" - - ,GetLastError(), ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("MoveFileW: managed to move a file with wrong name\n"); - - testPass = FALSE; - - } - - - /*............. Test FindFirstFileA..................................*/ diff --git a/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/testinfo.dat b/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/testinfo.dat index c5a61b949a..ddc5081c11 100644 --- a/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/testinfo.dat +++ b/src/pal/tests/palsuite/file_io/errorpathnotfound/test2/testinfo.dat @@ -26,7 +26,7 @@ Description = Functions covered by this test are: -= MoveFileW, FindFirstFileA, FindFirstFileW, += FindFirstFileA, FindFirstFileW, = GetFileAttributesA, GetFileAttributesW, diff --git a/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/CMakeLists.txt b/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/CMakeLists.txt deleted file mode 100644 index 00621296d0..0000000000 --- a/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.cpp -) - -add_executable(paltest_errorpathnotfound_test4 - ${SOURCES} -) - -add_dependencies(paltest_errorpathnotfound_test4 coreclrpal) - -target_link_libraries(paltest_errorpathnotfound_test4 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/test4.cpp b/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/test4.cpp deleted file mode 100644 index e1b68995b0..0000000000 --- a/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/test4.cpp +++ /dev/null @@ -1,351 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== - -** - -** Source: test4.c - -** - -** Purpose: Test the return value of GetLastError() after calling - -** some file_io functions with an invalid path. - -** - -** Functions covered by this test are: - -** GetDiskFreeSpaceW, GetTempFileNameA - -** and GetTempFileNameW - -** -** - -** - - - -** - -**===================================================================*/ - - - -#include - - - -int __cdecl main(int argc, char *argv[]) - -{ - - - - BOOL testPass = TRUE; - - BOOL bRc = TRUE; - - DWORD lastErr=-50; - - DWORD dwSectorsPerCluster_02; /* sectors per cluster */ - - DWORD dwBytesPerSector_02; /* bytes per sector */ - - DWORD dwNumberOfFreeClusters; /* free clusters */ - - DWORD dwTotalNumberOfClusters; /* total clusters */ - - - - UINT uiError = 0; - - char szReturnedName[256]; - - const UINT uUnique = 0; - - const char* sDot = {"tmpr"}; - - const char* sPrefix = {"cfr"}; - - - - WCHAR wzReturnedName[256]; - - const WCHAR wDot[] = {'t','m','p','r','\0'}; - - const WCHAR wPrefix[] = {'c','f','r','\0'}; - - - - - - const WCHAR wBadFilePath[] = - - {'w','b','a','d','/','b','a', - - 'd','.','t','m','p','\0'}; - - const WCHAR wBadFileName[] = - - {'w','B','a','d','.','t','m','p','\0'}; - - - - - - - - if (0 != PAL_Initialize(argc,argv)) - - { - - return FAIL; - - } - - - - /* test .................. GetDiskFreeSpaceW .................. */ - - - - /* test with invalid file name */ - - bRc = GetDiskFreeSpaceW(wBadFileName, - - &dwSectorsPerCluster_02, - - &dwBytesPerSector_02, - - &dwNumberOfFreeClusters, - - &dwTotalNumberOfClusters); - - if (bRc != TRUE) - - - - { - - lastErr=GetLastError(); - - - - if(lastErr != ERROR_FILE_NOT_FOUND) - - { - - Trace("GetDiskFreeSpaceW: calling GetLastError() returned [%u] " - - "while it should return [%u] for a bad File Name\n", - - lastErr,ERROR_FILE_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("GetDiskFreeSpaceW: GetDiskFreeSpaceW succeeded when given " - - "a bad fileName\n"); - - testPass = FALSE; - - - - } - - - - - - /* test with invalid path name */ - - bRc = GetDiskFreeSpaceW(wBadFilePath, - - &dwSectorsPerCluster_02, - - &dwBytesPerSector_02, - - &dwNumberOfFreeClusters, - - &dwTotalNumberOfClusters); - - if (bRc != TRUE) - - - - { - - lastErr=GetLastError(); - - if(lastErr != ERROR_PATH_NOT_FOUND) - - { - - Trace("GetDiskFreeSpaceW: calling GetLastError() returned [%u] " - - "while it should return [%u] for a bad File Name\n", - - lastErr,ERROR_PATH_NOT_FOUND); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("GetDiskFreeSpaceW: GetDiskFreeSpaceW succeeded when given " - - "a bad fileName\n"); - - testPass = FALSE; - - - - - - } - - - - - - /* test .................. GetTempFileNameA .................. */ - - - - /* test with invalid path name */ - - uiError = GetTempFileNameA(sDot, sPrefix, uUnique, szReturnedName); - - if (uiError == 0) - - { - - lastErr=GetLastError(); - - if(lastErr != ERROR_DIRECTORY) - - { - - - - Trace("GetTempFileNameA: calling GetLastError() returned [%u] " - - "while it should return [%u] for invalid path name\n", - - lastErr,ERROR_DIRECTORY); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("GetTempFileNameA: GetTempFileNameA succeeded when given " - - "invalid path name\n"); - - testPass = FALSE; - - } - - - - - - - - /* test .................. GetTempFileNameW .................. */ - - - - /* test with invalid path name */ - - uiError = GetTempFileNameW(wDot, wPrefix, uUnique, wzReturnedName); - - if (uiError == 0) - - { - - lastErr=GetLastError(); - - if(lastErr != ERROR_DIRECTORY) - - { - - - - Trace("GetTempFileNameW: calling GetLastError() returned [%u] " - - "while it should return [%u] for an invalid path name\n", - - lastErr,ERROR_DIRECTORY); - - testPass = FALSE; - - } - - } - - else - - { - - Trace("GetTempFileNameW: GetTempFileNameW succeeded when given" - - " an invalid path name\n"); - - testPass = FALSE; - - } - - - - if(! testPass) - - { - - Fail(""); - - } - - - - - - - - - - - - - - PAL_Terminate(); - - return PASS; - -} - - - diff --git a/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/testinfo.dat b/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/testinfo.dat deleted file mode 100644 index d7b707fca9..0000000000 --- a/src/pal/tests/palsuite/file_io/errorpathnotfound/test4/testinfo.dat +++ /dev/null @@ -1,34 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. - -# The .NET Foundation licenses this file to you under the MIT license. - -# See the LICENSE file in the project root for more information. - - - -Version = 1.0 - -Section = file_io - -Function = some File_io functions - -Name = errorpathnotfound - checking GetLastError. - -Type = DEFAULT - -EXE1 = test4 - -Description - -= Test the return value of GetLastError() after calling - -= some file_io functions with an invalid path. - -= Functions covered by this test are: - -= MoveFIlew, FindFirstFileA, FindFirstFileW, - -= GetFileAttributesA, GetFileAttributesW, - -= SetFileAttributesA, SetFileAttributesW. - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt index a573dae8cd..4f996bded0 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt +++ b/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt @@ -13,13 +13,11 @@ add_subdirectory(HeapFree) add_subdirectory(HeapReAlloc) add_subdirectory(LocalAlloc) add_subdirectory(LocalFree) -add_subdirectory(LockFile) add_subdirectory(MapViewOfFile) add_subdirectory(OpenFileMappingA) add_subdirectory(OpenFileMappingW) add_subdirectory(ProbeMemory) add_subdirectory(RtlMoveMemory) -add_subdirectory(UnlockFile) add_subdirectory(UnmapViewOfFile) add_subdirectory(VirtualAlloc) add_subdirectory(VirtualFree) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/CMakeLists.txt deleted file mode 100644 index 19ee487a6a..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) -add_subdirectory(test5) -add_subdirectory(test6) -add_subdirectory(test7) - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/LockFile.h b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/LockFile.h deleted file mode 100644 index 2862b6c524..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/LockFile.h +++ /dev/null @@ -1,152 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: LockFile.h -** -** Purpose: This header file has a RunHelper method which will be used to -** start a child proccess in many LockFile testcases. The CreateAndLockFile -** method Creates a file and calls LockFile upon it. And the two Signal -** methods are used for IPC. -** -** -**============================================================*/ - -#include - -int RunHelper(char* Helper) -{ - STARTUPINFO si; - PROCESS_INFORMATION pi; - DWORD RetCode; - - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - - if(!CreateProcess( NULL,Helper,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) - { - Fail("ERROR: CreateProcess failed to load executable '%s'.",Helper); - } - - if(WaitForSingleObject( pi.hProcess, INFINITE ) == WAIT_FAILED) - { - Fail("ERROR: WaitForSingleObject returned WAIT_FAILED when it was " - "called."); - } - - /* Get the return value from the helper process */ - if (GetExitCodeProcess(pi.hProcess, &RetCode) == 0) - { - Fail("ERROR: GetExitCodeProccess failed when attempting to retrieve " - "the exit code of the child process."); - } - - if(CloseHandle( pi.hProcess ) == 0) - { - Fail("ERROR: CloseHandle failed to close the process."); - } - - if(CloseHandle( pi.hThread ) == 0) - { - Fail("ERROR: CloseHandle failed to close the thread."); - } - - return RetCode; -} - -HANDLE CreateAndLockFile(HANDLE TheFile, char* FileName, char* WriteBuffer, - DWORD LockStart, DWORD LockLength) -{ - DWORD BytesWritten; - - TheFile = CreateFile(FileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.",FileName,GetLastError()); - } - - if(WriteFile(TheFile, WriteBuffer, - strlen(WriteBuffer),&BytesWritten, NULL) == 0) - { - Fail("ERROR: WriteFile has failed. It returned 0 when we " - "attempted to write to the file '%s'. GetLastError() " - "returned %d.",FileName,GetLastError()); - } - - if(FlushFileBuffers(TheFile) == 0) - { - Fail("ERROR: FlushFileBuffers returned failure. GetLastError() " - "returned %d.",GetLastError()); - } - - if(LockFile(TheFile, LockStart, 0, LockLength, 0) == 0) - { - Fail("ERROR: LockFile failed. GetLastError returns %d.", - GetLastError()); - } - - return TheFile; -} - -void SignalAndBusyWait(HANDLE TheFile) -{ - int size; - DWORD BytesWritten; - - size = GetFileSize(TheFile,NULL)+1; - - if(SetFilePointer(TheFile, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) - { - Fail("ERROR: SetFilePointer was unable to set the pointer to the " - "end of the file. GetLastError() returned %d.",GetLastError()); - } - - if(WriteFile(TheFile, "x", 1,&BytesWritten, NULL) == 0) - { - Fail("ERROR: WriteFile was unable to write to the WaitFile. " - "GetLastError() returned %d.",GetLastError()); - } - - if(FlushFileBuffers(TheFile) == 0) - { - Fail("ERROR: FlushFileBuffers failed when flushing the WaitFile. " - "GetLastError() returned %d."); - } - - while(GetFileSize(TheFile,NULL) == size) { Sleep(100); } -} - -void SignalFinish(HANDLE TheFile) -{ - DWORD BytesWritten; - - if(SetFilePointer(TheFile, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) - { - Fail("ERROR: SetFilePointer was unable to set the pointer to the " - "end of the WaitFile. GetLastError() returned %d.", - GetLastError()); - } - - if(WriteFile(TheFile, "x", 1,&BytesWritten, NULL) == 0) - { - Fail("ERROR: WriteFile was unable to write to the WaitFile. " - "GetLastError returned %d.",GetLastError()); - } - - if(FlushFileBuffers(TheFile) == 0) - { - Fail("ERROR: FlushFileBuffers failed when flushing the WaitFile. " - "GetLastError() returned %d."); - } -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/CMakeLists.txt deleted file mode 100644 index a9b8869c37..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(TESTSOURCES - test1.cpp -) - -add_executable(paltest_lockfile_test1 - ${TESTSOURCES} -) - -add_dependencies(paltest_lockfile_test1 coreclrpal) - -target_link_libraries(paltest_lockfile_test1 - ${COMMON_TEST_LIBRARIES} -) - - -set(HELPERSOURCES - helper.cpp -) - -add_executable(paltest_lockfile_test1_helper - ${HELPERSOURCES} -) - -add_dependencies(paltest_lockfile_test1_helper coreclrpal) - -target_link_libraries(paltest_lockfile_test1_helper - ${COMMON_TEST_LIBRARIES} -) \ No newline at end of file diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/helper.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/helper.cpp deleted file mode 100644 index 05b4b8451a..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/helper.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: helper.c -** -** Purpose: A child process which will attempt to read and write to files -** which were locked in the parent. -** -** -**============================================================*/ - -#include - -#define BUF_SIZE 128 - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile; - int result = 0; - char DataBuffer[BUF_SIZE]; - DWORD BytesRead, BytesWritten; - char fileName[] = "testfile.tmp"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open the same file that the parent has opened and locked */ - TheFile = CreateFile(fileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile.",fileName); - } - - /* Attempt to Read 5 bytes from this file. Since it is locked, this - should fail. - */ - - if(ReadFile(TheFile, DataBuffer, 5, &BytesRead, NULL) != 0) - { - Trace("ERROR: ReadFile should have failed! It was called on " - "a locked file. But, it returned non-zero indicating success."); - result = 1; - } - - /* Attempt to Write 5 bytes to this file. Since it is locked this should - fail. - */ - - memset(DataBuffer,'X',BUF_SIZE); - - if(WriteFile(TheFile, DataBuffer, 5,&BytesWritten, NULL) != 0) - { - Trace("ERROR: WriteFile should have failed! It was called on " - "a locked file. But, it returned non-zero indicating success."); - result = 1; - } - - /* Check to ensure that the number of Bytes read/written is still 0, - since nothing should have been read or written. - */ - - if(BytesRead != 0 || BytesWritten !=0) - { - Trace("ERROR: The number of bytes read is %d and written is %d. " - "These should both be 0, as the file was locked.", - BytesRead,BytesWritten); - result = 1; - } - - PAL_TerminateEx(result); - return result; -} - - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/test1.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/test1.cpp deleted file mode 100644 index cee223ef81..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/test1.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test1.c -** -** Purpose: Open a file, and lock it from start to EOF. Then create a -** new process, which will attempt to Read and Write from the file. Check -** to ensure both of these operations fail. -** -** -**============================================================*/ - -#include -#include "../LockFile.h" - -#define HELPER "helper" - -int __cdecl main(int argc, char *argv[]) -{ - - HANDLE TheFile; - DWORD FileStart = 0; - DWORD FileEnd = 0; - const char lpBuffer[] = "This is a test file."; - DWORD bytesWritten; - BOOL bRc = TRUE; - char fileName[] = "testfile.tmp"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Important to have sharing enabled, or there is no need for the lock. */ - TheFile = CreateFile(fileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile.",fileName); - } - - bRc = WriteFile(TheFile, - lpBuffer, - (DWORD)sizeof(lpBuffer), - &bytesWritten, - NULL); - - if(!bRc) - { - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - - Fail("ERROR: Could not write to file '%s' with WriteFile.",fileName); - } - else if(bytesWritten != (DWORD)sizeof(lpBuffer)) - { - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - - Fail("ERROR: Could not write the correct number of bytes to the " - "file '%s' with WriteFile.",fileName); - } - - /* Find the value for the End of the file */ - FileEnd = SetFilePointer(TheFile,0,NULL,FILE_END); - - if(FileEnd == INVALID_SET_FILE_POINTER) - { - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - - Fail("ERROR: Could not set the file pointer to the end of the file " - "using SetFilePointer. It returned INVALID_SET_FILE_POINTER."); - } - - /* Lock the file from Start to EOF */ - - if(LockFile(TheFile, FileStart, 0, FileEnd, 0) == 0) - { - Trace("ERROR: LockFile failed. GetLastError returns %d.", - GetLastError()); - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Launch another process, which will attempt to read and write from - the locked file. - - If the helper program returns 1, then the test fails. More - specific errors are given by the Helper file itself. - */ - if(RunHelper(HELPER)) - { - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - - Fail("ERROR: The Helper program determined that the file was not " - "locked properly by LockFile."); - } - - if(UnlockFile(TheFile, FileStart, 0, FileEnd, 0) == 0) - { - Trace("ERROR: UnlockFile failed. GetLastError returns %d.", - GetLastError()); - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/testinfo.dat deleted file mode 100644 index cbe4d94d40..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test1/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = LockFile -Name = Positive test for LockFile API -TYPE = DEFAULT -EXE1 = test1 -EXE2 = helper -Description -= Open a file, and lock it from start to EOF. Then create a -= new process, which will attempt to Read and Write from the file. Check -= to ensure both of these operations fail. diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/CMakeLists.txt deleted file mode 100644 index 42e88c5999..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test2.cpp -) - -add_executable(paltest_lockfile_test2 - ${SOURCES} -) - -add_dependencies(paltest_lockfile_test2 coreclrpal) - -target_link_libraries(paltest_lockfile_test2 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/test2.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/test2.cpp deleted file mode 100644 index 8aef130ef4..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/test2.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test2.c -** -** Purpose: Open a file, and lock it from start to EOF. Check to ensure -** the current process can still read and write from/to the file. -** -** -**============================================================*/ - -#include -#include "../LockFile.h" - -#define FILENAME "testfile.txt" - -int __cdecl main(int argc, char *argv[]) -{ - - HANDLE TheFile = NULL; - DWORD FileStart = 0; - DWORD FileEnd = 0; - DWORD BytesWritten = 0; - DWORD BytesRead = 0; - char WriteBuffer[] = "This is some test data."; - char DataBuffer[128]; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Call the helper function to Create a file, write 'WriteBuffer' to - the file, and lock the file. - */ - - FileEnd = strlen(WriteBuffer); - TheFile = CreateAndLockFile(TheFile, FILENAME, WriteBuffer, - FileStart, FileEnd); - - /* Move the file pointer to the start of the file */ - if(SetFilePointer(TheFile, 0, NULL, FILE_BEGIN) != 0) - { - Fail("ERROR: SetFilePointer failed to move the file pointer back " - "to the start of the file."); - } - - /* Attempt to Read 5 bytes from this file. Since the lock does not - affect the calling process, this should succeed. - */ - - if(ReadFile(TheFile, DataBuffer, 5, &BytesRead, NULL) == 0) - { - Fail("ERROR: ReadFile has failed. Attempted to read in 5 bytes from " - "the file '%s' after it had LockFile called upon it, but within " - "the same process.",FILENAME); - } - - if(strncmp(DataBuffer, WriteBuffer, 5) != 0) - { - Fail("ERROR: The data read in from ReadFile is not what should have " - "been written in the file. '%s' ",DataBuffer); - } - - /* Attempt to Write 5 bytes to this file. Since the lock does not affect - the calling process, this should succeed. - */ - - memset(WriteBuffer, 'X', strlen(WriteBuffer)); - - if(WriteFile(TheFile, WriteBuffer, 5,&BytesWritten, NULL) == 0) - { - Fail("ERROR: WriteFile has failed. Attempted to write 5 bytes to " - "the file '%s' after it had LockFile called upon it, but within " - "the same process.",FILENAME); - } - - if(UnlockFile(TheFile, FileStart, 0, FileEnd, 0) == 0) - { - Fail("ERROR: UnlockFile failed. GetLastError returns %d.", - GetLastError()); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/testinfo.dat deleted file mode 100644 index c84e7c0a0a..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test2/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = LockFile -Name = Positive test for LockFile API -TYPE = DEFAULT -EXE1 = test2 -Description -= Open a file, and lock it from start to EOF. Check to ensure -= the current process can still read and write from/to the file. diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/CMakeLists.txt deleted file mode 100644 index 299e8cf76c..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(TESTSOURCES - test3.cpp -) - -add_executable(paltest_lockfile_test3 - ${TESTSOURCES} -) - -add_dependencies(paltest_lockfile_test3 coreclrpal) - -target_link_libraries(paltest_lockfile_test3 - ${COMMON_TEST_LIBRARIES} -) - - -set(HELPERSOURCES - helper.cpp -) - -add_executable(paltest_lockfile_test3_helper - ${HELPERSOURCES} -) - -add_dependencies(paltest_lockfile_test3_helper coreclrpal) - -target_link_libraries(paltest_lockfile_test3_helper - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/helper.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/helper.cpp deleted file mode 100644 index 079417fce8..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/helper.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: helper.c -** -** Purpose: A child process which will attempt to read and write to files -** which were locked in the parent. -** -** -**============================================================*/ - -#include - -#define FILENAME "testfile.txt" -#define BUF_SIZE 128 - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile; - int result = 0; - char DataBuffer[BUF_SIZE]; - DWORD BytesRead, BytesWritten; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open the same file that the parent has opened and locked */ - TheFile = CreateFile(FILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returns %d.",FILENAME,GetLastError()); - } - - /* Attempt to Read the first 3 bytes from this file. - Since it is unlocked, this should work properly. - */ - - if(ReadFile(TheFile, DataBuffer, 3, &BytesRead, NULL) == 0) - { - Trace("ERROR: ReadFile should have succeeded in reading the first " - "three bytes of the file, as these bytes were not locked. " - "GetLastError() returned %d.",GetLastError()); - result = 1; - } - - /* Now, read the next 10 bytes, which should be locked. Ensure that - ReadFile fails. - */ - - if(ReadFile(TheFile, DataBuffer,10, &BytesRead, NULL) != 0) - { - Trace("ERROR: ReadFile should have failed when attempting to read in " - "bytes between StartOfFile+3 and EndOfFile-3."); - result = 1; - } - - /* Attempt to Write 10 bytes to this file. Since it is locked this should - fail. - */ - - memset(DataBuffer,'X',BUF_SIZE); - - if(WriteFile(TheFile, DataBuffer, 10,&BytesWritten, NULL) != 0) - { - Trace("ERROR: WriteFile should have failed when attempting to write " - "bytes between StartOfFile+3 and EOF-3."); - result = 1; - } - - - /* Move the FilePointer to the EOF-3, where the lock ends */ - if(SetFilePointer(TheFile,-3,NULL,FILE_END) == INVALID_SET_FILE_POINTER) - { - Fail("ERROR: Could not set the file pointer to the EOF-3 " - "using SetFilePointer. It returned INVALID_SET_FILE_POINTER."); - } - - /* Attempt to write to those 3 unlocked bytes on the end of the file */ - if(WriteFile(TheFile, DataBuffer, 3,&BytesWritten, NULL) == 0) - { - Trace("ERROR: WriteFile should have succeeded when attempting " - "to write the last three bytes of the file, as they were not " - "locked. GetLastError() returned %d.",GetLastError()); - result = 1; - } - - PAL_TerminateEx(result); - return result; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/test3.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/test3.cpp deleted file mode 100644 index 78662c5685..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/test3.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test3.c -** -** Purpose: Open a file, lock a region in the middle. Create a new process -** and attempt to read and write directly before and after that region, which -** should succeed. Also, check to see that reading/writing in the locked -** region fails. -** -** -**============================================================*/ - -#include -#include "../LockFile.h" - -#define HELPER "helper" -#define FILENAME "testfile.txt" - -int __cdecl main(int argc, char *argv[]) -{ - - HANDLE TheFile = NULL; - DWORD FileStart = 0; - DWORD FileEnd = 0; - char* WriteBuffer = "12345678901234567890123456"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Call the helper function to Create a file, write 'WriteBuffer' to - the file, and lock the file. - */ - - FileEnd = strlen(WriteBuffer); - TheFile = CreateAndLockFile(TheFile,FILENAME, WriteBuffer, - FileStart+3, FileEnd-6); - - - /* Launch another process, which will attempt to read and write from - the locked file. - - If the helper program returns 1, then the test fails. More - specific errors are given by the Helper file itself. - */ - if(RunHelper(HELPER)) - { - Fail("ERROR: The Helper program determined that the file was not " - "locked properly by LockFile."); - } - - if(UnlockFile(TheFile, FileStart+3, 0, FileEnd-6, 0) == 0) - { - Fail("ERROR: UnlockFile failed. GetLastError returns %d.", - GetLastError()); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file. " - "GetLastError() returned %d.",GetLastError()); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/testinfo.dat deleted file mode 100644 index b64ec5ed03..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test3/testinfo.dat +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = LockFile -Name = Positive test for LockFile API -TYPE = DEFAULT -EXE1 = test3 -EXE2 = helper -Description -= Open a file, lock a region in the middle. Create a new process -= and attempt to read and write directly before and after that region, which -= should succeed. Also, check to see that reading/writing in the locked -= region fails. diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/CMakeLists.txt deleted file mode 100644 index 55cf9c64f7..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.cpp -) - -add_executable(paltest_lockfile_test4 - ${SOURCES} -) - -add_dependencies(paltest_lockfile_test4 coreclrpal) - -target_link_libraries(paltest_lockfile_test4 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/test4.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/test4.cpp deleted file mode 100644 index f5cd359fb5..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/test4.cpp +++ /dev/null @@ -1,231 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test4.c -** -** Purpose: -** - Attempt to call LockFile on a file without GENERIC_READ or -** GENERIC_WRITE (this should fail) -** - Attempt to overlap two locks, this should fail. -** -** -**============================================================*/ - -#include - -char fileName[] = "testfile.tmp"; - -void OverlapTest() -{ - HANDLE TheFile = NULL; - DWORD FileStart = 0; - const char lpBuffer[] = "This is a test file."; - DWORD bytesWritten; - BOOL bRc = TRUE; - - TheFile = CreateFile(fileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.",fileName,GetLastError()); - } - - bRc = WriteFile(TheFile, - lpBuffer, - (DWORD)sizeof(lpBuffer), - &bytesWritten, - NULL); - - if(!bRc) - { - Trace("ERROR: Could not write to file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - - } - else if(bytesWritten != (DWORD)sizeof(lpBuffer)) - { - Trace("ERROR: Could not write the correct number of bytes to the " - "file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Lock the First 5 bytes of the File */ - - if(LockFile(TheFile, FileStart, 0, 5, 0) == 0) - { - Trace("ERROR: LockFile failed in Overlap test. " - "GetLastError returns %d.", - GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Lock from Byte 2 until 7 -- this overlaps and should return failure. */ - if(LockFile(TheFile,FileStart+2, 0, 5, 0) != 0) - { - Trace("ERROR: LockFile returned success when it was overlapped on " - "an already locked region of the file."); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Unlock the file */ - if(UnlockFile(TheFile, FileStart, 0, 5, 0) == 0) - { - Trace("ERROR: UnlockFile failed in Overlap test. GetLastError " - "returns %d.",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Close the File */ - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file in the Overlap " - "test. GetLastError() returned %d.",GetLastError()); - } -} - -void FlagsTest(DWORD TheFlags, int ExpectedResult) -{ - HANDLE TheFile = NULL; - DWORD FileStart = 0; - int result; - - TheFile = CreateFile(fileName, - TheFlags, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.",fileName,GetLastError()); - } - - /* Lock the First 5 bytes of the File. The result of this depends - upon which flags were set with the CreateFile. - */ - - result = LockFile(TheFile, FileStart, 0, 5, 0); - - /* If the expected result is 1, check to ensure the result is non-zero, - as non-zero is returned on success - */ - if(ExpectedResult == 1) - { - if(result == 0) - { - Trace("ERROR: LockFile returned zero when the expected result " - "was non-zero. It was passed the flag value %d.", - TheFlags); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - } - /* If the expected result is 0, check to ensure the result is 0 */ - else - { - if(result != 0) - { - Trace("ERROR: LockFile returned %d when the expected result " - "was zero. It was passed the flag value %d.", - result, TheFlags); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - } - - /* Only unlock the file if we expect it to be successfully locked */ - if(ExpectedResult) - { - if(UnlockFile(TheFile,FileStart,0, 5, 0) == 0) - { - Fail("ERROR: UnlockFile failed in the Flags Test. GetLastError() " - "returned %d.",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - } - - /* Close the File */ - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file in the Flags " - "test. GetLastError() returned %d.",GetLastError()); - } -} - -int __cdecl main(int argc, char *argv[]) -{ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* This test opens a file, then calls lock twice, overlapping the - regions and checking to ensure that this causes an error. - */ - OverlapTest(); - - /* Test that LockFile fails if no flags are set */ - FlagsTest(0,0); - - /* Test that LockFile passes if only GENERIC_READ is set */ - FlagsTest(GENERIC_READ,1); - - /* Test that LockFile passes if only GENERIC_WRITE is set */ - FlagsTest(GENERIC_WRITE,1); - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/testinfo.dat deleted file mode 100644 index 0600260d82..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test4/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = LockFile -Name = Negative test for LockFile API -TYPE = DEFAULT -EXE1 = test4 -Description -= - Attempt to call LockFile on a file without GENERIC_READ or -= GENERIC_WRITE (this should fail) -= - Attempt to overlap two locks, this should fail. diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/CMakeLists.txt deleted file mode 100644 index 82a174907e..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(TESTSOURCES - test5.cpp -) - -add_executable(paltest_lockfile_test5 - ${TESTSOURCES} -) - -add_dependencies(paltest_lockfile_test5 coreclrpal) - -target_link_libraries(paltest_lockfile_test5 - ${COMMON_TEST_LIBRARIES} -) - - -set(HELPERSOURCES - helper.cpp -) - -add_executable(paltest_lockfile_test5_helper - ${HELPERSOURCES} -) - -add_dependencies(paltest_lockfile_test5_helper coreclrpal) - -target_link_libraries(paltest_lockfile_test5_helper - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/helper.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/helper.cpp deleted file mode 100644 index 1fc9b1a9a5..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/helper.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: helper.c -** -** Purpose: A child process which will attempt to read and write to files -** which were locked in the parent. It will also lock another region of the -** same file. -** -** -**============================================================*/ - -#include -#include "../LockFile.h" - -#define FILENAME "testfile.txt" -#define WAITFILENAME "waitfile" -#define BUF_SIZE 128 - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile, WaitFile; - int result = 0; - char DataBuffer[BUF_SIZE]; - DWORD BytesRead; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open the same file that the parent has opened and locked */ - TheFile = CreateFile(FILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Trace("ERROR: Could not open file '%s' with CreateFile.",FILENAME); - result = 1; - } - - /* Open up the WaitFile that we're using for IPC */ - WaitFile = CreateFile(WAITFILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (WaitFile == INVALID_HANDLE_VALUE) - { - Trace("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.",WAITFILENAME,GetLastError()); - result = 1; - } - - /* Lock the same file that the parent process locked, but the child - locks bytes 11 through 20 - */ - - if(LockFile(TheFile, 11, 0, 10, 0) == 0) - { - Trace("ERROR: LockFile failed in the child proccess. " - "GetLastError returns %d.", - GetLastError()); - result = 1; - } - - /* Check to ensure the parent lock is respected */ - if(ReadFile(TheFile, DataBuffer, 10, &BytesRead, NULL) != 0) - { - Trace("ERROR: ReadFile returned success when it should " - "have failed. Attempted to read the first 10 bytes " - "of a file which was locked by the parent process."); - result = 1; - } - - /* Check to ensure the lock put on by this proccess doesn't restrict - access - */ - - if(SetFilePointer(TheFile, 11, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER) - { - Trace("ERROR: SetFilePointer was unable to move the file pointer to " - "the 11th byte in the file, within the child proccess. " - "GetLastError() returned %d.",GetLastError()); - result = 1; - } - - if(ReadFile(TheFile, DataBuffer, 10, &BytesRead, NULL) == 0) - { - Trace("ERROR: ReadFile failed when attempting to read a section of " - "the file which was locked by the current process. It should " - "have been able to read this. GetLastError() returned %d.", - GetLastError()); - result = 1; - } - - // Sleep for a bit to give the parent a chance to block before we do. - Sleep(1000); - - /* Switch back to the parent, so it can check the child's locks */ - SignalAndBusyWait(WaitFile); - - if(UnlockFile(TheFile, 11, 0, 10, 0) == 0) - { - Fail("ERROR: Failed to Unlock bytes 11-20 in the file. " - "GetLastError returned %d.",GetLastError()); - } - - PAL_TerminateEx(result); - return result; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/test5.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/test5.cpp deleted file mode 100644 index a02a3c5a49..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/test5.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test5.c -** -** Purpose: -** Have two processes obtain a lock on a single file, but in different -** regions of the file. Use Read/Write to ensure the locks are respected. -** This requires some IPC, which is done here with a crude busy wait on a -** file (waiting for the file size to change) to avoid too many more -** dependencies. -** -** -**============================================================*/ - -#include -#include "../LockFile.h" - -#define HELPER "helper" -#define FILENAME "testfile.txt" -#define WAITFILENAME "waitfile" -#define BUF_SIZE 128 - -int RunTest(char* Helper, HANDLE TheFile, HANDLE WaitFile) -{ - STARTUPINFO si; - PROCESS_INFORMATION pi; - DWORD ChildRetCode = 0; - DWORD ParentRetCode = 0; - DWORD BytesRead; - char DataBuffer[BUF_SIZE]; - - - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - - /* Load up the helper Process, and then Wait until it signals that it - is finished locking. - */ - if(!CreateProcess( NULL,Helper,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi)) - { - Fail("ERROR: CreateProcess failed to load executable '%s'.",Helper); - } - - SignalAndBusyWait(WaitFile); - - /* Now the child proccess has locked another section of the file, from - bytes 11 through 20. Let's check that the parent lock is still ignored - by the parent proccess and that the child's lock is respected. - */ - - if(ReadFile(TheFile, DataBuffer, 10, &BytesRead, NULL) == 0) - { - Trace("ERROR: ReadFile failed when attempting to read a section of " - "the file which was locked by the current process. It should " - "have been able to read this. GetLastError() returned %d.", - GetLastError()); - ParentRetCode = 1; - } - - SetFilePointer(TheFile, 11, 0, FILE_BEGIN); - - if(ReadFile(TheFile, DataBuffer, 10, &BytesRead, NULL) != 0) - { - Trace("ERROR: ReadFile returned success when it should " - "have failed. Attempted to read 10 bytes of the file which " - "were locked by the child."); - ParentRetCode = 1; - } - - /* We're finished testing. Let the child proccess know so it can clean - up, and the parent will wait until it is done. - */ - SignalFinish(WaitFile); - WaitForSingleObject(pi.hProcess,INFINITE); - - /* Get the return value from the helper process */ - if (GetExitCodeProcess(pi.hProcess, &ChildRetCode) == 0) - { - Fail("ERROR: GetExitCodeProccess failed when attempting to retrieve " - "the exit code of the child process."); - } - - if(CloseHandle( pi.hProcess ) == 0) - { - Fail("ERROR: CloseHandle failed to close the process."); - } - - if(CloseHandle( pi.hThread ) == 0) - { - Fail("ERROR: CloseHandle failed to close the thread."); - } - - return (ChildRetCode || ParentRetCode); -} - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile = NULL; - HANDLE WaitFile = NULL; - char* WriteBuffer = "12345678901234567890123456"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open up the file we'll be using for some crude IPC */ - WaitFile = CreateFile(WAITFILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (WaitFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.",WAITFILENAME,GetLastError()); - } - - /* Call the helper function to Create a file, write 'WriteBuffer' to - the file, and lock the file from bytes 0 to 10. - */ - TheFile = CreateAndLockFile(TheFile, FILENAME, WriteBuffer, - 0, 10); - - /* Run the test. Better errors are displayed by Trace throughout. */ - if(RunTest(HELPER, TheFile, WaitFile)) - { - Fail("ERROR: Attempting to have two processes lock different " - "sections of the same file has failed."); - } - - /* Unlock the first 10 bytes which were locked by the parent proccess */ - if(UnlockFile(TheFile, 0, 0, 10, 0) == 0) - { - Fail("ERROR: Failed to Unlock the first 10 bytes of the file. " - "GetLastError returned %d.",GetLastError()); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file used for " - "testing the locks. GetLastError() returns %d.",GetLastError()); - } - - if(CloseHandle(WaitFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the wait file. " - "GetLastError() returns %d.",GetLastError()); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/testinfo.dat deleted file mode 100644 index f020933cd9..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test5/testinfo.dat +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = LockFile -Name = Positive test for LockFile API -TYPE = DEFAULT -EXE1 = test5 -EXE2 = helper -Description -= Have two processes obtain a lock on a single file, but in different -= regions of the file. Use Read/Write to ensure the locks are respected. -= This requires some IPC, which is done here with a crude busy wait on a -= file (waiting for the file size to change) to avoid too many more -= dependencies. diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/CMakeLists.txt deleted file mode 100644 index fc5f90113e..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(TESTSOURCES - test6.cpp -) - -add_executable(paltest_lockfile_test6 - ${TESTSOURCES} -) - -add_dependencies(paltest_lockfile_test6 coreclrpal) - -target_link_libraries(paltest_lockfile_test6 - ${COMMON_TEST_LIBRARIES} -) - - -set(HELPERSOURCES - helper.cpp -) - -add_executable(paltest_lockfile_test6_helper - ${HELPERSOURCES} -) - -add_dependencies(paltest_lockfile_test6_helper coreclrpal) - -target_link_libraries(paltest_lockfile_test6_helper - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/helper.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/helper.cpp deleted file mode 100644 index 98112fc4a5..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/helper.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: helper.c -** -** Purpose: A child process which will attempt to append to the end of -** a locked file. -** -** -**============================================================*/ - -#include - -#define FILENAME "testfile.txt" -#define BUF_SIZE 128 - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile; - int result = 0; - char DataBuffer[BUF_SIZE]; - DWORD BytesWritten; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open the same file that the parent has opened and locked */ - TheFile = CreateFile(FILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Trace("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returns %d.",FILENAME,GetLastError()); - result = -1; - } - - - /* Move the FilePointer to the EOF */ - if(SetFilePointer(TheFile,0,NULL,FILE_END) == INVALID_SET_FILE_POINTER) - { - Trace("ERROR: Could not set the file pointer to the EOF " - "using SetFilePointer. It returned INVALID_SET_FILE_POINTER."); - result = -1; - } - - memset(DataBuffer, 'X', BUF_SIZE); - - /* Return the result of WriteFile -- we want to check in the parent that - this was successful. Note: WriteFile doesn't get run if something - failed during the setup, in that case -1 is returned. - */ - - if(result != -1) - { - result = WriteFile(TheFile, DataBuffer, 3,&BytesWritten, NULL); - } - - PAL_TerminateEx(result); - return result; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/test6.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/test6.cpp deleted file mode 100644 index ba01b9710a..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/test6.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test6.c -** -** Purpose: -** Append to a file which is locked until the end of the file, and -** append to a file which is locked past the end of the file. (The first -** should succeed, while the second should fail) -** -** -**============================================================*/ - -#include -#include "../LockFile.h" - -#define HELPER "helper" -#define FILENAME "testfile.txt" - -/* This test checks that you can append to a file which is locked from Start - to EOF. -*/ -void Test1() -{ - HANDLE TheFile = NULL; - DWORD FileStart = 0; - DWORD FileEnd = 0; - int result; - char* WriteBuffer = "12345678901234567890123456"; - - /* Call the helper function to Create a file, write 'WriteBuffer' to - the file, and lock the file. - */ - - FileEnd = strlen(WriteBuffer); - TheFile = CreateAndLockFile(TheFile,FILENAME, WriteBuffer, - FileStart, FileEnd); - - - /* - Launch another proccess which will attempt to append to the - end of the file. Note: This returns -1 if the setup failed in some way. - */ - - result = RunHelper(HELPER); - - if(result == -1) - { - Fail("ERROR: The Helper program failed in setting up the " - "test, so it could never be run."); - } - else if(result == 0) - { - Fail("ERROR: Failed to append to the file which was Locked from " - "start until EOF. Should have been able to append to this " - "file still. GetLastError() is %d.",GetLastError()); - } - - if(UnlockFile(TheFile, FileStart, 0, FileEnd, 0) == 0) - { - Fail("ERROR: UnlockFile failed. GetLastError returns %d.", - GetLastError()); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file. " - "GetLastError() returned %d.",GetLastError()); - } - -} - -/* This test checks that you can't append to a file which is locked beyond - EOF. -*/ -void Test2() -{ - HANDLE TheFile = NULL; - DWORD FileStart = 0; - DWORD FileEnd = 0; - int result; - char* WriteBuffer = "12345678901234567890123456"; - - /* Call the helper function to Create a file, write 'WriteBuffer' to - the file, and lock the file. - */ - - FileEnd = strlen(WriteBuffer); - TheFile = CreateAndLockFile(TheFile,FILENAME, WriteBuffer, - FileStart, FileEnd+20); - - - /* - Launch another proccess which will attempt to append to the - end of the file. - */ - - result = RunHelper(HELPER); - - if(result == -1) - { - Fail("ERROR: The Helper program failed in setting up the " - "test, so it could never be run."); - } - else if(result > 0) - { - Fail("ERROR: The Helper program successfully appended to the " - "end of the file, even though it was locked beyond EOF. This " - "should have failed."); - } - - if(UnlockFile(TheFile, FileStart, 0, FileEnd+20, 0) == 0) - { - Fail("ERROR: UnlockFile failed. GetLastError returns %d.", - GetLastError()); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file. " - "GetLastError() returned %d.",GetLastError()); - } - -} - - -int __cdecl main(int argc, char *argv[]) -{ - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Test a file which is locked until EOF to see if you can append */ - Test1(); - - /* Test a file which is locked past EOF to ensure you can't append */ - Test2(); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/testinfo.dat deleted file mode 100644 index 871a9a2756..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test6/testinfo.dat +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = LockFile -Name = Positive test for LockFile API -TYPE = DEFAULT -EXE1 = test6 -EXE2 = helper -Description -= Append to a file which is locked until the end of the file, and -= append to a file which is locked past the end of the file. (The first -= should succeed, while the second should fail) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/CMakeLists.txt deleted file mode 100644 index c52bf55ba8..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test7.cpp -) - -add_executable(paltest_lockfile_test7 - ${SOURCES} -) - -add_dependencies(paltest_lockfile_test7 coreclrpal) - -target_link_libraries(paltest_lockfile_test7 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/test7.cpp b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/test7.cpp deleted file mode 100644 index c572a6e653..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/test7.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test7.c -** -** Purpose: Try locking an invalid HANDLE and a NULL Handle. -** -** -**============================================================*/ - -#include -#include "../LockFile.h" - -int __cdecl main(int argc, char *argv[]) -{ - - HANDLE TheFile = NULL; - DWORD FileEnd = 0; - const char lpBuffer[] = "This is a test file."; - DWORD bytesWritten; - BOOL bRc = TRUE; - char fileName[] = "testfile.tmp"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - TheFile = CreateFile(fileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.",fileName,GetLastError()); - } - - bRc = WriteFile( - TheFile, // handle to file - lpBuffer, // data buffer - (DWORD)sizeof(lpBuffer), // number of bytes to write - &bytesWritten, // number of bytes written - NULL // overlapped buffer - ); - - if(!bRc) - { - Trace("ERROR: Could not write to file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - - } - else if(bytesWritten != (DWORD)sizeof(lpBuffer)) - { - Trace("ERROR: Could not write the correct number of bytes to the " - "file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Attempt to lock a region of this file beyond EOF, to ensure this - doesn't cause an error. - */ - FileEnd = SetFilePointer(TheFile, 0, NULL, FILE_END); - - if(LockFile(TheFile, FileEnd+10, 0, 10, 0) == 0) - { - Trace("ERROR: LockFile failed when attempting to lock a region " - "beyond the EOF. GetLastError() returned %d.",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(UnlockFile(TheFile, FileEnd+10, 0, 10, 0) == 0) - { - Trace("ERROR: UnlockFile failed when attempting to unlock the region " - "which was locked beyond the EOF. GetLastError returned %d.", - GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: Failed to call CloseHandle. GetLastError " - "returned %d.",GetLastError()); - } - - /* Attempt to call Lockfile on an HANDLE which has been closed. This - should fail. - */ - if(LockFile(TheFile, 0, 0, 5, 0) != 0) - { - Fail("ERROR: Attempted to Lock an invalid handle and the function " - "returned success."); - } - - /* Attempt to call Lockfile by passing it NULL for a handle. This should - fail. - */ - - if(LockFile(NULL, 0, 0, 5, 0) != 0) - { - Fail("ERROR: Attempted to Lock a NULL handle and the function " - "returned success."); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/testinfo.dat deleted file mode 100644 index 74e7f00306..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/LockFile/test7/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = LockFile -Name = Positive test for LockFile API -TYPE = DEFAULT -EXE1 = test7 -Description -= Ensure that LockFile succeeds when the lock begins beyond -= EOF. Try locking an invalid HANDLE and a NULL Handle. diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/CMakeLists.txt deleted file mode 100644 index a3847f8ca9..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test2) -add_subdirectory(test3) -add_subdirectory(test4) - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/UnlockFile.h b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/UnlockFile.h deleted file mode 100644 index 8fce2695a7..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/UnlockFile.h +++ /dev/null @@ -1,112 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: UnLockFile.h -** -** Purpose: This header file has a RunHelper method which will be used to -** start a child proccess in many LockFile testcases. The CreateAndLockFile -** method Creates a file and calls LockFile upon it. And the two Signal -** methods are used for IPC. -** -** -**============================================================*/ - -#include - -HANDLE CreateAndLockFile(HANDLE TheFile, char* FileName, char* WriteBuffer, - DWORD LockStart, DWORD LockLength) -{ - DWORD BytesWritten; - - TheFile = CreateFile(FileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",FileName,GetLastError()); - } - - if(WriteFile(TheFile, WriteBuffer, - strlen(WriteBuffer),&BytesWritten, NULL) == 0) - { - Fail("ERROR: WriteFile has failed. It returned 0 when we " - "attempted to write to the file '%s'. GetLastError() " - "returned %d.\n",FileName,GetLastError()); - } - - if(FlushFileBuffers(TheFile) == 0) - { - Fail("ERROR: FlushFileBuffers returned failure. GetLastError() " - "returned %d.\n",GetLastError()); - } - - if(LockFile(TheFile, LockStart, 0, LockLength, 0) == 0) - { - Fail("ERROR: LockFile failed. GetLastError returns %d.\n", - GetLastError()); - } - - return TheFile; -} - -void SignalAndBusyWait(HANDLE TheFile) -{ - int size; - DWORD BytesWritten; - - size = GetFileSize(TheFile,NULL)+1; - - if(SetFilePointer(TheFile, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) - { - Fail("ERROR: SetFilePointer was unable to set the pointer to the " - "end of the file. GetLastError() returned %d.\n",GetLastError()); - } - - if(WriteFile(TheFile, "x", 1,&BytesWritten, NULL) == 0) - { - Fail("ERROR: WriteFile was unable to write to the WaitFile. " - "GetLastError() returned %d.\n",GetLastError()); - } - - if(FlushFileBuffers(TheFile) == 0) - { - Fail("ERROR: FlushFileBuffers failed when flushing the WaitFile. " - "GetLastError() returned %d.\n"); - } - - while(GetFileSize(TheFile,NULL) == size) {} -} - -void SignalFinish(HANDLE TheFile) -{ - DWORD BytesWritten; - - if(SetFilePointer(TheFile, 0, NULL, FILE_END) == INVALID_SET_FILE_POINTER) - { - Fail("ERROR: SetFilePointer was unable to set the pointer to the " - "end of the WaitFile. GetLastError() returned %d.\n", - GetLastError()); - } - - if(WriteFile(TheFile, "x", 1,&BytesWritten, NULL) == 0) - { - Fail("ERROR: WriteFile was unable to write to the WaitFile. " - "GetLastError returned %d.\n",GetLastError()); - } - - if(FlushFileBuffers(TheFile) == 0) - { - Fail("ERROR: FlushFileBuffers failed when flushing the WaitFile. " - "GetLastError() returned %d.\n"); - } - -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/CMakeLists.txt deleted file mode 100644 index 58b0329d0d..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(TESTSOURCES - test1.cpp -) - -add_executable(paltest_unlockfile_test1 - ${TESTSOURCES} -) - -add_dependencies(paltest_unlockfile_test1 coreclrpal) - -target_link_libraries(paltest_unlockfile_test1 - ${COMMON_TEST_LIBRARIES} -) - - -set(HELPERSOURCES - helper.cpp -) - -add_executable(paltest_unlockfile_test1_helper - ${HELPERSOURCES} -) - -add_dependencies(paltest_unlockfile_test1_helper coreclrpal) - -target_link_libraries(paltest_unlockfile_test1_helper - ${COMMON_TEST_LIBRARIES} -) \ No newline at end of file diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/helper.cpp b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/helper.cpp deleted file mode 100644 index c2ef5a6736..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/helper.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: helper.c -** -** Purpose: A child process which will attempt to read from the -** locked file to ensure it is locked. After it has been unlocked, it -** will then read again to check that Unlock worked. -** -** -**============================================================*/ - -#include -#include "../UnlockFile.h" - -#define FILENAME "testfile.txt" -#define WAITFILENAME "waitfile" -#define BUF_SIZE 128 - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile, WaitFile; - int result = 0; - char DataBuffer[BUF_SIZE]; - DWORD BytesRead; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open the same file that the parent has opened and locked */ - TheFile = CreateFile(FILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Trace("ERROR: Could not open file '%s' with CreateFile.\n",FILENAME); - result = 1; - } - - /* Open up the WaitFile that we're using for IPC */ - WaitFile = CreateFile(WAITFILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (WaitFile == INVALID_HANDLE_VALUE) - { - Trace("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",WAITFILENAME,GetLastError()); - result = 1; - } - - - /* Check to ensure the parent lock is respected */ - if(ReadFile(TheFile, DataBuffer, 10, &BytesRead, NULL) != 0) - { - Trace("ERROR: ReadFile returned success when it should " - "have failed. Attempted to read the first 10 bytes " - "of a file which was locked by the parent process.\n"); - result = 1; - } - - // Sleep for a bit to give the parent a chance to block before we do. - Sleep(1000); - - /* Switch back to the parent, so it can unlock the file */ - SignalAndBusyWait(WaitFile); - - if(ReadFile(TheFile, DataBuffer, 10, &BytesRead, NULL) == 0) - { - Trace("ERROR: ReadFile was unable to read from the file after it " - "had been unlocked. Attempted to read 10 bytes and ReadFile " - "returned 0. GetLastError() returned %d.\n",GetLastError()); - result = 1; - } - - PAL_TerminateEx(result); - return result; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/test1.cpp b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/test1.cpp deleted file mode 100644 index 14634c7f7a..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/test1.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test1.c -** -** Purpose: -** Have the parent Lock a file, then have the child check the lock, then -** have the parent unlock the file, and the child check again. -** This requires some IPC, which is done here with a crude busy wait on a -** file (waiting for the file size to change) to avoid too many more -** dependencies. -** -** -**============================================================*/ - -#include -#include "../UnlockFile.h" - -#define HELPER "helper" -#define FILENAME "testfile.txt" -#define WAITFILENAME "waitfile" -#define BUF_SIZE 128 - -int RunTest(char* Helper, HANDLE TheFile, HANDLE WaitFile) -{ - STARTUPINFO si; - PROCESS_INFORMATION pi; - DWORD ChildRetCode = 0; - DWORD ParentRetCode = 0; - DWORD FileEnd; - - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - - /* Load up the helper Process, and then Wait until it signals that it - is finished locking. - */ - if(!CreateProcess( NULL, Helper, NULL, - NULL, FALSE, 0, - NULL, NULL, &si, &pi)) - { - Fail("ERROR: CreateProcess failed to load executable '%s'.\n",Helper); - } - - SignalAndBusyWait(WaitFile); - - /* When the child proccess is finished verifying the lock, find the end - of the file and unlock the file. - */ - - FileEnd = SetFilePointer(TheFile, 0, NULL, FILE_END); - - if(FileEnd == INVALID_SET_FILE_POINTER) - { - Trace("ERROR: SetFilePointer failed to set the file pointer to the " - "end of the file. GetLastError() returned %d.\n", - GetLastError()); - ParentRetCode = 1; - } - - if(UnlockFile(TheFile, 0, 0, FileEnd, 0) == 0) - { - Trace("ERROR: The call to UnlockFile returned 0 when attempting to " - "unlock the file within the parent. This should have " - "succeeded. GetLastError returned %d.\n",GetLastError()); - ParentRetCode = 1; - } - - /* Switch back to the child so that it can ensure the unlock worked - properly. - */ - - SignalFinish(WaitFile); - WaitForSingleObject(pi.hProcess,INFINITE); - - /* Get the return value from the helper process */ - if (GetExitCodeProcess(pi.hProcess, &ChildRetCode) == 0) - { - Fail("ERROR: GetExitCodeProccess failed when attempting to retrieve " - "the exit code of the child process.\n"); - } - - if(CloseHandle( pi.hProcess ) == 0) - { - Fail("ERROR: CloseHandle failed to close the process.\n"); - } - - if(CloseHandle( pi.hThread ) == 0) - { - Fail("ERROR: CloseHandle failed to close the thread.\n"); - } - - return (ChildRetCode || ParentRetCode); -} - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile = NULL; - HANDLE WaitFile = NULL; - char* WriteBuffer = "12345678901234567890123456"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open up the file we'll be using for some crude IPC */ - WaitFile = CreateFile(WAITFILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (WaitFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",WAITFILENAME,GetLastError()); - } - - /* Call the helper function to Create a file, write 'WriteBuffer' to - the file, and lock the file from start to end. - */ - TheFile = CreateAndLockFile(TheFile, FILENAME, WriteBuffer, - 0, strlen(WriteBuffer)); - - /* Run the test. Better errors are displayed by Trace throughout. */ - if(RunTest(HELPER, TheFile, WaitFile)) - { - Fail("ERROR: Checking to ensure that Unlock successfully unlocked " - "a file failed.\n"); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file used for " - "testing the locks. GetLastError() returns %d.\n", - GetLastError()); - } - - if(CloseHandle(WaitFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the wait file. " - "GetLastError() returns %d.\n",GetLastError()); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/testinfo.dat deleted file mode 100644 index 4d0ad6afc9..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test1/testinfo.dat +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = UnlockFile -Name = Positive test for UnlockFile API -TYPE = DEFAULT -EXE1 = test1 -EXE2 = helper -Description -= Have the parent Lock a file, then have the child check the lock, then -= have the parent unlock the file, and the child check again. -= This requires some IPC, which is done here with a crude busy wait on a -= file (waiting for the file size to change) to avoid too many more -= dependencies. diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/CMakeLists.txt deleted file mode 100644 index 251d21ba65..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test2.cpp -) - -add_executable(paltest_unlockfile_test2 - ${SOURCES} -) - -add_dependencies(paltest_unlockfile_test2 coreclrpal) - -target_link_libraries(paltest_unlockfile_test2 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/test2.cpp b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/test2.cpp deleted file mode 100644 index 22c2cce2fb..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/test2.cpp +++ /dev/null @@ -1,154 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test2.c -** -** Purpose: Open a file, and call Unlock on the file, even though it has yet -** to be locked. Then lock a portion of the file, and attempt to call unlock -** on a larger portion of the file. Also, try to unlock a smaller portion -** than was locked. -** -** -**============================================================*/ - -#include -#include "../UnlockFile.h" - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile = NULL; - const char lpBuffer[] = "This is a test file."; - DWORD bytesWritten; - BOOL bRc = TRUE; - char fileName[] = "testfile.tmp"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open a file which is in the directory */ - TheFile = CreateFile(fileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",fileName,GetLastError()); - } - - bRc = WriteFile( - TheFile, // handle to file - lpBuffer, // data buffer - (DWORD)sizeof(lpBuffer), // number of bytes to write - &bytesWritten, // number of bytes written - NULL // overlapped buffer - ); - - if(!bRc) - { - Trace("ERROR: Could not write to file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - - } - else if(bytesWritten != (DWORD)sizeof(lpBuffer)) - { - Trace("ERROR: Could not write the correct number of bytes to the " - "file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Call unlock file on an unlocked file, this should return 0 */ - if(UnlockFile(TheFile, 0, 0, 5, 0) != 0) - { - Trace("ERROR: Attempted to unlock a file which was not locked and " - "the UnlockFile call was successful.\n"); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Lock the file */ - if(LockFile(TheFile, 0, 0, 5, 0) == 0) - { - Trace("ERROR: Failed to call LockFile on a valid file handle. " - "GetLastError returned %d.\n",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Try to unlock more of the file than was locked by LockFile */ - if(UnlockFile(TheFile, 0, 0, 10, 0) != 0) - { - Trace("ERROR: Attempted to unlock bytes 0 to 9, but only bytes " - "0 to 4 are locked. But, UnlockFile was successful, when it " - "should have failed.\n"); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Try to unlock less of the file than was locked by LockFile */ - if(UnlockFile(TheFile, 0, 0, 3, 0) != 0) - { - Trace("ERROR: Attempted to unlock bytes 0 to 2, but the bytes 0 to " - "4 were locked by LockFile. Unlockfile should have failed " - "when attempting this operation.\n"); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Properly unlock the file */ - if(UnlockFile(TheFile, 0, 0, 5, 0) == 0) - { - Trace("ERROR: UnlockFile failed to unlock bytes 0 to 4 of the file. " - "GetLastError returned %d.\n",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file.\n"); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/testinfo.dat deleted file mode 100644 index 932a4a2b8a..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test2/testinfo.dat +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = UnlockFile -Name = Positive test for UnlockFile API -TYPE = DEFAULT -EXE1 = test2 -Description -= Open a file, and call Unlock on the file, even though it has yet -= to be locked. Then lock a portion of the file, and attempt to call unlock -= on a larger portion of the file. Also, try to unlock a smaller portion -= than was locked. - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/CMakeLists.txt deleted file mode 100644 index 980a9b0f75..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(TESTSOURCES - test3.cpp -) - -add_executable(paltest_unlockfile_test3 - ${TESTSOURCES} -) - -add_dependencies(paltest_unlockfile_test3 coreclrpal) - -target_link_libraries(paltest_unlockfile_test3 - ${COMMON_TEST_LIBRARIES} -) - - -set(HELPERSOURCES - helper.cpp -) - -add_executable(paltest_unlockfile_test3_helper - ${HELPERSOURCES} -) - -add_dependencies(paltest_unlockfile_test3_helper coreclrpal) - -target_link_libraries(paltest_unlockfile_test3_helper - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/helper.cpp b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/helper.cpp deleted file mode 100644 index 650abf49ad..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/helper.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: helper.c -** -** Purpose: A child process which will lock a portion of the file, -** then try to unlock a portion of the file which was locked by the parent. -** -** -**============================================================*/ - -#include -#include "../UnlockFile.h" - -#define FILENAME "testfile.txt" -#define WAITFILENAME "waitfile" -#define BUF_SIZE 128 - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile, WaitFile; - int result = 0; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open the same file that the parent has opened and locked */ - TheFile = CreateFile(FILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Trace("ERROR: Could not open file '%s' with CreateFile.\n",FILENAME); - result = 1; - } - - /* Open up the WaitFile that we're using for IPC */ - WaitFile = CreateFile(WAITFILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (WaitFile == INVALID_HANDLE_VALUE) - { - Trace("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",WAITFILENAME,GetLastError()); - result = 1; - } - - /* Lock a section of the file different from which was locked in the - parent proccess - */ - if(LockFile(TheFile, 10, 0, 10, 0) == 0) - { - Trace("ERROR: The LockFile call within the child failed to lock " - "the file. GetLastError() returned %d.\n",GetLastError()); - result = 1; - } - - /* Attempt to unlock the portion of the file which was locked within the - parent process. - */ - if(UnlockFile(TheFile, 0, 0, 10, 0) != 0) - { - Trace("ERROR: The UnlockFile call within the child succeeded in " - "calling UnlockFile on the portion of the file which was " - "locked by the parent.\n"); - result = 1; - } - - // Sleep for a bit to give the parent a chance to block before we do. - Sleep(1000); - - /* Switch back to the parent, so it can check the child lock */ - SignalAndBusyWait(WaitFile); - - /* Finally, clean up the lock which was done within this proccess and - exit. - */ - if(UnlockFile(TheFile, 10, 0, 10, 0) == 0) - { - Trace("ERROR: The UnlockFile call within the child failed to unlock " - "the portion of the file which was locked by the child. " - "GetLastError() returned %d.\n", GetLastError()); - result = 1; - } - - PAL_TerminateEx(result); - return result; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/test3.cpp b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/test3.cpp deleted file mode 100644 index cf27aba0a3..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/test3.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test3.c -** -** Purpose: -** Lock a portion of the file with the parent. Then have the child lock -** another portion. Have the child attempt to call Unlock on the parent's -** locked data, and the parent do the same to the child. Ensure that the -** locks are respected. -** -** -**============================================================*/ - -#include -#include "../UnlockFile.h" - -#define HELPER "helper" -#define FILENAME "testfile.txt" -#define WAITFILENAME "waitfile" -#define BUF_SIZE 128 - -int RunTest(char* Helper, HANDLE TheFile, HANDLE WaitFile) -{ - STARTUPINFO si; - PROCESS_INFORMATION pi; - DWORD ChildRetCode = 0; - DWORD ParentRetCode = 0; - - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - - /* Load up the helper Process, and then Wait until it signals that it - is finished locking. - */ - if(!CreateProcess( NULL, Helper, NULL, - NULL, FALSE, 0, - NULL, NULL, &si, &pi)) - { - Fail("ERROR: CreateProcess failed to load executable '%s'.\n",Helper); - } - - SignalAndBusyWait(WaitFile); - - /* When the child proccess is finished setting its lock and testing the - parent lock, then the parent can test the child's lock. - */ - - if(UnlockFile(TheFile, 10, 0, 10, 0) != 0) - { - Trace("ERROR: The parent proccess called Unlock on the child " - "proccesses lock, and the function returned non-zero, when " - "it should have failed.\n"); - ParentRetCode = 1; - } - - /* Switch back to the child so that it can unlock its portion and - cleanup. - */ - - SignalFinish(WaitFile); - WaitForSingleObject(pi.hProcess,INFINITE); - - /* Get the return value from the helper process */ - if (GetExitCodeProcess(pi.hProcess, &ChildRetCode) == 0) - { - Fail("ERROR: GetExitCodeProccess failed when attempting to retrieve " - "the exit code of the child process.\n"); - } - - if(CloseHandle( pi.hProcess ) == 0) - { - Fail("ERROR: CloseHandle failed to close the process.\n"); - } - - if(CloseHandle( pi.hThread ) == 0) - { - Fail("ERROR: CloseHandle failed to close the thread.\n"); - } - - return (ChildRetCode || ParentRetCode); -} - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile = NULL; - HANDLE WaitFile = NULL; - char* WriteBuffer = "12345678901234567890123456"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open up the file we'll be using for some crude IPC */ - WaitFile = CreateFile(WAITFILENAME, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (WaitFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",WAITFILENAME,GetLastError()); - } - - /* Call the helper function to Create a file, write 'WriteBuffer' to - the file, and lock the file from bytes 0-9. - */ - TheFile = CreateAndLockFile(TheFile, FILENAME, WriteBuffer, - 0, 10); - - /* Run the test. Better errors are displayed by Trace throughout. */ - if(RunTest(HELPER, TheFile, WaitFile)) - { - Fail("ERROR: The test to check that the Unlock will not work on " - "on locks set by other proccesses failed.\n"); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file used for " - "testing the locks. GetLastError() returns %d.\n", - GetLastError()); - } - - if(CloseHandle(WaitFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the wait file. " - "GetLastError() returns %d.\n",GetLastError()); - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/testinfo.dat deleted file mode 100644 index bf7ec5f809..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test3/testinfo.dat +++ /dev/null @@ -1,17 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = UnlockFile -Name = Positive test for UnlockFile API -TYPE = DEFAULT -EXE1 = test3 -EXE2 = helper -Description -= Lock a portion of the file with the parent. Then have the child lock -= another portion. Have the child attempt to call Unlock on the parent's -= locked data, and the parent do the same to the child. Ensure that the -= locks are respected. - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/CMakeLists.txt b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/CMakeLists.txt deleted file mode 100644 index e721b04b6c..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test4.cpp -) - -add_executable(paltest_unlockfile_test4 - ${SOURCES} -) - -add_dependencies(paltest_unlockfile_test4 coreclrpal) - -target_link_libraries(paltest_unlockfile_test4 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/test4.cpp b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/test4.cpp deleted file mode 100644 index 55abcd24bc..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/test4.cpp +++ /dev/null @@ -1,187 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test4.c -** -** Purpose: Pass an invalid handle to UnlockFile. Pass a null handle to -** UnlockFile. Create a file and lock two consecuative regions and call -** UnlockFile on the whole region (this should fail, see msdn) -** -** -**============================================================*/ - -#include -#include "../UnlockFile.h" - -int __cdecl main(int argc, char *argv[]) -{ - HANDLE TheFile = NULL; - const char lpBuffer[] = "This is a test file."; - DWORD bytesWritten; - BOOL bRc = TRUE; - char fileName[] = "testfile.tmp"; - - if(0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Open a file which is in the directory */ - TheFile = CreateFile(fileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",fileName,GetLastError()); - } - - bRc = WriteFile( - TheFile, // handle to file - lpBuffer, // data buffer - (DWORD)sizeof(lpBuffer), // number of bytes to write - &bytesWritten, // number of bytes written - NULL // overlapped buffer - ); - - if(!bRc) - { - Trace("ERROR: Could not write to file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - - } - else if(bytesWritten != (DWORD)sizeof(lpBuffer)) - { - Trace("ERROR: Could not write the correct number of bytes to the " - "file '%s' with WriteFile.",fileName); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file.\n"); - } - - - /* Test an invalid handle and a NULL handle */ - if(UnlockFile(TheFile, 0, 0, 0, 0) != 0) - { - Fail("ERROR: Called UnlockFile on an invalid HANDLE and it " - "returned a success value.\n"); - } - - if(UnlockFile(NULL, 0, 0, 0, 0) != 0) - { - Fail("ERROR: Called UnlockFile with NULL passed for the HANDLE and " - "it returned a success value.\n"); - } - - /* Re-open the file */ - TheFile = CreateFile(fileName, - GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (TheFile == INVALID_HANDLE_VALUE) - { - Fail("ERROR: Could not open file '%s' with CreateFile. " - "GetLastError() returned %d.\n",fileName,GetLastError()); - } - - /* Lock two consecuative regions of this file */ - if(LockFile(TheFile, 0, 0, 5, 0) == 0) - { - Trace("ERROR: LockFile failed attempting to lock bytes 0-4. " - "GetLastError() returned %d.\n",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(LockFile(TheFile, 5, 0, 5, 0) == 0) - { - Fail("ERROR: LockFile failed attempting to lock bytes 5-9. " - "GetLastError() returned %d.\n",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - /* Attempt to unlock the entire region which was locked with one - call to UnlockFile. This should fail. - */ - if(UnlockFile(TheFile, 0, 0, 10, 0) != 0) - { - Fail("ERROR: Called UnlockFile on bytes 0-9 which were locked with " - "two seperate LockFile calls. This should have failed. " - "UnlockFile will not unlock consecuative locked regions.\n"); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - - /* Now, unlock the regions one at a time. */ - if(UnlockFile(TheFile, 0, 0, 5, 0) == 0) - { - Fail("ERROR: UnlockFile failed when attempting to unlock bytes " - "0-4 of the file. GetLastError() returned %d.\n",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(UnlockFile(TheFile, 5, 0, 5, 0) == 0) - { - Fail("ERROR: UnlockFile failed when attempting to unlock bytes " - "5-9 of the file. GetLastError() returned %d.\n",GetLastError()); - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file."); - } - Fail(""); - } - - if(CloseHandle(TheFile) == 0) - { - Fail("ERROR: CloseHandle failed to close the file.\n"); - } - - PAL_Terminate(); - return PASS; -} - diff --git a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/testinfo.dat b/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/testinfo.dat deleted file mode 100644 index 4f3885b978..0000000000 --- a/src/pal/tests/palsuite/filemapping_memmgt/UnlockFile/test4/testinfo.dat +++ /dev/null @@ -1,16 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Filemapping_memmgt -Function = UnlockFile -Name = Positive test for UnlockFile API -TYPE = DEFAULT -EXE1 = test4 -Description -= Pass an invalid handle to UnlockFile. Pass a null handle to -= UnlockFile. Create a file and lock two consecuative regions and call -= UnlockFile on the whole region (this should fail, see msdn) - - diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt index 0c8892a4a0..ea088d75a2 100644 --- a/src/pal/tests/palsuite/paltestlist.txt +++ b/src/pal/tests/palsuite/paltestlist.txt @@ -471,8 +471,6 @@ filemapping_memmgt/HeapReAlloc/test5/paltest_heaprealloc_test5 filemapping_memmgt/LocalAlloc/test1/paltest_localalloc_test1 filemapping_memmgt/LocalFree/test1/paltest_localfree_test1 filemapping_memmgt/LocalFree/test2/paltest_localfree_test2 -filemapping_memmgt/LockFile/test2/paltest_lockfile_test2 -filemapping_memmgt/LockFile/test7/paltest_lockfile_test7 filemapping_memmgt/MapViewOfFile/test1/paltest_mapviewoffile_test1 filemapping_memmgt/MapViewOfFile/test2/paltest_mapviewoffile_test2 filemapping_memmgt/MapViewOfFile/test3/paltest_mapviewoffile_test3 @@ -485,8 +483,6 @@ filemapping_memmgt/RtlMoveMemory/test1/paltest_rtlmovememory_test1 filemapping_memmgt/RtlMoveMemory/test3/paltest_rtlmovememory_test3 filemapping_memmgt/RtlMoveMemory/test4/paltest_rtlmovememory_test4 filemapping_memmgt/RtlMoveMemory/test5/paltest_rtlmovememory_test5 -filemapping_memmgt/UnlockFile/test2/paltest_unlockfile_test2 -filemapping_memmgt/UnlockFile/test4/paltest_unlockfile_test4 filemapping_memmgt/UnmapViewOfFile/test1/paltest_unmapviewoffile_test1 filemapping_memmgt/UnmapViewOfFile/test2/paltest_unmapviewoffile_test2 filemapping_memmgt/VirtualAlloc/test1/paltest_virtualalloc_test1 @@ -520,7 +516,6 @@ filemapping_memmgt/VirtualProtect/test4/paltest_virtualprotect_test4 filemapping_memmgt/VirtualProtect/test6/paltest_virtualprotect_test6 filemapping_memmgt/VirtualProtect/test7/paltest_virtualprotect_test7 filemapping_memmgt/VirtualQuery/test1/paltest_virtualquery_test1 -file_io/AreFileApisANSI/test1/paltest_arefileapisansi_test1 file_io/CompareFileTime/test1/paltest_comparefiletime_test1 file_io/CopyFileA/test1/paltest_copyfilea_test1 file_io/CopyFileA/test2/paltest_copyfilea_test2 @@ -535,7 +530,6 @@ file_io/DeleteFileW/test1/paltest_deletefilew_test1 file_io/errorpathnotfound/test2/paltest_errorpathnotfound_test2 file_io/errorpathnotfound/test3/paltest_errorpathnotfound_test3 file_io/FILECanonicalizePath/paltest_filecanonicalizepath_test1 -file_io/FileTimeToDosDateTime/test1/paltest_filetimetodosdatetime_test1 file_io/FindClose/test1/paltest_findclose_test1 file_io/FindFirstFileA/test1/paltest_findfirstfilea_test1 file_io/FindFirstFileW/test1/paltest_findfirstfilew_test1 @@ -544,27 +538,14 @@ file_io/FindNextFileA/test2/paltest_findnextfilea_test2 file_io/FindNextFileW/test1/paltest_findnextfilew_test1 file_io/FindNextFileW/test2/paltest_findnextfilew_test2 file_io/FlushFileBuffers/test1/paltest_flushfilebuffers_test1 -file_io/GetConsoleCP/test1/paltest_getconsolecp_test1 file_io/GetConsoleOutputCP/test1/paltest_getconsoleoutputcp_test1 file_io/GetCurrentDirectoryA/test1/paltest_getcurrentdirectorya_test1 file_io/GetCurrentDirectoryW/test1/paltest_getcurrentdirectoryw_test1 -file_io/GetDiskFreeSpaceW/test1/paltest_getdiskfreespacew_test1 -file_io/GetDiskFreeSpaceW/test2/paltest_getdiskfreespacew_test2 file_io/GetFileAttributesA/test1/paltest_getfileattributesa_test1 file_io/GetFileAttributesExW/test2/paltest_getfileattributesexw_test2 file_io/GetFileAttributesW/test1/paltest_getfileattributesw_test1 file_io/GetFileSize/test1/paltest_getfilesize_test1 file_io/GetFileSizeEx/test1/paltest_getfilesizeex_test1 -file_io/GetFileTime/test1/paltest_getfiletime_test1 -file_io/GetFileTime/test2/paltest_getfiletime_test2 -file_io/GetFileTime/test3/paltest_getfiletime_test3 -file_io/GetFileTime/test4/paltest_getfiletime_test4 -file_io/GetFileTime/test5/paltest_getfiletime_test5 -file_io/GetFileTime/test6/paltest_getfiletime_test6 -file_io/GetFileTime/test7/paltest_getfiletime_test7 -file_io/GetFileType/test1/paltest_getfiletype_test1 -file_io/GetFileType/test2/paltest_getfiletype_test2 -file_io/GetFileType/test3/paltest_getfiletype_test3 file_io/GetFullPathNameA/test1/paltest_getfullpathnamea_test1 file_io/GetFullPathNameA/test3/paltest_getfullpathnamea_test3 file_io/GetFullPathNameA/test4/paltest_getfullpathnamea_test4 @@ -611,10 +592,6 @@ file_io/SetFilePointer/test4/paltest_setfilepointer_test4 file_io/SetFilePointer/test5/paltest_setfilepointer_test5 file_io/SetFilePointer/test6/paltest_setfilepointer_test6 file_io/SetFilePointer/test7/paltest_setfilepointer_test7 -file_io/SetFileTime/test1/paltest_setfiletime_test1 -file_io/SetFileTime/test2/paltest_setfiletime_test2 -file_io/SetFileTime/test3/paltest_setfiletime_test3 -file_io/SetFileTime/test4/paltest_setfiletime_test4 file_io/WriteFile/test1/paltest_writefile_test1 file_io/WriteFile/test3/paltest_writefile_test3 file_io/WriteFile/test4/paltest_writefile_test4 diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index 4dac7e94c6..0199ad12f1 100644 --- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -72,11 +72,6 @@ filemapping_memmgt/GetModuleFileNameA/test1/paltest_getmodulefilenamea_test1 filemapping_memmgt/GetModuleFileNameW/test1/paltest_getmodulefilenamew_test1 filemapping_memmgt/GetProcAddress/test1/paltest_getprocaddress_test1 filemapping_memmgt/GetProcAddress/test2/paltest_getprocaddress_test2 -filemapping_memmgt/LockFile/test1/paltest_lockfile_test1 -filemapping_memmgt/LockFile/test3/paltest_lockfile_test3 -filemapping_memmgt/LockFile/test4/paltest_lockfile_test4 -filemapping_memmgt/LockFile/test5/paltest_lockfile_test5 -filemapping_memmgt/LockFile/test6/paltest_lockfile_test6 filemapping_memmgt/OpenFileMappingA/test1/paltest_openfilemappinga_test1 filemapping_memmgt/OpenFileMappingA/test2/paltest_openfilemappinga_test2 filemapping_memmgt/OpenFileMappingA/test3/paltest_openfilemappinga_test3 @@ -86,15 +81,12 @@ filemapping_memmgt/OpenFileMappingW/test3/paltest_openfilemappingw_test3 filemapping_memmgt/ReadProcessMemory/ReadProcessMemory_neg1/paltest_readprocessmemory_readprocessmemory_neg1 filemapping_memmgt/ReadProcessMemory/test1/paltest_readprocessmemory_test1 filemapping_memmgt/ReadProcessMemory/test2/paltest_readprocessmemory_test2 -filemapping_memmgt/UnlockFile/test1/paltest_unlockfile_test1 -filemapping_memmgt/UnlockFile/test3/paltest_unlockfile_test3 file_io/CopyFileW/test1/paltest_copyfilew_test1 file_io/CreateDirectoryA/test2/paltest_createdirectorya_test2 file_io/CreateDirectoryW/test2/paltest_createdirectoryw_test2 file_io/CreateFileA/test1/paltest_createfilea_test1 file_io/CreateFileW/test1/paltest_createfilew_test1 file_io/errorpathnotfound/test1/paltest_errorpathnotfound_test1 -file_io/errorpathnotfound/test4/paltest_errorpathnotfound_test4 file_io/GetFileAttributesExW/test1/paltest_getfileattributesexw_test1 file_io/GetFullPathNameA/test2/paltest_getfullpathnamea_test2 file_io/GetFullPathNameW/test2/paltest_getfullpathnamew_test2 @@ -103,10 +95,8 @@ file_io/GetTempFileNameW/test1/paltest_gettempfilenamew_test1 file_io/GetTempFileNameW/test2/paltest_gettempfilenamew_test2 file_io/gettemppatha/test1/paltest_gettemppatha_test1 file_io/GetTempPathW/test1/paltest_gettemppathw_test1 -file_io/MoveFileA/test1/paltest_movefilea_test1 file_io/MoveFileExA/test1/paltest_movefileexa_test1 file_io/MoveFileExW/test1/paltest_movefileexw_test1 -file_io/MoveFileW/test1/paltest_movefilew_test1 file_io/ReadFile/test1/paltest_readfile_test1 file_io/SetFileAttributesA/test1/paltest_setfileattributesa_test1 file_io/SetFileAttributesA/test4/paltest_setfileattributesa_test4 diff --git a/src/pal/tests/palsuite/palverify.dat b/src/pal/tests/palsuite/palverify.dat index d4cb311010..cdcb4cb4e3 100644 --- a/src/pal/tests/palsuite/palverify.dat +++ b/src/pal/tests/palsuite/palverify.dat @@ -498,7 +498,6 @@ exception_handling/pal_try_leave_finally/test1,1 exception_handling/raiseexception/test1,1 exception_handling/raiseexception/test2,1 exception_handling/raiseexception/test3,1 -file_io/arefileapisansi/test1,1 file_io/comparefiletime/test1,1 file_io/copyfilea/test1,1 file_io/copyfilea/test2,1 @@ -515,32 +514,19 @@ file_io/deletefilew/test1,1 file_io/errorpathnotfound/test1,1 file_io/errorpathnotfound/test2,1 file_io/errorpathnotfound/test3,1 -#file_io/errorpathnotfound/test4,1 -file_io/filetimetodosdatetime/test1,1 file_io/findclose/test1,1 file_io/findfirstfilea/test1,1 #file_io/findfirstfilew/test1,1 file_io/findnextfilea/test1,1 file_io/findnextfilew/test1,1 file_io/flushfilebuffers/test1,1 -file_io/getconsolecp/test1,1 file_io/getconsoleoutputcp/test1,1 file_io/getcurrentdirectorya/test1,1 file_io/getcurrentdirectoryw/test1,1 -file_io/getdiskfreespacew/test1,1 #file_io/getfileattributesa/test1,1 #file_io/getfileattributesexw/test1,1 file_io/getfileattributesexw/test2,1 #file_io/getfileattributesw/test1,1 -file_io/getfiletime/test1,1 -file_io/getfiletime/test2,1 -file_io/getfiletime/test3,1 -file_io/getfiletime/test4,1 -file_io/getfiletime/test6,1 -file_io/getfiletime/test7,1 -file_io/getfiletype/test1,1 -file_io/getfiletype/test2,1 -file_io/getfiletype/test3,1 file_io/getfullpathnamea/test1,1 file_io/getfullpathnamea/test2,1 file_io/getfullpathnamea/test3,1 @@ -560,7 +546,6 @@ file_io/gettempfilenamew/test3,1 file_io/gettemppatha/test1,1 file_io/gettemppathw/test1,1 file_io/movefileexw/test1,1 -file_io/movefilew/test1,1 #file_io/readfile/test1,1 file_io/readfile/test2,1 file_io/readfile/test3,1 @@ -585,10 +570,6 @@ file_io/setfilepointer/test1,1 file_io/setfilepointer/test2,1 file_io/setfilepointer/test3,1 file_io/setfilepointer/test4,1 -file_io/setfiletime/test1,1 -file_io/setfiletime/test2,1 -file_io/setfiletime/test3,1 -file_io/setfiletime/test4,1 file_io/writefile/test1,1 file_io/writefile/test2,1 file_io/writefile/test3,1 -- cgit v1.2.3 From 602ebe9b24948465ec157a8a8037ff2855435e04 Mon Sep 17 00:00:00 2001 From: Jim Ma Date: Wed, 13 Sep 2017 09:33:40 +0800 Subject: Re-implemented the ecvt function. (#12894) * Re-implemented the ecvt function. Instead of leveraging snprintf, re-implement the ecvt function according to the paper: https://www.cs.indiana.edu/~dyb/pubs/FP-Printing-PLDI96.pdf Note: 1. This commit won't fix any existing bug. 2. This is a raw implementation of the paper. The performance on Linux only gain 10%. We could tune the performance further. Fix #10651 * Resolve a cross platform header file issue. Fix #10651 * Fixed a minor bug. Improved the performance. Fix #10651 * Modified code according to code review feedback. This commit fixed most of the issue found in code review. However, some of the feedback may not be involved due to either little performance improvement or need a POC. Fix #10651 * Try to fix constexpr compile error on Windows. Fix #10651 * Fixed a potential overflow bug in BigNum::Compare. Fix #10651 * Improved multiply 10 operation. Use shift and add operation to replace actual multiply operation. Fix #10651 * Remove old _ecvt function. Fix #10651 * Documented the reason why we do not need m+ and m-. Fix #10651 * Changed exp > 0 to exp != 0 to remove any confusion. exp should fall in 1 ~ 2046 for normalized value. Denormalized value has exp = 0. Fix #10651 * Disable the _ecvt tests. Fix #10651 * Removed _ecvt tests. Fix #10651 * Re-implemented LogBase2. Fix #10651 * Use DWORD and DWORD64 for _BitScanReverse and _BitScanReverse64 Fix #10651 * Fixed x86 compile issue for _BitScanReverse64 x86 does not support _BitScanReverse64 so we have to add additional shift operations to handle it. Fix #10651 * Implemented BitScanReverse64 and BitScanReverse in pal.h Fix #10651 * Remove the confusion comment which is unrelated to BitScanReverse. Fix #10651 * Introduced wmemset to enhance the perf for 0.0 Fix #10651 * Improved the performance of converting 0.0. Fix #10651 * Renamed ecvt to DoubleToNumberWorker. Fix #10651 * Updated code according to the code review feedback. Fix #10651 --- src/pal/tests/palsuite/c_runtime/CMakeLists.txt | 1 - .../tests/palsuite/c_runtime/_ecvt/CMakeLists.txt | 4 - .../palsuite/c_runtime/_ecvt/test1/CMakeLists.txt | 17 --- .../tests/palsuite/c_runtime/_ecvt/test1/test1.cpp | 135 --------------------- .../palsuite/c_runtime/_ecvt/test1/testinfo.dat | 14 --- .../tests/palsuite/paltestlist_to_be_reviewed.txt | 1 - src/pal/tests/palsuite/palverify.dat | 1 - 7 files changed, 173 deletions(-) delete mode 100644 src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.cpp delete mode 100644 src/pal/tests/palsuite/c_runtime/_ecvt/test1/testinfo.dat (limited to 'src/pal/tests') diff --git a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt index 7a6b2cd919..64ac174a97 100644 --- a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt @@ -139,7 +139,6 @@ add_subdirectory(wcstol) add_subdirectory(wcstoul) add_subdirectory(wprintf) add_subdirectory(_alloca) -add_subdirectory(_ecvt) add_subdirectory(_fdopen) add_subdirectory(_finite) add_subdirectory(_finitef) diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt deleted file mode 100644 index f6aa0cb2d9..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_ecvt/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt deleted file mode 100644 index 152271cf59..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_ecvt_test1 - ${SOURCES} -) - -add_dependencies(paltest_ecvt_test1 coreclrpal) - -target_link_libraries(paltest_ecvt_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.cpp deleted file mode 100644 index fbcf11ecfc..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/test1.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*===================================================================== -** -** Source: c_runtime/_ecvt/test1/test1.c -** -** Purpose: Call the _ecvt function on a number of cases. Check that it -** handles negatives, positives and double bounds correctly. Also check that -** the 'digit' specification works. -** -** -**===================================================================*/ - -#include - -#define INT64_TO_DOUBLE(a) (*(double*)&a) - -INT64 NaN = 0x7ff8000000000000; -INT64 NegativeInfinity = 0xfff0000000000000; -INT64 NegativeSmall = 0x8000000000000001; -INT64 PositiveInfinity = 0x7ff0000000000000; -INT64 PositiveSmall = 0x0000000000000001; - -struct testCase -{ - double value; /* number to be converted */ - int precision; /* number of digits to be stored */ - int decimal; /* (expected) decimal point position for stored - * number */ - int sign; /* (expected) return value */ - char expResult[256]; /* (expected) character array to be returned - * NOTE: this necessarily limits precision - * to a value between 0 and 255 */ - char bsdExpResult[256]; /* (expected) character array to be returned - * NOTE: this necessarily limits precision - * to a value between 0 and 255 */ -}; - -int __cdecl main(int argc, char **argv) -{ - char *result; - int testDecimal; - int testSign; - int i=0; - - struct testCase testCases[] = - { - /* odd ball values */ - {INT64_TO_DOUBLE(NaN), 7, 1, 0, "1#QNAN0" }, - /* positive values */ - {0, 0, 0, 0, ""}, - {INT64_TO_DOUBLE(PositiveSmall), 17, -323, 0, - "49406564584124654"}, - {.00123, 3, -2, 0, "123"}, - {.123, 3, 0, 0, "123"}, - {123, 3, 3, 0, "123"}, - {3.1415926535, 9, 1, 0, "314159265"}, - {3.1415926535, 10, 1, 0, "3141592654"}, - {3.1415926535, 11, 1, 0, "31415926535"}, - {3.1415926535, 12, 1, 0, "314159265350"}, - {184467444073709570000.0, 21, 21, 0, "184467444073709570000", - "184467444073709568000" }, - {184467444073709570000.0, 22, 21, 0, "1844674440737095700000", - "1844674440737095680000" }, - {INT64_TO_DOUBLE(PositiveInfinity), 7, 1, 0, "1#INF00" }, - /* negative values */ - {-0, 0, 0, 0, ""}, - {INT64_TO_DOUBLE(NegativeSmall), 17, -323, 1, - "49406564584124654"}, - {-.00123, 3, -2, 1, "123"}, - {-.123, 3, 0, 1, "123"}, - {-123, 3, 3, 1, "123"}, - {-3.1415926535, 9, 1, 1, "314159265"}, - {-3.1415926535, 10, 1, 1, "3141592654"}, - {-3.1415926535, 11, 1, 1, "31415926535"}, - {-3.1415926535, 12, 1, 1, "314159265350"}, - {-184467444073709570000.0, 21, 21, 1, "184467444073709570000", - "184467444073709568000" }, - {-184467444073709570000.0, 22, 21, 1, "1844674440737095700000", - "1844674440737095680000" }, - {INT64_TO_DOUBLE(NegativeInfinity), 7, 1, 1, "1#INF00"} - - }; - - if (0 != (PAL_Initialize(argc, argv))) - { - return FAIL; - } - - /* Loop through each case. Call _ecvt on each test case and check the - result. - */ - - for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++) - { - result = _ecvt(testCases[i].value, - testCases[i].precision, - &testDecimal, - &testSign); - - if (( strcmp(testCases[i].expResult, result) != 0 && - strcmp(testCases[i].bsdExpResult, result) != 0 ) || - - ( testCases[i].sign != testSign ) || - ( testCases[i].decimal != testDecimal )) - - { - Fail("PALSUITE ERROR: Test %d\n" - "-----------------------\n" - "testCases[i].value = '%f'\n" - "testCases[i].precision = '%d'\n" - "testCases[i].decimal = '%d'\n" - "testCases[i].sign = '%d'\n" - "testCases[i].expResult = '%s'\n" - "result = '%s'\n" - "testDecimal = '%d'\n" - "testSign = '%d'\n\n", - i, - testCases[i].value, - testCases[i].precision, - testCases[i].decimal, - testCases[i].sign, - testCases[i].expResult, - result, - testDecimal, - testSign); - } - - } - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_ecvt/test1/testinfo.dat deleted file mode 100644 index 12e7292ec7..0000000000 --- a/src/pal/tests/palsuite/c_runtime/_ecvt/test1/testinfo.dat +++ /dev/null @@ -1,14 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = C Runtime -Function = _ecvt -Name = Call _ecvt on normal values, negatives, exponents and hex digits. -TYPE = DEFAULT -EXE1 = test1 -Description -= Call the _ecvt function on a number of cases. Check that it -= handles negatives, positives and double bounds correctly. Also check that -= the 'digit' specification works. diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index 0199ad12f1..16be5e6762 100644 --- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -22,7 +22,6 @@ c_runtime/vprintf/test1/paltest_vprintf_test1 c_runtime/vswprintf/test2/paltest_vswprintf_test2 c_runtime/vswprintf/test7/paltest_vswprintf_test7 c_runtime/wprintf/test2/paltest_wprintf_test2 -c_runtime/_ecvt/test1/paltest_ecvt_test1 c_runtime/_gcvt/test1/paltest_gcvt_test1 c_runtime/_gcvt/test2/paltest_gcvt_test2 c_runtime/_getw/test1/paltest_getw_test1 diff --git a/src/pal/tests/palsuite/palverify.dat b/src/pal/tests/palsuite/palverify.dat index cdcb4cb4e3..3d711c1895 100644 --- a/src/pal/tests/palsuite/palverify.dat +++ b/src/pal/tests/palsuite/palverify.dat @@ -4,7 +4,6 @@ c_runtime/__iscsym/test1,1 c_runtime/_alloca/test1,1 -c_runtime/_ecvt/test1,1 c_runtime/_fdopen/test1,1 c_runtime/_finite/test1,1 c_runtime/_finitef/test1,1 -- cgit v1.2.3