diff options
author | Adeel Mujahid <3840695+am11@users.noreply.github.com> | 2022-07-17 08:11:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-17 08:11:11 +0300 |
commit | 3ea30ed321949d238bf97534a2a8cbabf580f238 (patch) | |
tree | 4e80b5512b1b1337629af441aa6a21fceceaf2b9 /src/coreclr/pal | |
parent | 8a709bca625d079bb97ee7a9c524217bbc6c3278 (diff) |
Fix typos (#72314)
* Fix typos
* Cleanup trailing whitespaces in committed files
* Revert a macro for win32 compat
* Disambiguate test data method
* Revert XMLPath test which rely on external assets
* Revert whitespace change in Xml tests
* Revert ClrEtwAl and ILLink.Shared
* Revert crossgen2 props/targets and *.wxl
Diffstat (limited to 'src/coreclr/pal')
41 files changed, 900 insertions, 900 deletions
diff --git a/src/coreclr/pal/inc/rt/palrt.h b/src/coreclr/pal/inc/rt/palrt.h index 10808247710..06aa5e27592 100644 --- a/src/coreclr/pal/inc/rt/palrt.h +++ b/src/coreclr/pal/inc/rt/palrt.h @@ -933,7 +933,7 @@ interface IMoniker; typedef VOID (WINAPI *LPOVERLAPPED_COMPLETION_ROUTINE)( DWORD dwErrorCode, - DWORD dwNumberOfBytesTransfered, + DWORD dwNumberOfBytesTransferred, LPOVERLAPPED lpOverlapped); // diff --git a/src/coreclr/pal/inc/rt/sal.h b/src/coreclr/pal/inc/rt/sal.h index ef976be402f..17273130fd8 100644 --- a/src/coreclr/pal/inc/rt/sal.h +++ b/src/coreclr/pal/inc/rt/sal.h @@ -838,7 +838,7 @@ enum __SAL_YesNo {_SAL_notpresent, _SAL_no, _SAL_maybe, _SAL_yes, _SAL_default}; // 'out' with buffer size -// e.g. void GetIndeces( _Out_cap_(cIndeces) int* rgIndeces, size_t cIndices ); +// e.g. void GetIndices( _Out_cap_(cIndices) int* rgIndices, size_t cIndices ); // buffer capacity is described by another parameter #define _Out_cap_(size) _SAL1_1_Source_(_Out_cap_, (size), _Pre_cap_(size) _Post_valid_impl_) #define _Out_opt_cap_(size) _SAL1_1_Source_(_Out_opt_cap_, (size), _Pre_opt_cap_(size) _Post_valid_impl_) @@ -921,7 +921,7 @@ enum __SAL_YesNo {_SAL_notpresent, _SAL_no, _SAL_maybe, _SAL_yes, _SAL_default}; // 'inout' buffers with initialized elements before and after the call -// e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndeces, size_t cIndices ); +// e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndices, size_t cIndices ); #define _Inout_count_(size) _SAL1_1_Source_(_Inout_count_, (size), _Prepost_count_(size)) #define _Inout_opt_count_(size) _SAL1_1_Source_(_Inout_opt_count_, (size), _Prepost_opt_count_(size)) #define _Inout_bytecount_(size) _SAL1_1_Source_(_Inout_bytecount_, (size), _Prepost_bytecount_(size)) @@ -933,7 +933,7 @@ enum __SAL_YesNo {_SAL_notpresent, _SAL_no, _SAL_maybe, _SAL_yes, _SAL_default}; #define _Inout_opt_bytecount_c_(size) _SAL1_1_Source_(_Inout_opt_bytecount_c_, (size), _Prepost_opt_bytecount_c_(size)) // nullterminated 'inout' buffers with initialized elements before and after the call -// e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndeces, size_t cIndices ); +// e.g. void ModifyIndices( _Inout_count_(cIndices) int* rgIndices, size_t cIndices ); #define _Inout_z_count_(size) _SAL1_1_Source_(_Inout_z_count_, (size), _Prepost_z_ _Prepost_count_(size)) #define _Inout_opt_z_count_(size) _SAL1_1_Source_(_Inout_opt_z_count_, (size), _Prepost_z_ _Prepost_opt_count_(size)) #define _Inout_z_bytecount_(size) _SAL1_1_Source_(_Inout_z_bytecount_, (size), _Prepost_z_ _Prepost_bytecount_(size)) diff --git a/src/coreclr/pal/inc/rt/specstrings_strict.h b/src/coreclr/pal/inc/rt/specstrings_strict.h index 816ba80298a..4f36537c977 100644 --- a/src/coreclr/pal/inc/rt/specstrings_strict.h +++ b/src/coreclr/pal/inc/rt/specstrings_strict.h @@ -1137,7 +1137,7 @@ /************************************************************************** * This should go away. It's only for __success which we should split into. -* __success and __typdecl_sucess +* __success and __typdecl_success ***************************************************************************/ #define __$allowed_on_function_or_typedecl /* empty */ #if (__SPECSTRINGS_STRICT_LEVEL == 1) || (__SPECSTRINGS_STRICT_LEVEL == 2) diff --git a/src/coreclr/pal/prebuilt/corerror/mscorurt.rc b/src/coreclr/pal/prebuilt/corerror/mscorurt.rc index ec20ad3a47a..c4bcccc6e24 100644 --- a/src/coreclr/pal/prebuilt/corerror/mscorurt.rc +++ b/src/coreclr/pal/prebuilt/corerror/mscorurt.rc @@ -260,7 +260,7 @@ BEGIN MSG_FOR_URT_HR(CORDBG_E_ILLEGAL_IN_OPTIMIZED_CODE) "The operation failed because the thread is in optimized code." MSG_FOR_URT_HR(CORDBG_E_APPDOMAIN_MISMATCH) "A supplied object or type belongs to the wrong AppDomain." MSG_FOR_URT_HR(CORDBG_E_CONTEXT_UNVAILABLE) "The thread's context is not available." - MSG_FOR_URT_HR(CORDBG_E_UNCOMPATIBLE_PLATFORMS) "The operation failed because debuggee and debugger are on incompatible platforms." + MSG_FOR_URT_HR(CORDBG_E_INCOMPATIBLE_PLATFORMS) "The operation failed because debuggee and debugger are on incompatible platforms." MSG_FOR_URT_HR(CORDBG_E_DEBUGGING_DISABLED) "The operation failed because the debugging has been disabled" MSG_FOR_URT_HR(CORDBG_E_DETACH_FAILED_ON_ENC) "Detach is illegal after an Edit and Continue on a module." MSG_FOR_URT_HR(CORDBG_E_CURRENT_EXCEPTION_IS_OUTSIDE_CURRENT_EXECUTION_SCOPE) "Cannot intercept the current exception at the specified frame." diff --git a/src/coreclr/pal/prebuilt/inc/cordebug.h b/src/coreclr/pal/prebuilt/inc/cordebug.h index a868b7f2bfa..2d71f01fe85 100644 --- a/src/coreclr/pal/prebuilt/inc/cordebug.h +++ b/src/coreclr/pal/prebuilt/inc/cordebug.h @@ -15644,12 +15644,12 @@ EXTERN_C const IID IID_ICorDebugArrayValue; /* [in] */ ULONG32 cdim, /* [length_is][size_is][out] */ ULONG32 dims[ ]) = 0; - virtual HRESULT STDMETHODCALLTYPE HasBaseIndicies( - /* [out] */ BOOL *pbHasBaseIndicies) = 0; + virtual HRESULT STDMETHODCALLTYPE HasBaseIndices( + /* [out] */ BOOL *pbHasBaseIndices) = 0; - virtual HRESULT STDMETHODCALLTYPE GetBaseIndicies( + virtual HRESULT STDMETHODCALLTYPE GetBaseIndices( /* [in] */ ULONG32 cdim, - /* [length_is][size_is][out] */ ULONG32 indicies[ ]) = 0; + /* [length_is][size_is][out] */ ULONG32 indices[ ]) = 0; virtual HRESULT STDMETHODCALLTYPE GetElement( /* [in] */ ULONG32 cdim, @@ -15722,14 +15722,14 @@ EXTERN_C const IID IID_ICorDebugArrayValue; /* [in] */ ULONG32 cdim, /* [length_is][size_is][out] */ ULONG32 dims[ ]); - HRESULT ( STDMETHODCALLTYPE *HasBaseIndicies )( + HRESULT ( STDMETHODCALLTYPE *HasBaseIndices )( ICorDebugArrayValue * This, - /* [out] */ BOOL *pbHasBaseIndicies); + /* [out] */ BOOL *pbHasBaseIndices); - HRESULT ( STDMETHODCALLTYPE *GetBaseIndicies )( + HRESULT ( STDMETHODCALLTYPE *GetBaseIndices )( ICorDebugArrayValue * This, /* [in] */ ULONG32 cdim, - /* [length_is][size_is][out] */ ULONG32 indicies[ ]); + /* [length_is][size_is][out] */ ULONG32 indices[ ]); HRESULT ( STDMETHODCALLTYPE *GetElement )( ICorDebugArrayValue * This, @@ -15797,11 +15797,11 @@ EXTERN_C const IID IID_ICorDebugArrayValue; #define ICorDebugArrayValue_GetDimensions(This,cdim,dims) \ ( (This)->lpVtbl -> GetDimensions(This,cdim,dims) ) -#define ICorDebugArrayValue_HasBaseIndicies(This,pbHasBaseIndicies) \ - ( (This)->lpVtbl -> HasBaseIndicies(This,pbHasBaseIndicies) ) +#define ICorDebugArrayValue_HasBaseIndices(This,pbHasBaseIndices) \ + ( (This)->lpVtbl -> HasBaseIndices(This,pbHasBaseIndices) ) -#define ICorDebugArrayValue_GetBaseIndicies(This,cdim,indicies) \ - ( (This)->lpVtbl -> GetBaseIndicies(This,cdim,indicies) ) +#define ICorDebugArrayValue_GetBaseIndices(This,cdim,indices) \ + ( (This)->lpVtbl -> GetBaseIndices(This,cdim,indices) ) #define ICorDebugArrayValue_GetElement(This,cdim,indices,ppValue) \ ( (This)->lpVtbl -> GetElement(This,cdim,indices,ppValue) ) diff --git a/src/coreclr/pal/prebuilt/inc/corerror.h b/src/coreclr/pal/prebuilt/inc/corerror.h index e1b0e5c36b2..2bfebe10fee 100644 --- a/src/coreclr/pal/prebuilt/inc/corerror.h +++ b/src/coreclr/pal/prebuilt/inc/corerror.h @@ -331,7 +331,7 @@ #define CORDBG_E_ILLEGAL_IN_OPTIMIZED_CODE EMAKEHR(0x1c26) #define CORDBG_E_APPDOMAIN_MISMATCH EMAKEHR(0x1c28) #define CORDBG_E_CONTEXT_UNVAILABLE EMAKEHR(0x1c29) -#define CORDBG_E_UNCOMPATIBLE_PLATFORMS EMAKEHR(0x1c30) +#define CORDBG_E_INCOMPATIBLE_PLATFORMS EMAKEHR(0x1c30) #define CORDBG_E_DEBUGGING_DISABLED EMAKEHR(0x1c31) #define CORDBG_E_DETACH_FAILED_ON_ENC EMAKEHR(0x1c32) #define CORDBG_E_CURRENT_EXCEPTION_IS_OUTSIDE_CURRENT_EXECUTION_SCOPE EMAKEHR(0x1c33) diff --git a/src/coreclr/pal/src/arch/amd64/exceptionhelper.S b/src/coreclr/pal/src/arch/amd64/exceptionhelper.S index 360b56e87c8..1e61336bfd5 100644 --- a/src/coreclr/pal/src/arch/amd64/exceptionhelper.S +++ b/src/coreclr/pal/src/arch/amd64/exceptionhelper.S @@ -14,7 +14,7 @@ // EXTERN_C void ThrowExceptionFromContextInternal(CONTEXT* context, PAL_SEHException* ex); LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT #ifdef HAS_ASAN - // Need to call __asan_handle_no_return explicitly here because we re-intialize RSP before + // Need to call __asan_handle_no_return explicitly here because we re-initialize RSP before // throwing exception in ThrowExceptionHelper push_nonvol_reg rdi push_nonvol_reg rsi diff --git a/src/coreclr/pal/src/arch/arm/exceptionhelper.S b/src/coreclr/pal/src/arch/arm/exceptionhelper.S index a43ed14be7d..18878894b06 100644 --- a/src/coreclr/pal/src/arch/arm/exceptionhelper.S +++ b/src/coreclr/pal/src/arch/arm/exceptionhelper.S @@ -13,7 +13,7 @@ LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT // Ported from src/pal/src/arch/amd64/exceptionhelper.S #ifdef HAS_ASAN - // Need to call __asan_handle_no_return explicitly here because we re-intialize SP before + // Need to call __asan_handle_no_return explicitly here because we re-initialize SP before // throwing exception in ThrowExceptionHelper push_nonvol_reg "{r0, r1}" bl EXTERNAL_C_FUNC(__asan_handle_no_return) diff --git a/src/coreclr/pal/src/arch/arm64/exceptionhelper.S b/src/coreclr/pal/src/arch/arm64/exceptionhelper.S index c4cf523dcd1..7ad1ae4c58b 100644 --- a/src/coreclr/pal/src/arch/arm64/exceptionhelper.S +++ b/src/coreclr/pal/src/arch/arm64/exceptionhelper.S @@ -12,7 +12,7 @@ // EXTERN_C void ThrowExceptionFromContextInternal(CONTEXT* context, PAL_SEHException* ex); LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT #ifdef HAS_ASAN - // Need to call __asan_handle_no_return explicitly here because we re-intialize SP before + // Need to call __asan_handle_no_return explicitly here because we re-initialize SP before // throwing exception in ThrowExceptionHelper stp x0, x1, [sp, -16]! bl EXTERNAL_C_FUNC(__asan_handle_no_return) diff --git a/src/coreclr/pal/src/arch/i386/exceptionhelper.S b/src/coreclr/pal/src/arch/i386/exceptionhelper.S index c41007e0b30..9bada09b2cf 100644 --- a/src/coreclr/pal/src/arch/i386/exceptionhelper.S +++ b/src/coreclr/pal/src/arch/i386/exceptionhelper.S @@ -18,7 +18,7 @@ LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT #ifdef HAS_ASAN - // Need to call __asan_handle_no_return explicitly here because we re-intialize ESP before + // Need to call __asan_handle_no_return explicitly here because we re-initialize ESP before // throwing exception in ThrowExceptionHelper call EXTERNAL_C_FUNC(__asan_handle_no_return) #endif diff --git a/src/coreclr/pal/src/include/pal/corunix.hpp b/src/coreclr/pal/src/include/pal/corunix.hpp index ce6bd079e95..519325a1e06 100644 --- a/src/coreclr/pal/src/include/pal/corunix.hpp +++ b/src/coreclr/pal/src/include/pal/corunix.hpp @@ -1102,7 +1102,7 @@ namespace CorUnix { WaitSucceeded, Alerted, - MutexAbondoned, + MutexAbandoned, WaitTimeout, WaitFailed }; diff --git a/src/coreclr/pal/src/include/pal/thread.hpp b/src/coreclr/pal/src/include/pal/thread.hpp index 601d6158d82..86850b260c9 100644 --- a/src/coreclr/pal/src/include/pal/thread.hpp +++ b/src/coreclr/pal/src/include/pal/thread.hpp @@ -243,7 +243,7 @@ namespace CorUnix // // The only other spot the refcount is touched is from within // CPalObjectBase::ReleaseReference -- incremented before the - // destructors for an ojbect are called, and decremented afterwords. + // destructors for an object are called, and decremented afterwords. // This permits the freeing of the thread structure to happen after // the freeing of the enclosing thread object has completed. // diff --git a/src/coreclr/pal/src/include/pal/virtual.h b/src/coreclr/pal/src/include/pal/virtual.h index 902e3f4fdd6..5eeb51f3400 100644 --- a/src/coreclr/pal/src/include/pal/virtual.h +++ b/src/coreclr/pal/src/include/pal/virtual.h @@ -224,7 +224,7 @@ private: Function : ReserveMemoryFromExecutableAllocator - This function is used to reserve a region of virual memory (not commited) + This function is used to reserve a region of virual memory (not committed) that is located close to the coreclr library. The memory comes from the virtual address range that is managed by ExecutableMemoryAllocator. --*/ diff --git a/src/coreclr/pal/src/locale/utf8.cpp b/src/coreclr/pal/src/locale/utf8.cpp index c0cf19dba5d..5ae2173aa73 100644 --- a/src/coreclr/pal/src/locale/utf8.cpp +++ b/src/coreclr/pal/src/locale/utf8.cpp @@ -247,7 +247,7 @@ class DecoderFallbackBuffer friend class UTF8Encoding; // Most implimentations will probably need an implimenation-specific constructor - // internal methods that cannot be overriden that let us do our fallback thing + // internal methods that cannot be overridden that let us do our fallback thing // These wrap the internal methods so that we can check for people doing stuff that's incorrect public: @@ -722,9 +722,9 @@ public: class EncoderFallbackBuffer { friend class UTF8Encoding; - // Most implementations will probably need an implemenation-specific constructor + // Most implementations will probably need an implementation-specific constructor - // Public methods that cannot be overriden that let us do our fallback thing + // Public methods that cannot be overridden that let us do our fallback thing // These wrap the internal methods so that we can check for people doing stuff that is incorrect public: @@ -1912,7 +1912,7 @@ public: goto LongCodeWithMask16; } - // Unfortunately, this is endianess sensitive + // Unfortunately, this is endianness sensitive #if BIGENDIAN *pTarget = (WCHAR)((ch >> 8) & 0x7F); pSrc += 2; @@ -1934,7 +1934,7 @@ public: goto LongCodeWithMask32; } - // Unfortunately, this is endianess sensitive + // Unfortunately, this is endianness sensitive #if BIGENDIAN *pTarget = (WCHAR)((ch >> 24) & 0x7F); *(pTarget + 1) = (WCHAR)((ch >> 16) & 0x7F); @@ -2412,7 +2412,7 @@ public: goto LongCodeWithMask; } - // Unfortunately, this is endianess sensitive + // Unfortunately, this is endianness sensitive #if BIGENDIAN *pTarget = (BYTE)(ch >> 16); *(pTarget + 1) = (BYTE)ch; diff --git a/src/coreclr/pal/src/map/virtual.cpp b/src/coreclr/pal/src/map/virtual.cpp index 8f4c87e67e4..edb0ead0653 100644 --- a/src/coreclr/pal/src/map/virtual.cpp +++ b/src/coreclr/pal/src/map/virtual.cpp @@ -2089,7 +2089,7 @@ size_t GetVirtualPageSize() Function : ReserveMemoryFromExecutableAllocator - This function is used to reserve a region of virual memory (not commited) + This function is used to reserve a region of virual memory (not committed) that is located close to the coreclr library. The memory comes from the virtual address range that is managed by ExecutableMemoryAllocator. --*/ diff --git a/src/coreclr/pal/src/misc/fmtmessage.cpp b/src/coreclr/pal/src/misc/fmtmessage.cpp index e9d87d19c4a..44fc3b034dc 100644 --- a/src/coreclr/pal/src/misc/fmtmessage.cpp +++ b/src/coreclr/pal/src/misc/fmtmessage.cpp @@ -91,7 +91,7 @@ Function : FMTMSG__watoi Converts a wide string repersentation of an integer number - into a interger number. + into a integer number. Returns a integer number, or 0 on failure. 0 is not a valid number for FormatMessage inserts. diff --git a/src/coreclr/pal/src/objmgr/palobjbase.cpp b/src/coreclr/pal/src/objmgr/palobjbase.cpp index d81c04ebfd2..dbfdf3b0c71 100644 --- a/src/coreclr/pal/src/objmgr/palobjbase.cpp +++ b/src/coreclr/pal/src/objmgr/palobjbase.cpp @@ -67,7 +67,7 @@ CPalObjectBase::Initialize( { ERROR("Unable to allocate immutable data\n"); palError = ERROR_OUTOFMEMORY; - goto IntializeExit; + goto InitializeExit; } } @@ -77,7 +77,7 @@ CPalObjectBase::Initialize( if (NO_ERROR != palError) { ERROR("Unable to initialize local data lock!\n"); - goto IntializeExit; + goto InitializeExit; } m_pvLocalData = InternalMalloc(m_pot->GetProcessLocalDataSize()); @@ -89,7 +89,7 @@ CPalObjectBase::Initialize( { ERROR("Unable to allocate local data\n"); palError = ERROR_OUTOFMEMORY; - goto IntializeExit; + goto InitializeExit; } } @@ -98,7 +98,7 @@ CPalObjectBase::Initialize( palError = m_oa.sObjectName.CopyString(&poa->sObjectName); } -IntializeExit: +InitializeExit: LOGEXIT("CPalObjectBase::Initialize returns %d\n", palError); diff --git a/src/coreclr/pal/src/synchmgr/synchcontrollers.cpp b/src/coreclr/pal/src/synchmgr/synchcontrollers.cpp index e24105d281c..3182f00b43b 100644 --- a/src/coreclr/pal/src/synchmgr/synchcontrollers.cpp +++ b/src/coreclr/pal/src/synchmgr/synchcontrollers.cpp @@ -1250,7 +1250,7 @@ namespace CorUnix palErr = CPalSynchronizationManager::WakeUpLocalThread( pthrCurrent, ptwiWaitInfo->pthrOwner, - fAbandoned ? MutexAbondoned : WaitSucceeded, + fAbandoned ? MutexAbandoned : WaitSucceeded, dwObjIdx); if (NO_ERROR != palErr) @@ -1514,7 +1514,7 @@ namespace CorUnix palErr = CPalSynchronizationManager::WakeUpLocalThread( pthrCurrent, ptwiWaitInfo->pthrOwner, - fAbandoned ? MutexAbondoned : WaitSucceeded, + fAbandoned ? MutexAbandoned : WaitSucceeded, dwObjIdx); if (NO_ERROR != palErr) diff --git a/src/coreclr/pal/src/synchmgr/synchmanager.cpp b/src/coreclr/pal/src/synchmgr/synchmanager.cpp index 85d2e08c90f..091e746a817 100644 --- a/src/coreclr/pal/src/synchmgr/synchmanager.cpp +++ b/src/coreclr/pal/src/synchmgr/synchmanager.cpp @@ -410,7 +410,7 @@ namespace CorUnix break; } case WaitSucceeded: - case MutexAbondoned: + case MutexAbandoned: *pdwSignaledObject = dwSigObjIdx; break; default: @@ -643,7 +643,7 @@ namespace CorUnix // if the thread is currently waiting/sleeping and it wakes up // before shutdown code manage to suspend it, it will be rerouted // to ThreadPrepareForShutdown (that will be done without holding - // any internal lock, in a way to accomodate shutdown time thread + // any internal lock, in a way to accommodate shutdown time thread // suspension). // At this time we also unregister the wait, so no dummy nodes are // left around on waiting objects. @@ -1836,7 +1836,7 @@ namespace CorUnix // resetting the data by acquiring the object ownership if (psdSynchData->IsAbandoned()) { - twrWakeUpReason = MutexAbondoned; + twrWakeUpReason = MutexAbandoned; } // Acquire ownership diff --git a/src/coreclr/pal/src/synchmgr/synchmanager.hpp b/src/coreclr/pal/src/synchmgr/synchmanager.hpp index e4adcb318a3..925b896e7e5 100644 --- a/src/coreclr/pal/src/synchmgr/synchmanager.hpp +++ b/src/coreclr/pal/src/synchmgr/synchmanager.hpp @@ -405,7 +405,7 @@ namespace CorUnix friend class CPalSynchronizationManager; // NB: For perforformance purposes this class is supposed - // to have no virtual methods, contructor and + // to have no virtual methods, constructor and // destructor public: enum ControllerType { WaitController, StateController }; diff --git a/src/coreclr/pal/src/synchmgr/wait.cpp b/src/coreclr/pal/src/synchmgr/wait.cpp index bce09fe91c7..d666d5101ba 100644 --- a/src/coreclr/pal/src/synchmgr/wait.cpp +++ b/src/coreclr/pal/src/synchmgr/wait.cpp @@ -655,7 +655,7 @@ WFMOExIntReleaseControllers: case WaitSucceeded: dwRet = WAIT_OBJECT_0; // offset added later break; - case MutexAbondoned: + case MutexAbandoned: dwRet = WAIT_ABANDONED_0; // offset added later break; case WaitTimeout: @@ -874,8 +874,8 @@ DWORD CorUnix::InternalSleepEx ( _ASSERT_MSG(NO_ERROR == palErr, "Awakened for APC, but no APC is pending\n"); break; - case MutexAbondoned: - ASSERT("Thread %p awakened with reason=MutexAbondoned from a SleepEx\n", pThread); + case MutexAbandoned: + ASSERT("Thread %p awakened with reason=MutexAbandoned from a SleepEx\n", pThread); break; case WaitFailed: default: diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp index 5ea320816b7..0a5b702f00d 100644 --- a/src/coreclr/pal/src/thread/process.cpp +++ b/src/coreclr/pal/src/thread/process.cpp @@ -756,7 +756,7 @@ CorUnix::InternalCreateProcess( if (NO_ERROR != palError) { - ERROR("Unable to allocate object for new proccess\n"); + ERROR("Unable to allocate object for new process\n"); goto InternalCreateProcessExit; } diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.cpp index 05252661327..4baa9476763 100644 --- a/src/coreclr/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.cpp +++ b/src/coreclr/pal/tests/palsuite/c_runtime/_wcsnicmp/test1/test1.cpp @@ -5,10 +5,10 @@ ** ** Source: test1.c ** -** Purpose: Take two wide strings and compare them, giving different lengths. +** Purpose: Take two wide strings and compare them, giving different lengths. ** Comparing str1 and str2 with str2 length, should return <0 ** Comparing str2 and str1 with str2 length, should return >0 -** Comparing str1 and str2 with str1 lenght, should return 0 +** Comparing str1 and str2 with str1 length, should return 0 ** Bring in str3, which has a capital, but this function is doing a lower ** case compare. Just ensure that two strings which differ only by capitals ** return 0. @@ -73,7 +73,7 @@ PALTEST(c_runtime__wcsnicmp_test1_paltest_wcsnicmp_test1, "c_runtime/_wcsnicmp/t } /* new testing */ - + /* str4 should be greater than str5 */ if (_wcsnicmp(str4, str5, wcslen(str4)) <= 0) { diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp index b14222931ad..6eca5728abb 100644 --- a/src/coreclr/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp +++ b/src/coreclr/pal/tests/palsuite/c_runtime/strtok/test1/test1.cpp @@ -5,7 +5,7 @@ ** ** Source: test1.c ** -** Purpose: +** Purpose: ** Search for a number of tokens within strings. Check that the return values ** are what is expect, and also that the strings match up with our expected ** results. @@ -24,7 +24,7 @@ PALTEST(c_runtime_strtok_test1_paltest_strtok_test1, "c_runtime/strtok/test1/pal int len = strlen(str) + 1; char *ptr; - + if (PAL_Initialize(argc, argv)) { return FAIL; @@ -38,7 +38,7 @@ PALTEST(c_runtime_strtok_test1_paltest_strtok_test1, "c_runtime/strtok/test1/pal } if (memcmp(str, result1, len) != 0) { - Fail("strtok altered the string in an unexpeced way!\n"); + Fail("strtok altered the string in an unexpected way!\n"); } ptr = strtok(NULL, "r "); @@ -48,7 +48,7 @@ PALTEST(c_runtime_strtok_test1_paltest_strtok_test1, "c_runtime/strtok/test1/pal } if (memcmp(str, result2, len) != 0) { - Fail("strtok altered the string in an unexpeced way!\n"); + Fail("strtok altered the string in an unexpected way!\n"); } @@ -59,7 +59,7 @@ PALTEST(c_runtime_strtok_test1_paltest_strtok_test1, "c_runtime/strtok/test1/pal } if (memcmp(str, result2, len) != 0) { - Fail("strtok altered the string in an unexpeced way!\n"); + Fail("strtok altered the string in an unexpected way!\n"); } ptr = strtok(NULL, "X"); @@ -69,7 +69,7 @@ PALTEST(c_runtime_strtok_test1_paltest_strtok_test1, "c_runtime/strtok/test1/pal } if (memcmp(str, result2, len) != 0) { - Fail("strtok altered the string in an unexpeced way!\n"); + Fail("strtok altered the string in an unexpected way!\n"); } PAL_Terminate(); diff --git a/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/threadsuspension.cpp b/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/threadsuspension.cpp index ede0e4b7580..9e0492d72cd 100644 --- a/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/threadsuspension.cpp +++ b/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension/threadsuspension.cpp @@ -5,32 +5,32 @@ ** ** Source: \composite\threading\threadsuspension\threadsuspension.c ** -** Purpose: To verify Thread Suspension Reegneering effort for this milestone +** Purpose: To verify Thread Suspension Reegneering effort for this milestone PsedoCode: Preparation: Create PROCESS_COUNT processes. Test: - Create Worker Thread + Create Worker Thread Start Reading and writing to a File - + Create Worker Thread - In an infinite loop do the following + In an infinite loop do the following Enter Critical Section Increment Counter - Leave Critical Section - + Leave Critical Section + Create Worker Thread Allocate Memory and Free Memory - + Create Worker Thread In a tight loop add numbers - + In a loop repeated REPEAT_COUNT times - Create Thread - + Create Thread + Suspend all worker threads Resume all worker threads @@ -47,20 +47,20 @@ Scenario: -** +** One thread suspends all remaining threads which are in the middle of doing some work and resume all threads Thread 1: Reading and Writing File Thread 2: Enter and Leave Critical Section Thread 3: Allocating chunks of memory Thread 4: Perform Unsafe Operation (printf, malloc) Thread 5: Suspends Thread 1 to Thread 4 and resumes them - + +** +** ** +** Dependencies: ** ** -** Dependencies: -** -** ** **=========================================================*/ @@ -87,7 +87,7 @@ HANDLE hThread[NUMBER_OF_WORKER_THREAD_TYPES][THREAD_MAX]; /*unsigned int g_readfileoperation; unsigned int g_enterleavecsoperation; -unsigned int g_allocatefreeoperation; +unsigned int g_allocatefreeoperation; unsigned int g_doworintightloop; */ @@ -100,7 +100,7 @@ struct statistics{ unsigned int processId; unsigned int operationsFailed; unsigned int operationsPassed; - unsigned int operationsTotal; + unsigned int operationsTotal; DWORD operationTime; unsigned int relationId; }; @@ -116,10 +116,10 @@ ResultBuffer *resultBuffer; /* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; //Identifies the Process number. There could potentially +unsigned int USE_PROCESS_COUNT = 0; //Identifies the Process number. There could potentially unsigned int WORKER_THREAD_MULTIPLIER_COUNT = 0; //In this test case this represents the number of worker thread instances unsigned int REPEAT_COUNT = 0; //Number of Suspend Resume operation of worker threads -unsigned int RELATION_ID = 0; +unsigned int RELATION_ID = 0; @@ -162,7 +162,7 @@ struct processStatistics processStats; struct statistics* tmpBuf = NULL; int statisticsSize = 0; -DWORD dwThreadId=0; +DWORD dwThreadId=0; HANDLE hMainThread; unsigned int i = 0; int j = 0; @@ -191,7 +191,7 @@ _snprintf(processFileName, MAX_PATH, "%d_process_threadsuspension_%d_.txt", USE_ hProcessFile = fopen(processFileName, "w+"); if(hProcessFile == NULL) - { + { Fail("Error in opening file to write process results for process [%d]\n", USE_PROCESS_COUNT); } @@ -203,13 +203,13 @@ processStats.relationId = RELATION_ID; //Start Process Time Capture dwStart = GetTickCount(); -//Setup for Thread Result Collection +//Setup for Thread Result Collection statisticsSize = sizeof(struct statistics); _snprintf(fileName, MAX_PATH, "%d_thread_threadsuspension_%d_.txt", USE_PROCESS_COUNT,RELATION_ID); hFile = fopen(fileName, "w+"); if(hFile == NULL) - { + { Fail("Error in opening file to write thread results for process [%d]\n", USE_PROCESS_COUNT); } @@ -218,9 +218,9 @@ if(hFile == NULL) resultBuffer = new ResultBuffer( 1, statisticsSize); /* -* Call the Setup Routine +* Call the Setup Routine */ -setup(); +setup(); Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); @@ -228,126 +228,126 @@ Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); for (i=0;i<WORKER_THREAD_MULTIPLIER_COUNT;i++) { - /* + /* * Create readfile thread */ hThread[0][i] = CreateThread( - NULL, - 0, - readfile, - NULL, - 0, + NULL, + 0, + readfile, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[0][i] ) + if ( NULL == hThread[0][i] ) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - - /* + + + /* * Create Enter and Leave Critical Section Thread */ hThread[1][i] = CreateThread( - NULL, - 0, - enterandleave_cs, - NULL, - 0, + NULL, + 0, + enterandleave_cs, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[1][i] ) + if ( NULL == hThread[1][i] ) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - - /* + + + /* * Create Allocate and Free Memory Thread */ hThread[2][i] = CreateThread( - NULL, - 0, - allocateandfree_memory, - NULL, - 0, + NULL, + 0, + allocateandfree_memory, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[2][i]) + if ( NULL == hThread[2][i]) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - - /* + + + /* * Create Work in tight Loop thread */ hThread[3][i] = CreateThread( - NULL, - 0, - doworkintightloop_cs, - NULL, - 0, + NULL, + 0, + doworkintightloop_cs, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[3][i]) + if ( NULL == hThread[3][i]) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - + + } -/* +/* * Create Main test case thread that Suspends and Resumes Threads */ hMainThread = CreateThread( - NULL, - 0, - suspendandresumethreads, - (LPVOID)dwThrdParam, - 0, + NULL, + 0, + suspendandresumethreads, + (LPVOID)dwThrdParam, + 0, &dwThreadId); - if ( NULL == hMainThread ) + if ( NULL == hMainThread ) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } /* -* Set Event to allow all threads to start +* Set Event to allow all threads to start */ if (0==SetEvent(g_hEvent)) { Fail ( "SetEvent returned Zero. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } /* * Wait for main thread to complete - * + * */ if (WAIT_OBJECT_0 != WaitForSingleObject (hMainThread, INFINITE)) { Fail ("Main: Wait for Single Object (mainThread) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } //Get the end time of the process @@ -355,7 +355,7 @@ processStats.operationTime = GetTickCount() - dwStart; //Write Process Result Contents to File if(hProcessFile!= NULL) - { + { fprintf(hProcessFile, "%d,%lu,%d\n", processStats.processId, processStats.operationTime, processStats.relationId ); } @@ -375,9 +375,9 @@ if (0!=fclose(hProcessFile)) //Write Thread Result Contents to File if(hFile!= NULL) - { + { for( i = 0; i < 1; i++ ) - { + { buffer = (struct statistics *)resultBuffer->getResultBuffer(i); fprintf(hFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId ); } @@ -392,10 +392,10 @@ if (0!=fclose(hFile)) cleanup(); if (failFlag == TRUE) -{ +{ return FAIL; } -else +else { return PASS; } @@ -410,31 +410,31 @@ VOID setup(VOID) { /*Delete All Temporary Files Created by the previous execution of the test case*/ - HANDLE hSearch; - BOOL fFinished = FALSE; - WIN32_FIND_DATA FileData; + HANDLE hSearch; + BOOL fFinished = FALSE; + WIN32_FIND_DATA FileData; //Start searching for .tmp files in the current directory. - hSearch = FindFirstFile("*.tmp*", &FileData); - if (hSearch == INVALID_HANDLE_VALUE) - { - //No Files That Matched Criteria + hSearch = FindFirstFile("*.tmp*", &FileData); + if (hSearch == INVALID_HANDLE_VALUE) + { + //No Files That Matched Criteria fFinished = TRUE; } - //Delete all files that match the pattern - while (!fFinished) + //Delete all files that match the pattern + while (!fFinished) { if (!DeleteFile(FileData.cFileName)) { - Trace("Setup: Could not delete temporary file %s\n",FileData.cFileName ); - Fail ("GetLastError returned %d\n", GetLastError()); + Trace("Setup: Could not delete temporary file %s\n",FileData.cFileName ); + Fail ("GetLastError returned %d\n", GetLastError()); } - if (!FindNextFile(hSearch, &FileData)) + if (!FindNextFile(hSearch, &FileData)) { - if (GetLastError() == ERROR_NO_MORE_FILES) - { - fFinished = TRUE; + if (GetLastError() == ERROR_NO_MORE_FILES) + { + fFinished = TRUE; } else { @@ -442,14 +442,14 @@ setup(VOID) } } } - + // Close the search handle, only if HANDLE is Valid if (hSearch != INVALID_HANDLE_VALUE) { if (!FindClose(hSearch)) { - Trace("Setup: Could not close search handle \n"); - Fail ("GetLastError returned %d\n", GetLastError()); + Trace("Setup: Could not close search handle \n"); + Fail ("GetLastError returned %d\n", GetLastError()); } } @@ -470,12 +470,12 @@ setup(VOID) VOID cleanup(VOID) { - //DeleteCriticalSection(&g_csUniqueFileName); + //DeleteCriticalSection(&g_csUniqueFileName); PAL_Terminate(); } -VOID +VOID incrementCounter(VOID) { @@ -483,59 +483,59 @@ incrementCounter(VOID) { GLOBAL_COUNTER = 0; } - - GLOBAL_COUNTER++; + + GLOBAL_COUNTER++; } /* - * Worker Thread + * Worker Thread * Read File: Read from a file and write to a temporary file and then delete the temp file */ DWORD -PALAPI +PALAPI readfile( LPVOID lpParam ) { - // Declaring Local Variables + // Declaring Local Variables HANDLE hFile,hTempfile; - char buffer[BUFSIZE]; + char buffer[BUFSIZE]; DWORD dwBytesRead, dwBytesWritten, dwBufSize=BUFSIZE; DWORD dwWaitResult=0; char filename[MAX_PATH]; - //Wait for event to signal to start test + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("readfile: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - + + /*Start Operation*/ - // Open the existing file. + // Open the existing file. while(TRUE) { - hFile = CreateFile("samplefile.dat", // file name - GENERIC_READ, // open for reading - FILE_SHARE_READ, // Share the file for read - NULL, // default security - OPEN_EXISTING, // existing file only - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template + hFile = CreateFile("samplefile.dat", // file name + GENERIC_READ, // open for reading + FILE_SHARE_READ, // Share the file for read + NULL, // default security + OPEN_EXISTING, // existing file only + FILE_ATTRIBUTE_NORMAL, // normal file + NULL); // no template - if (hFile == INVALID_HANDLE_VALUE) - { + if (hFile == INVALID_HANDLE_VALUE) + { Trace("Could not open file \n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } + Fail ( "GetLastError returned %d\n", GetLastError()); + } //Generate Unique File Name to Write //Enter CS EnterCriticalSection(&g_csUniqueFileName); - + //Increment Number and assign to local variable UNIQUE_FILE_NUMBER++; _snprintf(filename, MAX_PATH, "%d_%d_tempfile.tmp", USE_PROCESS_COUNT,UNIQUE_FILE_NUMBER); @@ -543,59 +543,59 @@ readfile( LPVOID lpParam ) //Leave CS LeaveCriticalSection(&g_csUniqueFileName); - - // Create a temporary file with name generate above - hTempfile = CreateFile(filename, // file name - GENERIC_WRITE, // open for read/write - 0, // do not share - NULL, // default security + + // Create a temporary file with name generate above + hTempfile = CreateFile(filename, // file name + GENERIC_WRITE, // open for read/write + 0, // do not share + NULL, // default security CREATE_ALWAYS, // overwrite existing file - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template + FILE_ATTRIBUTE_NORMAL, // normal file + NULL); // no template - if (hTempfile == INVALID_HANDLE_VALUE) - { - Trace("Could not create temporary file\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } + if (hTempfile == INVALID_HANDLE_VALUE) + { + Trace("Could not create temporary file\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); + } - // Read 4K blocks to the buffer. - // Change all characters in the buffer to upper case. - // Write the buffer to the temporary file. - - do + // Read 4K blocks to the buffer. + // Change all characters in the buffer to upper case. + // Write the buffer to the temporary file. + + do { - if (ReadFile(hFile, buffer, 4096, - &dwBytesRead, NULL)) - { - - WriteFile(hTempfile, buffer, dwBytesRead, - &dwBytesWritten, NULL); - } - } while (dwBytesRead == BUFSIZE); - - - - // Close both files. + if (ReadFile(hFile, buffer, 4096, + &dwBytesRead, NULL)) + { + + WriteFile(hTempfile, buffer, dwBytesRead, + &dwBytesWritten, NULL); + } + } while (dwBytesRead == BUFSIZE); + + + + // Close both files. if (0==CloseHandle(hFile)) { - Trace("Could not handle hFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); + Trace("Could not handle hFile\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); } if (0==CloseHandle(hTempfile)) { - Trace("Could not handle hTempFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); + Trace("Could not handle hTempFile\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); } //Delete the file that was created if (!DeleteFile(filename)) { - Trace("Could not delete temporary file %s\n", filename); - Fail ( "GetLastError returned %d\n", GetLastError()); - + Trace("Could not delete temporary file %s\n", filename); + Fail ( "GetLastError returned %d\n", GetLastError()); + } //g_readfileoperation++; @@ -611,42 +611,42 @@ readfile( LPVOID lpParam ) * Enter and Leave Nested Critical Sections */ DWORD -PALAPI +PALAPI enterandleave_cs( LPVOID lpParam ) { - + //Declare Local Variables - + CRITICAL_SECTION lcs; CRITICAL_SECTION lcsNested; DWORD dwWaitResult; - //Intialize Critical Section Structures + //Initialize Critical Section Structures InitializeCriticalSection ( &lcs); InitializeCriticalSection ( &lcsNested); - - //Wait for event to signal to start test + + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("enterandleave_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - + //Trace("Critical Section Started\n"); - + while(TRUE) { EnterCriticalSection(&lcs); EnterCriticalSection(&lcsNested); - + incrementCounter(); LeaveCriticalSection(&lcsNested); - + LeaveCriticalSection(&lcs); //g_enterleavecsoperation++; } @@ -655,34 +655,34 @@ enterandleave_cs( LPVOID lpParam ) DeleteCriticalSection(&lcs); DeleteCriticalSection(&lcsNested); - - + + return 0; } -/* +/* * Allocate and Free Memory */ DWORD -PALAPI +PALAPI allocateandfree_memory( LPVOID lpParam ) { - + int i; char *textArrPtr[64]; DWORD dwWaitResult; - //Wait for event to signal to start test + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("allocateandfree_memory: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - + + while(TRUE) { @@ -697,7 +697,7 @@ allocateandfree_memory( LPVOID lpParam ) testStatus = TEST_FAIL; } } - + for (i=0;i<64;i++) { free(textArrPtr[i]); @@ -705,31 +705,31 @@ allocateandfree_memory( LPVOID lpParam ) //g_allocatefreeoperation++; } - - - + + + return 0; } -/* +/* * Do work in a tight loop */ DWORD -PALAPI +PALAPI doworkintightloop_cs( LPVOID lpParam ) { - + unsigned int i; DWORD dwWaitResult; - - //Wait for event to signal to start test + + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("doworkintightloop_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - + i= 0; while (TRUE) { @@ -744,14 +744,14 @@ doworkintightloop_cs( LPVOID lpParam ) } -/* +/* * Main Test Case worker thread which will suspend and resume all other worker threads */ DWORD -PALAPI +PALAPI suspendandresumethreads( LPVOID lpParam ) { - + unsigned int loopcount = REPEAT_COUNT; int Id=(int)lpParam; unsigned int i,j,k; @@ -761,7 +761,7 @@ suspendandresumethreads( LPVOID lpParam ) struct statistics stats; struct statistics* buffer; - + //Initialize the Statistics Structure stats.relationId = RELATION_ID; @@ -771,25 +771,25 @@ suspendandresumethreads( LPVOID lpParam ) stats.operationsTotal = 0; stats.operationTime = 0; - - - //Wait for event to signal to start test + + + //Wait for event to signal to start test WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("suspendandresumethreads: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - //Capture Start Import + + //Capture Start Import dwStart = GetTickCount(); for(i = 0; i < loopcount; i++) { failFlag = false; - + //Suspend Worker Threads for (k=0;k<WORKER_THREAD_MULTIPLIER_COUNT;k++) { @@ -811,30 +811,30 @@ suspendandresumethreads( LPVOID lpParam ) { //Only suspend if not already in suspended state - + if (-1 == ResumeThread(hThread[j][k])) { //If the operation indicate failure failFlag = true; } - + } } //Check for Fail Flag. If set increment number of failures // If Fail flag not set then increment number of operations and number of passe - if (failFlag == true) + if (failFlag == true) { stats.operationsFailed++; } else { stats.operationsPassed +=1; - + } stats.operationsTotal +=1; - + } stats.operationTime = GetTickCount() - dwStart; @@ -851,8 +851,8 @@ suspendandresumethreads( LPVOID lpParam ) buffer = (struct statistics *)resultBuffer->getResultBuffer(Id); //Trace("\n%d,%d,%d,%lu\n", buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime ); - - + + return 0; } @@ -861,43 +861,43 @@ suspendandresumethreads( LPVOID lpParam ) int GetParameters( int argc, char **argv) { - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) + if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) { Trace("PAL -Composite Thread Suspension Test\n"); Trace("Usage:\n"); - Trace("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - Trace("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); + Trace("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); + Trace("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); Trace("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - Trace("\t[RELATION_ID [greater than or Equal to 1]\n"); + Trace("\t[RELATION_ID [greater than or Equal to 1]\n"); return -1; } // Trace("Args 1 is [%s], Arg 2 is [%s], Arg 3 is [%s]\n", argv[1], argv[2], argv[3]); - + USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) + if( USE_PROCESS_COUNT < 0) { Trace("\nPROCESS_COUNT to greater than or equal to 1\n"); return -1; } WORKER_THREAD_MULTIPLIER_COUNT = atoi(argv[2]); - if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) + if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) { Trace("\nWORKER_THREAD_MULTIPLIER_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); return -1; } REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) + if( REPEAT_COUNT < 1) { Trace("\nREPEAT_COUNT to greater than or equal to 1\n"); return -1; } RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) + if( RELATION_ID < 1) { Trace("\nRELATION_ID to be greater than or equal to 1\n"); return -1; diff --git a/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/threadsuspension.cpp b/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/threadsuspension.cpp index 8ccf29d01f8..d1f11d304f5 100644 --- a/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/threadsuspension.cpp +++ b/src/coreclr/pal/tests/palsuite/composite/threading/threadsuspension_switchthread/threadsuspension.cpp @@ -5,32 +5,32 @@ ** ** Source: \composite\threading\threadsuspension\threadsuspension.c ** -** Purpose: To verify Thread Suspension Reegneering effort for this milestone +** Purpose: To verify Thread Suspension Reegneering effort for this milestone PsedoCode: Preparation: Create PROCESS_COUNT processes. Test: - Create Worker Thread + Create Worker Thread Start Reading and writing to a File - + Create Worker Thread - In an infinite loop do the following + In an infinite loop do the following Enter Critical Section Increment Counter - Leave Critical Section - + Leave Critical Section + Create Worker Thread Allocate Memory and Free Memory - + Create Worker Thread In a tight loop add numbers - + In a loop repeated REPEAT_COUNT times - Create Thread - + Create Thread + Suspend all worker threads Resume all worker threads @@ -47,20 +47,20 @@ Scenario: -** +** One thread suspends all remaining threads which are in the middle of doing some work and resume all threads Thread 1: Reading and Writing File Thread 2: Enter and Leave Critical Section Thread 3: Allocating chunks of memory Thread 4: Perform Unsafe Operation (printf, malloc) Thread 5: Suspends Thread 1 to Thread 4 and resumes them - + +** +** ** +** Dependencies: ** ** -** Dependencies: -** -** ** **=========================================================*/ @@ -87,7 +87,7 @@ HANDLE hThread[NUMBER_OF_WORKER_THREAD_TYPES][THREAD_MAX]; /*unsigned int g_readfileoperation; unsigned int g_enterleavecsoperation; -unsigned int g_allocatefreeoperation; +unsigned int g_allocatefreeoperation; unsigned int g_doworintightloop; */ @@ -100,7 +100,7 @@ struct statistics{ unsigned int processId; unsigned int operationsFailed; unsigned int operationsPassed; - unsigned int operationsTotal; + unsigned int operationsTotal; DWORD operationTime; unsigned int relationId; }; @@ -116,10 +116,10 @@ ResultBuffer *resultBuffer; /* Test Input Variables */ -unsigned int USE_PROCESS_COUNT = 0; //Identifies the Process number. There could potentially +unsigned int USE_PROCESS_COUNT = 0; //Identifies the Process number. There could potentially unsigned int WORKER_THREAD_MULTIPLIER_COUNT = 0; //In this test case this represents the number of worker thread instances unsigned int REPEAT_COUNT = 0; //Number of Suspend Resume operation of worker threads -unsigned int RELATION_ID = 0; +unsigned int RELATION_ID = 0; @@ -162,7 +162,7 @@ struct processStatistics processStats; struct statistics* tmpBuf = NULL; int statisticsSize = 0; -DWORD dwThreadId=0; +DWORD dwThreadId=0; HANDLE hMainThread; unsigned int i = 0; int j = 0; @@ -191,7 +191,7 @@ _snprintf(processFileName, MAX_PATH, "%d_process_threadsuspension_%d_.txt", USE_ hProcessFile = fopen(processFileName, "w+"); if(hProcessFile == NULL) - { + { Fail("Error in opening file to write process results for process [%d]\n", USE_PROCESS_COUNT); } @@ -203,13 +203,13 @@ processStats.relationId = RELATION_ID; //Start Process Time Capture dwStart = GetTickCount(); -//Setup for Thread Result Collection +//Setup for Thread Result Collection statisticsSize = sizeof(struct statistics); _snprintf(fileName, MAX_PATH, "%d_thread_threadsuspension_%d_.txt", USE_PROCESS_COUNT,RELATION_ID); hFile = fopen(fileName, "w+"); if(hFile == NULL) - { + { Fail("Error in opening file to write thread results for process [%d]\n", USE_PROCESS_COUNT); } @@ -218,9 +218,9 @@ if(hFile == NULL) resultBuffer = new ResultBuffer( 1, statisticsSize); /* -* Call the Setup Routine +* Call the Setup Routine */ -setup(); +setup(); Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); @@ -228,126 +228,126 @@ Trace("WORKER_THREAD_MULTIPLIER_COUNT: %d \n", WORKER_THREAD_MULTIPLIER_COUNT); for (i=0;i<WORKER_THREAD_MULTIPLIER_COUNT;i++) { - /* + /* * Create readfile thread */ hThread[0][i] = CreateThread( - NULL, - 0, - readfile, - NULL, - 0, + NULL, + 0, + readfile, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[0][i] ) + if ( NULL == hThread[0][i] ) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - - /* + + + /* * Create Enter and Leave Critical Section Thread */ hThread[1][i] = CreateThread( - NULL, - 0, - enterandleave_cs, - NULL, - 0, + NULL, + 0, + enterandleave_cs, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[1][i] ) + if ( NULL == hThread[1][i] ) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - - /* + + + /* * Create Allocate and Free Memory Thread */ hThread[2][i] = CreateThread( - NULL, - 0, - allocateandfree_memory, - NULL, - 0, + NULL, + 0, + allocateandfree_memory, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[2][i]) + if ( NULL == hThread[2][i]) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - - /* + + + /* * Create Work in tight Loop thread */ hThread[3][i] = CreateThread( - NULL, - 0, - doworkintightloop_cs, - NULL, - 0, + NULL, + 0, + doworkintightloop_cs, + NULL, + 0, &dwThreadId); - if ( NULL == hThread[3][i]) + if ( NULL == hThread[3][i]) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - + + } -/* +/* * Create Main test case thread that Suspends and Resumes Threads */ hMainThread = CreateThread( - NULL, - 0, - suspendandresumethreads, - (LPVOID)dwThrdParam, - 0, + NULL, + 0, + suspendandresumethreads, + (LPVOID)dwThrdParam, + 0, &dwThreadId); - if ( NULL == hMainThread ) + if ( NULL == hMainThread ) { Fail ( "CreateThread() returned NULL. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } /* -* Set Event to allow all threads to start +* Set Event to allow all threads to start */ if (0==SetEvent(g_hEvent)) { Fail ( "SetEvent returned Zero. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } /* * Wait for main thread to complete - * + * */ if (WAIT_OBJECT_0 != WaitForSingleObject (hMainThread, INFINITE)) { Fail ("Main: Wait for Single Object (mainThread) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } //Get the end time of the process @@ -355,7 +355,7 @@ processStats.operationTime = GetTickCount() - dwStart; //Write Process Result Contents to File if(hProcessFile!= NULL) - { + { fprintf(hProcessFile, "%d,%lu,%d\n", processStats.processId, processStats.operationTime, processStats.relationId ); } @@ -375,9 +375,9 @@ if (0!=fclose(hProcessFile)) //Write Thread Result Contents to File if(hFile!= NULL) - { + { for( i = 0; i < 1; i++ ) - { + { buffer = (struct statistics *)resultBuffer->getResultBuffer(i); fprintf(hFile, "%d,%d,%d,%d,%lu,%d\n", buffer->processId, buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime, buffer->relationId ); } @@ -392,10 +392,10 @@ if (0!=fclose(hFile)) cleanup(); if (failFlag == TRUE) -{ +{ return FAIL; } -else +else { return PASS; } @@ -410,31 +410,31 @@ VOID setup(VOID) { /*Delete All Temporary Files Created by the previous execution of the test case*/ - HANDLE hSearch; - BOOL fFinished = FALSE; - WIN32_FIND_DATA FileData; + HANDLE hSearch; + BOOL fFinished = FALSE; + WIN32_FIND_DATA FileData; //Start searching for .tmp files in the current directory. - hSearch = FindFirstFile("*.tmp*", &FileData); - if (hSearch == INVALID_HANDLE_VALUE) - { - //No Files That Matched Criteria + hSearch = FindFirstFile("*.tmp*", &FileData); + if (hSearch == INVALID_HANDLE_VALUE) + { + //No Files That Matched Criteria fFinished = TRUE; } - //Delete all files that match the pattern - while (!fFinished) + //Delete all files that match the pattern + while (!fFinished) { if (!DeleteFile(FileData.cFileName)) { - Trace("Setup: Could not delete temporary file %s\n",FileData.cFileName ); - Fail ("GetLastError returned %d\n", GetLastError()); + Trace("Setup: Could not delete temporary file %s\n",FileData.cFileName ); + Fail ("GetLastError returned %d\n", GetLastError()); } - if (!FindNextFile(hSearch, &FileData)) + if (!FindNextFile(hSearch, &FileData)) { - if (GetLastError() == ERROR_NO_MORE_FILES) - { - fFinished = TRUE; + if (GetLastError() == ERROR_NO_MORE_FILES) + { + fFinished = TRUE; } else { @@ -442,14 +442,14 @@ setup(VOID) } } } - + // Close the search handle, only if HANDLE is Valid if (hSearch != INVALID_HANDLE_VALUE) { if (!FindClose(hSearch)) { - Trace("Setup: Could not close search handle \n"); - Fail ("GetLastError returned %d\n", GetLastError()); + Trace("Setup: Could not close search handle \n"); + Fail ("GetLastError returned %d\n", GetLastError()); } } @@ -470,12 +470,12 @@ setup(VOID) VOID cleanup(VOID) { - //DeleteCriticalSection(&g_csUniqueFileName); + //DeleteCriticalSection(&g_csUniqueFileName); PAL_Terminate(); } -VOID +VOID incrementCounter(VOID) { @@ -483,59 +483,59 @@ incrementCounter(VOID) { GLOBAL_COUNTER = 0; } - - GLOBAL_COUNTER++; + + GLOBAL_COUNTER++; } /* - * Worker Thread + * Worker Thread * Read File: Read from a file and write to a temporary file and then delete the temp file */ DWORD -PALAPI +PALAPI readfile( LPVOID lpParam ) { - // Declaring Local Variables + // Declaring Local Variables HANDLE hFile,hTempfile; - char buffer[BUFSIZE]; + char buffer[BUFSIZE]; DWORD dwBytesRead, dwBytesWritten, dwBufSize=BUFSIZE; DWORD dwWaitResult=0; char filename[MAX_PATH]; - //Wait for event to signal to start test + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("readfile: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - + + /*Start Operation*/ - // Open the existing file. + // Open the existing file. while(TRUE) { - hFile = CreateFile("samplefile.dat", // file name - GENERIC_READ, // open for reading - FILE_SHARE_READ, // Share the file for read - NULL, // default security - OPEN_EXISTING, // existing file only - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template + hFile = CreateFile("samplefile.dat", // file name + GENERIC_READ, // open for reading + FILE_SHARE_READ, // Share the file for read + NULL, // default security + OPEN_EXISTING, // existing file only + FILE_ATTRIBUTE_NORMAL, // normal file + NULL); // no template - if (hFile == INVALID_HANDLE_VALUE) - { + if (hFile == INVALID_HANDLE_VALUE) + { Trace("Could not open file \n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } + Fail ( "GetLastError returned %d\n", GetLastError()); + } //Generate Unique File Name to Write //Enter CS EnterCriticalSection(&g_csUniqueFileName); - + //Increment Number and assign to local variable UNIQUE_FILE_NUMBER++; _snprintf(filename, MAX_PATH, "%d_%d_tempfile.tmp", USE_PROCESS_COUNT,UNIQUE_FILE_NUMBER); @@ -543,59 +543,59 @@ readfile( LPVOID lpParam ) //Leave CS LeaveCriticalSection(&g_csUniqueFileName); - - // Create a temporary file with name generate above - hTempfile = CreateFile(filename, // file name - GENERIC_WRITE, // open for read/write - 0, // do not share - NULL, // default security + + // Create a temporary file with name generate above + hTempfile = CreateFile(filename, // file name + GENERIC_WRITE, // open for read/write + 0, // do not share + NULL, // default security CREATE_ALWAYS, // overwrite existing file - FILE_ATTRIBUTE_NORMAL, // normal file - NULL); // no template + FILE_ATTRIBUTE_NORMAL, // normal file + NULL); // no template - if (hTempfile == INVALID_HANDLE_VALUE) - { - Trace("Could not create temporary file\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); - } + if (hTempfile == INVALID_HANDLE_VALUE) + { + Trace("Could not create temporary file\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); + } - // Read 4K blocks to the buffer. - // Change all characters in the buffer to upper case. - // Write the buffer to the temporary file. - - do + // Read 4K blocks to the buffer. + // Change all characters in the buffer to upper case. + // Write the buffer to the temporary file. + + do { - if (ReadFile(hFile, buffer, 4096, - &dwBytesRead, NULL)) - { - - WriteFile(hTempfile, buffer, dwBytesRead, - &dwBytesWritten, NULL); - } - } while (dwBytesRead == BUFSIZE); - - - - // Close both files. + if (ReadFile(hFile, buffer, 4096, + &dwBytesRead, NULL)) + { + + WriteFile(hTempfile, buffer, dwBytesRead, + &dwBytesWritten, NULL); + } + } while (dwBytesRead == BUFSIZE); + + + + // Close both files. if (0==CloseHandle(hFile)) { - Trace("Could not handle hFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); + Trace("Could not handle hFile\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); } if (0==CloseHandle(hTempfile)) { - Trace("Could not handle hTempFile\n"); - Fail ( "GetLastError returned %d\n", GetLastError()); + Trace("Could not handle hTempFile\n"); + Fail ( "GetLastError returned %d\n", GetLastError()); } //Delete the file that was created if (!DeleteFile(filename)) { - Trace("Could not delete temporary file %s\n", filename); - Fail ( "GetLastError returned %d\n", GetLastError()); - + Trace("Could not delete temporary file %s\n", filename); + Fail ( "GetLastError returned %d\n", GetLastError()); + } SwitchToThread(); @@ -612,42 +612,42 @@ readfile( LPVOID lpParam ) * Enter and Leave Nested Critical Sections */ DWORD -PALAPI +PALAPI enterandleave_cs( LPVOID lpParam ) { - + //Declare Local Variables - + CRITICAL_SECTION lcs; CRITICAL_SECTION lcsNested; DWORD dwWaitResult; - //Intialize Critical Section Structures + //Initialize Critical Section Structures InitializeCriticalSection ( &lcs); InitializeCriticalSection ( &lcsNested); - - //Wait for event to signal to start test + + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("enterandleave_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - + //Trace("Critical Section Started\n"); - + while(TRUE) { EnterCriticalSection(&lcs); EnterCriticalSection(&lcsNested); - + incrementCounter(); LeaveCriticalSection(&lcsNested); - + LeaveCriticalSection(&lcs); SwitchToThread(); @@ -658,34 +658,34 @@ enterandleave_cs( LPVOID lpParam ) DeleteCriticalSection(&lcs); DeleteCriticalSection(&lcsNested); - - + + return 0; } -/* +/* * Allocate and Free Memory */ DWORD -PALAPI +PALAPI allocateandfree_memory( LPVOID lpParam ) { - + int i; char *textArrPtr[64]; DWORD dwWaitResult; - //Wait for event to signal to start test + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("allocateandfree_memory: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - + + while(TRUE) { @@ -700,7 +700,7 @@ allocateandfree_memory( LPVOID lpParam ) testStatus = TEST_FAIL; } } - + for (i=0;i<64;i++) { free(textArrPtr[i]); @@ -710,31 +710,31 @@ allocateandfree_memory( LPVOID lpParam ) //g_allocatefreeoperation++; } - - - + + + return 0; } -/* +/* * Do work in a tight loop */ DWORD -PALAPI +PALAPI doworkintightloop_cs( LPVOID lpParam ) { - + unsigned int i; DWORD dwWaitResult; - - //Wait for event to signal to start test + + //Wait for event to signal to start test dwWaitResult = WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("doworkintightloop_cs: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - + i= 0; while (TRUE) { @@ -751,14 +751,14 @@ doworkintightloop_cs( LPVOID lpParam ) } -/* +/* * Main Test Case worker thread which will suspend and resume all other worker threads */ DWORD -PALAPI +PALAPI suspendandresumethreads( LPVOID lpParam ) { - + unsigned int loopcount = REPEAT_COUNT; int Id=(int)lpParam; unsigned int i,j,k; @@ -768,7 +768,7 @@ suspendandresumethreads( LPVOID lpParam ) struct statistics stats; struct statistics* buffer; - + //Initialize the Statistics Structure stats.relationId = RELATION_ID; @@ -778,25 +778,25 @@ suspendandresumethreads( LPVOID lpParam ) stats.operationsTotal = 0; stats.operationTime = 0; - - - //Wait for event to signal to start test + + + //Wait for event to signal to start test WaitForSingleObject(g_hEvent,INFINITE); if (WAIT_OBJECT_0 != dwWaitResult) { Fail ("suspendandresumethreads: Wait for Single Object (g_hEvent) failed. Failing test.\n" - "GetLastError returned %d\n", GetLastError()); + "GetLastError returned %d\n", GetLastError()); } - - //Capture Start Import + + //Capture Start Import dwStart = GetTickCount(); for(i = 0; i < loopcount; i++) { failFlag = false; - + //Suspend Worker Threads for (k=0;k<WORKER_THREAD_MULTIPLIER_COUNT;k++) { @@ -818,30 +818,30 @@ suspendandresumethreads( LPVOID lpParam ) { //Only suspend if not already in suspended state - + if (-1 == ResumeThread(hThread[j][k])) { //If the operation indicate failure failFlag = true; } - + } } //Check for Fail Flag. If set increment number of failures // If Fail flag not set then increment number of operations and number of passe - if (failFlag == true) + if (failFlag == true) { stats.operationsFailed++; } else { stats.operationsPassed +=1; - + } stats.operationsTotal +=1; - + } stats.operationTime = GetTickCount() - dwStart; @@ -858,8 +858,8 @@ suspendandresumethreads( LPVOID lpParam ) buffer = (struct statistics *)resultBuffer->getResultBuffer(Id); //Trace("\n%d,%d,%d,%lu\n", buffer->operationsFailed, buffer->operationsPassed, buffer->operationsTotal, buffer->operationTime ); - - + + return 0; } @@ -868,43 +868,43 @@ suspendandresumethreads( LPVOID lpParam ) int GetParameters( int argc, char **argv) { - if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) + if( (argc != 5) || ((argc == 1) && !strcmp(argv[1],"/?")) || !strcmp(argv[1],"/h") || !strcmp(argv[1],"/H")) { Trace("PAL -Composite Thread Suspension Test\n"); Trace("Usage:\n"); - Trace("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); - Trace("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); + Trace("\t[PROCESS_COUNT] Greater than or Equal to 1 \n"); + Trace("\t[WORKER_THREAD_MULTIPLIER_COUNT] Greater than or Equal to 1 and Less than or Equal to 64 \n"); Trace("\t[REPEAT_COUNT] Greater than or Equal to 1\n"); - Trace("\t[RELATION_ID [greater than or Equal to 1]\n"); + Trace("\t[RELATION_ID [greater than or Equal to 1]\n"); return -1; } // Trace("Args 1 is [%s], Arg 2 is [%s], Arg 3 is [%s]\n", argv[1], argv[2], argv[3]); - + USE_PROCESS_COUNT = atoi(argv[1]); - if( USE_PROCESS_COUNT < 0) + if( USE_PROCESS_COUNT < 0) { Trace("\nPROCESS_COUNT to greater than or equal to 1\n"); return -1; } WORKER_THREAD_MULTIPLIER_COUNT = atoi(argv[2]); - if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) + if( WORKER_THREAD_MULTIPLIER_COUNT < 1 || WORKER_THREAD_MULTIPLIER_COUNT > 64) { Trace("\nWORKER_THREAD_MULTIPLIER_COUNT to be greater than or equal to 1 or less than or equal to 64\n"); return -1; } REPEAT_COUNT = atoi(argv[3]); - if( REPEAT_COUNT < 1) + if( REPEAT_COUNT < 1) { Trace("\nREPEAT_COUNT to greater than or equal to 1\n"); return -1; } RELATION_ID = atoi(argv[4]); - if( RELATION_ID < 1) + if( RELATION_ID < 1) { Trace("\nRELATION_ID to be greater than or equal to 1\n"); return -1; diff --git a/src/coreclr/pal/tests/palsuite/file_io/CopyFileA/test1/CopyFileA.cpp b/src/coreclr/pal/tests/palsuite/file_io/CopyFileA/test1/CopyFileA.cpp index 5f11729312f..f6e7d11e0fd 100644 --- a/src/coreclr/pal/tests/palsuite/file_io/CopyFileA/test1/CopyFileA.cpp +++ b/src/coreclr/pal/tests/palsuite/file_io/CopyFileA/test1/CopyFileA.cpp @@ -13,12 +13,12 @@ /* 1. copy an existing file to existing with overwrite true 2. copy an existing file to existing with overwrite false - 3. copy an existing file to non-existant with overwrite true - 4. copy an existing file to non-existant with overwrite false - 5. copy non-existant file to existing with overwrite true - 6. copy non-existant file to existing with overwrite false - 7. copy non-existant file to non-existant with overwrite true - 8. copy non-existant file to non-existant with overwrite false + 3. copy an existing file to non-existent with overwrite true + 4. copy an existing file to non-existent with overwrite false + 5. copy non-existent file to existing with overwrite true + 6. copy non-existent file to existing with overwrite false + 7. copy non-existent file to non-existent with overwrite true + 8. copy non-existent file to non-existent with overwrite false */ #include <palsuite.h> @@ -34,9 +34,9 @@ struct TESTS{ PALTEST(file_io_CopyFileA_test1_paltest_copyfilea_test1, "file_io/CopyFileA/test1/paltest_copyfilea_test1") { char szSrcExisting[] = {"src_existing.tmp"}; - char szSrcNonExistant[] = {"src_non-existant.tmp"}; + char szSrcNonExistent[] = {"src_non-existent.tmp"}; char szDstExisting[] = {"dst_existing.tmp"}; - char szDstNonExistant[] = {"dst_non-existant.tmp"}; + char szDstNonExistent[] = {"dst_non-existent.tmp"}; BOOL bRc = TRUE; BOOL bSuccess = TRUE; FILE* tempFile = NULL; @@ -45,12 +45,12 @@ PALTEST(file_io_CopyFileA_test1_paltest_copyfilea_test1, "file_io/CopyFileA/test { {szSrcExisting, szDstExisting, FALSE, 1}, {szSrcExisting, szDstExisting, TRUE, 0}, - {szSrcExisting, szDstNonExistant, FALSE, 1}, - {szSrcExisting, szDstNonExistant, TRUE, 1}, - {szSrcNonExistant, szDstExisting, FALSE, 0}, - {szSrcNonExistant, szDstExisting, TRUE, 0}, - {szSrcNonExistant, szDstNonExistant, FALSE, 0}, - {szSrcNonExistant, szDstNonExistant, TRUE, 0} + {szSrcExisting, szDstNonExistent, FALSE, 1}, + {szSrcExisting, szDstNonExistent, TRUE, 1}, + {szSrcNonExistent, szDstExisting, FALSE, 0}, + {szSrcNonExistent, szDstExisting, TRUE, 0}, + {szSrcNonExistent, szDstNonExistent, FALSE, 0}, + {szSrcNonExistent, szDstNonExistent, TRUE, 0} }; @@ -136,7 +136,7 @@ PALTEST(file_io_CopyFileA_test1_paltest_copyfilea_test1, "file_io/CopyFileA/test } else { - /* verify attributes of destination file to source file*/ + /* verify attributes of destination file to source file*/ if(GetFileAttributes(testCase[i].lpSource) != GetFileAttributes(testCase[i].lpDestination)) { @@ -149,7 +149,7 @@ PALTEST(file_io_CopyFileA_test1_paltest_copyfilea_test1, "file_io/CopyFileA/test } } /* delete file file but don't worry if it fails */ - DeleteFileA(szDstNonExistant); + DeleteFileA(szDstNonExistent); } int exitCode = bSuccess ? PASS : FAIL; diff --git a/src/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/CopyFileW.cpp b/src/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/CopyFileW.cpp index 5a36b3d1126..27dc3292136 100644 --- a/src/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/CopyFileW.cpp +++ b/src/coreclr/pal/tests/palsuite/file_io/CopyFileW/test1/CopyFileW.cpp @@ -11,22 +11,22 @@ **===================================================================*/ /* -1. copy an existing file to non-existant with overwrite true -2. copy an existing file to non-existant with overwrite false +1. copy an existing file to non-existent with overwrite true +2. copy an existing file to non-existent with overwrite false 3. copy an existing file to existing with overwrite true 4. copy an existing file to existing with overwrite false -5. copy non-existant file to non-existant with overwrite true -6. copy non-existant file to non-existant with overwrite false -7. copy non-existant file to existing with overwrite true -8. copy non-existant file to existing with overwrite false +5. copy non-existent file to non-existent with overwrite true +6. copy non-existent file to non-existent with overwrite false +7. copy non-existent file to existing with overwrite true +8. copy non-existent file to existing with overwrite false */ #include <palsuite.h> PALTEST(file_io_CopyFileW_test1_paltest_copyfilew_test1, "file_io/CopyFileW/test1/paltest_copyfilew_test1") { - LPSTR lpSource[2] = {"src_existing.tmp", "src_non-existant.tmp"}; - LPSTR lpDestination[2] = {"dst_existing.tmp", "dst_non-existant.tmp"}; + LPSTR lpSource[2] = {"src_existing.tmp", "src_non-existent.tmp"}; + LPSTR lpDestination[2] = {"dst_existing.tmp", "dst_non-existent.tmp"}; WCHAR* wcSource; WCHAR* wcDest; BOOL bFailIfExists[3] = {FALSE, TRUE}; @@ -112,7 +112,7 @@ PALTEST(file_io_CopyFileW_test1_paltest_copyfilew_test1, "file_io/CopyFileW/test /* verify the file was moved */ if (GetFileAttributesA(lpDestination[j]) == -1) { - Trace("CopyFileW: GetFileAttributes of destination" + Trace("CopyFileW: GetFileAttributes of destination" "file failed on test[%d][%d][%d] with error " "code %ld. \n",i,j,k,GetLastError()); bSuccess = FALSE; @@ -126,8 +126,8 @@ PALTEST(file_io_CopyFileW_test1_paltest_copyfilew_test1, "file_io/CopyFileW/test } else { - /* verify attributes of destination file to - source file*/ + /* verify attributes of destination file to + source file*/ if(GetFileAttributes(lpSource[i]) != GetFileAttributes(lpDestination[j])) { diff --git a/src/coreclr/pal/tests/palsuite/file_io/DeleteFileA/test1/DeleteFileA.cpp b/src/coreclr/pal/tests/palsuite/file_io/DeleteFileA/test1/DeleteFileA.cpp index 606a0f57a59..e87baa03bc6 100644 --- a/src/coreclr/pal/tests/palsuite/file_io/DeleteFileA/test1/DeleteFileA.cpp +++ b/src/coreclr/pal/tests/palsuite/file_io/DeleteFileA/test1/DeleteFileA.cpp @@ -11,7 +11,7 @@ **===================================================================*/ // delete an existing file -// delete a non-existant file +// delete a non-existent file // delete an open file // delete files using wild cards // delete a hidden file @@ -92,13 +92,13 @@ PALTEST(file_io_DeleteFileA_test1_paltest_deletefilea_test1, "file_io/DeleteFile // - // deleting a non-existant file : should fail + // deleting a non-existent file : should fail // bRc = DeleteFileA("testFile02.txt"); if (bRc != FALSE) { - Fail ("DeleteFileA: ERROR: Was able to delete the non-existant" + Fail ("DeleteFileA: ERROR: Was able to delete the non-existent" " file \"testFile02.txt\"\n"); } @@ -106,7 +106,7 @@ PALTEST(file_io_DeleteFileA_test1_paltest_deletefilea_test1, "file_io/DeleteFile // - // deleting an open file + // deleting an open file // tempFile = fopen("testFile03.txt", "w"); if (tempFile == NULL) @@ -119,7 +119,7 @@ PALTEST(file_io_DeleteFileA_test1_paltest_deletefilea_test1, "file_io/DeleteFile if (fclose(tempFile) != 0) { Fail ("DeleteFileA: ERROR: Couldn't close \"DeleteFileA's" - " testFile03.txt\"\n"); + " testFile03.txt\"\n"); } bRc = DeleteFileA("testFile03.txt"); @@ -149,7 +149,7 @@ PALTEST(file_io_DeleteFileA_test1_paltest_deletefilea_test1, "file_io/DeleteFile if (fclose(tempFile) != 0) { Fail ("DeleteFileA: ERROR: Couldn't close \"DeleteFileA's" - " testFile04.txt\"\n"); + " testFile04.txt\"\n"); } // delete using '?' @@ -176,6 +176,6 @@ PALTEST(file_io_DeleteFileA_test1_paltest_deletefilea_test1, "file_io/DeleteFile " Error is %d\n", GetLastError()); } - PAL_Terminate(); + PAL_Terminate(); return PASS; } diff --git a/src/coreclr/pal/tests/palsuite/file_io/DeleteFileW/test1/DeleteFileW.cpp b/src/coreclr/pal/tests/palsuite/file_io/DeleteFileW/test1/DeleteFileW.cpp index fa4652f8748..f7643a0b49f 100644 --- a/src/coreclr/pal/tests/palsuite/file_io/DeleteFileW/test1/DeleteFileW.cpp +++ b/src/coreclr/pal/tests/palsuite/file_io/DeleteFileW/test1/DeleteFileW.cpp @@ -11,7 +11,7 @@ **===================================================================*/ // delete an existing file -// delete a non-existant file +// delete a non-existent file // delete an open file // delete files using wild cards // delete a hidden file @@ -48,7 +48,7 @@ PALTEST(file_io_DeleteFileW_test1_paltest_deletefilew_test1, "file_io/DeleteFile if (fclose(tempFile) != 0) { Fail ("DeleteFileA: ERROR: Couldn't close \"DeleteFileW's" - " testFile01.tmp\"\n"); + " testFile01.tmp\"\n"); } pTemp = convert("testFile01.tmp"); @@ -63,7 +63,7 @@ PALTEST(file_io_DeleteFileW_test1_paltest_deletefilew_test1, "file_io/DeleteFile // - // deleting a non-existant file : should fail + // deleting a non-existent file : should fail // pTemp = convert("testFile02.tmp"); @@ -71,7 +71,7 @@ PALTEST(file_io_DeleteFileW_test1_paltest_deletefilew_test1, "file_io/DeleteFile free(pTemp); if (bRc != FALSE) { - Fail ("DeleteFileW: ERROR: Was able to delete the non-existant" + Fail ("DeleteFileW: ERROR: Was able to delete the non-existent" " file \"testFile02.tmp\"\n"); } @@ -92,7 +92,7 @@ PALTEST(file_io_DeleteFileW_test1_paltest_deletefilew_test1, "file_io/DeleteFile if (fclose(tempFile) != 0) { Fail ("DeleteFileA: ERROR: Couldn't close \"DeleteFileW's" - " testFile03.tmp\"\n"); + " testFile03.tmp\"\n"); } pTemp = convert("testFile03.tmp"); @@ -125,7 +125,7 @@ PALTEST(file_io_DeleteFileW_test1_paltest_deletefilew_test1, "file_io/DeleteFile if (fclose(tempFile) != 0) { Fail ("DeleteFileA: ERROR: Couldn't close \"DeleteFileW's" - " testFile04.tmp\"\n"); + " testFile04.tmp\"\n"); } // delete using '?' @@ -158,6 +158,6 @@ PALTEST(file_io_DeleteFileW_test1_paltest_deletefilew_test1, "file_io/DeleteFile " Error is %d\n", GetLastError()); } - PAL_Terminate(); + PAL_Terminate(); return PASS; } diff --git a/src/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp index 8cc392fc891..bdcd2c4c492 100644 --- a/src/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp +++ b/src/coreclr/pal/tests/palsuite/file_io/GetFileAttributesExW/test1/test1.cpp @@ -7,7 +7,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. +** and file and a hidden file and directory. ** Ensure that the returned attributes and file sizes are correct. ** ** @@ -16,21 +16,21 @@ #define UNICODE #include <palsuite.h> -typedef enum Item +typedef enum Item { IS_DIR, IS_FILE }ItemType; -/* This function takes a structure and checks that the information - within the structure is correct. The 'Attribs' are the expected +/* 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 name of the file/directory in question. */ -void VerifyInfo(WIN32_FILE_ATTRIBUTE_DATA InfoStruct, - DWORD Attribs, ItemType TheType, WCHAR* Name) +void VerifyInfo(WIN32_FILE_ATTRIBUTE_DATA InfoStruct, + DWORD Attribs, ItemType TheType, WCHAR* Name) { - HANDLE hFile; + HANDLE hFile; FILETIME CorrectCreation, CorrectAccess, CorrectModify; WCHAR CopyName[64]; @@ -41,55 +41,55 @@ void VerifyInfo(WIN32_FILE_ATTRIBUTE_DATA InfoStruct, if(InfoStruct.dwFileAttributes != Attribs) { Fail("ERROR: The file attributes on the file/directory were " - "recorded as being %d instead of %d.\n", - InfoStruct.dwFileAttributes, + "recorded as being %d instead of %d.\n", + InfoStruct.dwFileAttributes, Attribs); } - - /* Note: We can't open a handle to a directory in windows. This + + /* Note: We can't open a handle to a directory in windows. This block of tests will only be run on files. */ - if(TheType == IS_FILE) + if(TheType == IS_FILE) { /* Get a handle to the file */ - hFile = CreateFile(CopyName, - 0, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); - - if (hFile == INVALID_HANDLE_VALUE) - { + hFile = CreateFile(CopyName, + 0, + 0, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) + { Fail("ERROR: Could not open a handle to the file " - "'%S'. GetLastError() returned %d.",CopyName, - GetLastError()); + "'%S'. GetLastError() returned %d.",CopyName, + GetLastError()); } - + if(InfoStruct.nFileSizeLow != GetFileSize(hFile,NULL)) { Fail("ERROR: The file size reported by GetFileAttributesEx " "did not match the file size given by GetFileSize.\n"); } - + if(CloseHandle(hFile) == 0) { Fail("ERROR: Failed to properly close the handle to the " "file we're testing. GetLastError() returned %d.\n", GetLastError()); - + } } - + } /* Given a file/directory name, the expected attribs and whether or not it - is a file or directory, call GetFileAttributesEx and verify the + is a file or directory, call GetFileAttributesEx and verify the results are correct. */ @@ -100,9 +100,9 @@ void RunTest_GetFileAttributesExW_test1(char* Name, DWORD Attribs, ItemType TheT DWORD TheResult; TheName = convert(Name); - - TheResult = GetFileAttributesEx(TheName, - GetFileExInfoStandard, + + TheResult = GetFileAttributesEx(TheName, + GetFileExInfoStandard, &InfoStruct); if(TheResult == 0) { @@ -112,7 +112,7 @@ void RunTest_GetFileAttributesExW_test1(char* Name, DWORD Attribs, ItemType TheT } VerifyInfo(InfoStruct, Attribs, TheType, TheName); - + } PALTEST(file_io_GetFileAttributesExW_test1_paltest_getfileattributesexw_test1, "file_io/GetFileAttributesExW/test1/paltest_getfileattributesexw_test1") @@ -120,7 +120,7 @@ PALTEST(file_io_GetFileAttributesExW_test1_paltest_getfileattributesexw_test1, " DWORD TheResult; WCHAR* FileName; WIN32_FILE_ATTRIBUTE_DATA InfoStruct; - + if (0 != PAL_Initialize(argc,argv)) { return FAIL; @@ -129,14 +129,14 @@ PALTEST(file_io_GetFileAttributesExW_test1_paltest_getfileattributesexw_test1, " /* Test a Directroy */ RunTest_GetFileAttributesExW_test1("normal_test_directory", FILE_ATTRIBUTE_DIRECTORY, IS_DIR); - + /* Test a Normal File */ RunTest_GetFileAttributesExW_test1("normal_test_file", FILE_ATTRIBUTE_NORMAL, IS_FILE); - + /* Test a Read-Only Directroy */ - RunTest_GetFileAttributesExW_test1("ro_test_directory", + RunTest_GetFileAttributesExW_test1("ro_test_directory", FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_DIRECTORY, IS_DIR); /* Test a Read-Only File */ @@ -144,22 +144,22 @@ PALTEST(file_io_GetFileAttributesExW_test1_paltest_getfileattributesexw_test1, " RunTest_GetFileAttributesExW_test1("ro_test_file", FILE_ATTRIBUTE_READONLY, IS_FILE); /* Test a Hidden File */ - + RunTest_GetFileAttributesExW_test1(".hidden_file", FILE_ATTRIBUTE_HIDDEN, IS_FILE); /* Test a Hidden Directroy */ - RunTest_GetFileAttributesExW_test1(".hidden_directory", + RunTest_GetFileAttributesExW_test1(".hidden_directory", FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_DIRECTORY, IS_DIR); - /* Test a Non-Existant File */ - + /* Test a Non-Existent File */ + FileName = convert("nonexistent_test_file"); - + TheResult = GetFileAttributesEx(FileName, GetFileExInfoStandard, &InfoStruct); - + if(TheResult != 0) { free(FileName); diff --git a/src/coreclr/pal/tests/palsuite/file_io/MoveFileExA/test1/MoveFileExA.cpp b/src/coreclr/pal/tests/palsuite/file_io/MoveFileExA/test1/MoveFileExA.cpp index 26df141d997..ff99b864ede 100644 --- a/src/coreclr/pal/tests/palsuite/file_io/MoveFileExA/test1/MoveFileExA.cpp +++ b/src/coreclr/pal/tests/palsuite/file_io/MoveFileExA/test1/MoveFileExA.cpp @@ -15,15 +15,15 @@ LPSTR lpSource_MoveFileExA_test1[4] = { "src_existing.tmp", - "src_non-existant.tmp", + "src_non-existent.tmp", "src_dir_existing", - "src_dir_non-existant" + "src_dir_non-existent" }; LPSTR lpDestination_MoveFileExA_test1[4]={ "dst_existing.tmp", - "dst_non-existant.tmp", + "dst_non-existent.tmp", "dst_dir_existing", - "dst_dir_non-existant" + "dst_dir_non-existent" }; LPSTR lpFiles_MoveFileExA_test1[14] ={ @@ -31,16 +31,16 @@ LPSTR lpFiles_MoveFileExA_test1[14] ={ "src_dir_existing\\test02.tmp", "dst_dir_existing\\test01.tmp", "dst_dir_existing\\test02.tmp", - "src_dir_non-existant\\test01.tmp", - "src_dir_non-existant\\test02.tmp", + "src_dir_non-existent\\test01.tmp", + "src_dir_non-existent\\test02.tmp", "dst_existing.tmp\\test01.tmp", "dst_existing.tmp\\test02.tmp", - "dst_non-existant.tmp\\test01.tmp", - "dst_non-existant.tmp\\test02.tmp", + "dst_non-existent.tmp\\test01.tmp", + "dst_non-existent.tmp\\test02.tmp", "dst_dir_existing\\test01.tmp", "dst_dir_existing\\test02.tmp", - "dst_dir_non-existant\\test01.tmp", - "dst_dir_non-existant\\test02.tmp" + "dst_dir_non-existent\\test01.tmp", + "dst_dir_non-existent\\test02.tmp" }; DWORD dwFlag_MoveFileExA_test1[2] = {MOVEFILE_COPY_ALLOWED, MOVEFILE_REPLACE_EXISTING}; diff --git a/src/coreclr/pal/tests/palsuite/file_io/MoveFileExW/test1/MoveFileExW.cpp b/src/coreclr/pal/tests/palsuite/file_io/MoveFileExW/test1/MoveFileExW.cpp index 70a6e29f126..0144858733b 100644 --- a/src/coreclr/pal/tests/palsuite/file_io/MoveFileExW/test1/MoveFileExW.cpp +++ b/src/coreclr/pal/tests/palsuite/file_io/MoveFileExW/test1/MoveFileExW.cpp @@ -27,7 +27,7 @@ int createExisting_MoveFileExW_test1(void) HANDLE tempFile2 = NULL; /* create the src_existing file and dst_existing file */ - tempFile = CreateFileW(lpSource_MoveFileExW_test1[0], GENERIC_WRITE, 0, 0, CREATE_ALWAYS, + tempFile = CreateFileW(lpSource_MoveFileExW_test1[0], GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); tempFile2 = CreateFileW(lpDestination_MoveFileExW_test1[0], GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); @@ -36,9 +36,9 @@ int createExisting_MoveFileExW_test1(void) if ((tempFile == NULL) || (tempFile2 == NULL)) { - Trace("ERROR: couldn't create %S or %S\n", lpSource_MoveFileExW_test1[0], + Trace("ERROR: couldn't create %S or %S\n", lpSource_MoveFileExW_test1[0], lpDestination_MoveFileExW_test1[0]); - return FAIL; + return FAIL; } /* create the src_dir_existing and dst_dir_existing directory and files */ @@ -74,7 +74,7 @@ int createExisting_MoveFileExW_test1(void) } void removeDirectoryHelper_MoveFileExW_test1(LPWSTR dir, int location) -{ +{ DWORD dwAtt = GetFileAttributesW(dir); // Trace(" Value of location[%d], and directorye [%S]\n", location, dir); @@ -82,13 +82,13 @@ void removeDirectoryHelper_MoveFileExW_test1(LPWSTR dir, int location) { if(!RemoveDirectoryW(dir)) { - Fail("ERROR: Failed to remove Directory [%S], Error Code [%d], location [%d]\n", dir, GetLastError(), location); + Fail("ERROR: Failed to remove Directory [%S], Error Code [%d], location [%d]\n", dir, GetLastError(), location); } } } void removeFileHelper_MoveFileExW_test1(LPWSTR wfile, int location) -{ +{ FILE *fp; char * pfile = convertC(wfile); @@ -99,20 +99,20 @@ void removeFileHelper_MoveFileExW_test1(LPWSTR wfile, int location) { if(fclose(fp)) { - Fail("ERROR: Failed to close the file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); + Fail("ERROR: Failed to close the file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); } if(!DeleteFileW(wfile)) { - Fail("ERROR: Failed to delete file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); + Fail("ERROR: Failed to delete file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); } else { - // Trace("Success: deleted file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); + // Trace("Success: deleted file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location); } } - free(pfile); + free(pfile); } void removeAll_MoveFileExW_test1(void) @@ -121,10 +121,10 @@ void removeAll_MoveFileExW_test1(void) /* get rid of destination dirs and files */ removeFileHelper_MoveFileExW_test1(lpSource_MoveFileExW_test1[0], 11); // lpSource_MoveFileExW_test1[0] = convert("src_existing.tmp"); - + removeFileHelper_MoveFileExW_test1(lpSource_MoveFileExW_test1[1], 12); - //lpSource_MoveFileExW_test1[1] = convert("src_non-existant.tmp"); - + //lpSource_MoveFileExW_test1[1] = convert("src_non-existent.tmp"); + removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[0], 13); // lpFiles_MoveFileExW_test1[0] = convert("src_dir_existing\\test01.tmp"); @@ -135,13 +135,13 @@ void removeAll_MoveFileExW_test1(void) // lpSource_MoveFileExW_test1[2] = convert("src_dir_existing"); removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[4], 15); -// lpFiles_MoveFileExW_test1[4] = convert("src_dir_non-existant\\test01.tmp"); +// lpFiles_MoveFileExW_test1[4] = convert("src_dir_non-existent\\test01.tmp"); removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[5], 16); -// lpFiles_MoveFileExW_test1[5] = convert("src_dir_non-existant\\test02.tmp"); +// lpFiles_MoveFileExW_test1[5] = convert("src_dir_non-existent\\test02.tmp"); removeDirectoryHelper_MoveFileExW_test1(lpSource_MoveFileExW_test1[3], 102); -// lpSource_MoveFileExW_test1[3] = convert("src_dir_non-existant"); +// lpSource_MoveFileExW_test1[3] = convert("src_dir_non-existent"); /* get rid of destination dirs and files */ dwAtt = GetFileAttributesW(lpDestination_MoveFileExW_test1[0]); @@ -165,33 +165,33 @@ void removeAll_MoveFileExW_test1(void) if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[8], 21); - // lpFiles_MoveFileExW_test1[8] = convert("dst_non-existant.tmp\\test01.tmp"); + // lpFiles_MoveFileExW_test1[8] = convert("dst_non-existent.tmp\\test01.tmp"); removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[9], 22); - // lpFiles_MoveFileExW_test1[9] = convert("dst_non-existant.tmp\\test02.tmp"); + // lpFiles_MoveFileExW_test1[9] = convert("dst_non-existent.tmp\\test02.tmp"); removeDirectoryHelper_MoveFileExW_test1(lpDestination_MoveFileExW_test1[1], 104); - // lpDestination_MoveFileExW_test1[1] = convert("dst_non-existant.tmp"); + // lpDestination_MoveFileExW_test1[1] = convert("dst_non-existent.tmp"); } else { removeFileHelper_MoveFileExW_test1(lpDestination_MoveFileExW_test1[1], 19); - //lpDestination_MoveFileExW_test1[1] = convert("dst_non-existant.tmp"); + //lpDestination_MoveFileExW_test1[1] = convert("dst_non-existent.tmp"); } - + dwAtt = GetFileAttributesW(lpDestination_MoveFileExW_test1[2]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[10], 24); - // lpFiles_MoveFileExW_test1[10] = convert("dst_dir_existing\\test01.tmp"); + // lpFiles_MoveFileExW_test1[10] = convert("dst_dir_existing\\test01.tmp"); removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[11], 25); - // lpFiles_MoveFileExW_test1[11] = convert("dst_dir_existing\\test02.tmp"); + // lpFiles_MoveFileExW_test1[11] = convert("dst_dir_existing\\test02.tmp"); removeDirectoryHelper_MoveFileExW_test1(lpDestination_MoveFileExW_test1[2], 105); // lpDestination_MoveFileExW_test1[2] = convert("dst_dir_existing"); - + } else { - removeFileHelper_MoveFileExW_test1(lpDestination_MoveFileExW_test1[2], 23); + removeFileHelper_MoveFileExW_test1(lpDestination_MoveFileExW_test1[2], 23); // lpDestination_MoveFileExW_test1[2] = convert("dst_dir_existing"); } @@ -200,17 +200,17 @@ void removeAll_MoveFileExW_test1(void) if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[12], 26); - // lpFiles_MoveFileExW_test1[12] = convert("dst_dir_non-existant\\test01.tmp"); + // lpFiles_MoveFileExW_test1[12] = convert("dst_dir_non-existent\\test01.tmp"); removeFileHelper_MoveFileExW_test1(lpFiles_MoveFileExW_test1[13], 27); - // lpFiles_MoveFileExW_test1[13] = convert("dst_dir_non-existant\\test02.tmp"); + // lpFiles_MoveFileExW_test1[13] = convert("dst_dir_non-existent\\test02.tmp"); removeDirectoryHelper_MoveFileExW_test1(lpDestination_MoveFileExW_test1[3], 106); - // lpDestination_MoveFileExW_test1[3] = convert("dst_dir_non-existant"); + // lpDestination_MoveFileExW_test1[3] = convert("dst_dir_non-existent"); } else { removeFileHelper_MoveFileExW_test1(lpDestination_MoveFileExW_test1[3], 107); - // lpDestination_MoveFileExW_test1[3] = convert("dst_dir_non-existant"); + // lpDestination_MoveFileExW_test1[3] = convert("dst_dir_non-existent"); } @@ -234,33 +234,33 @@ PALTEST(file_io_MoveFileExW_test1_paltest_movefileexw_test1, "file_io/MoveFileEx } lpSource_MoveFileExW_test1[0] = convert("src_existing.tmp"); - lpSource_MoveFileExW_test1[1] = convert("src_non-existant.tmp"); + lpSource_MoveFileExW_test1[1] = convert("src_non-existent.tmp"); lpSource_MoveFileExW_test1[2] = convert("src_dir_existing"); - lpSource_MoveFileExW_test1[3] = convert("src_dir_non-existant"); + lpSource_MoveFileExW_test1[3] = convert("src_dir_non-existent"); lpDestination_MoveFileExW_test1[0] = convert("dst_existing.tmp"); - lpDestination_MoveFileExW_test1[1] = convert("dst_non-existant.tmp"); + lpDestination_MoveFileExW_test1[1] = convert("dst_non-existent.tmp"); lpDestination_MoveFileExW_test1[2] = convert("dst_dir_existing"); - lpDestination_MoveFileExW_test1[3] = convert("dst_dir_non-existant"); + lpDestination_MoveFileExW_test1[3] = convert("dst_dir_non-existent"); lpFiles_MoveFileExW_test1[0] = convert("src_dir_existing\\test01.tmp"); lpFiles_MoveFileExW_test1[1] = convert("src_dir_existing\\test02.tmp"); lpFiles_MoveFileExW_test1[2] = convert("dst_dir_existing\\test01.tmp"); lpFiles_MoveFileExW_test1[3] = convert("dst_dir_existing\\test02.tmp"); - lpFiles_MoveFileExW_test1[4] = convert("src_dir_non-existant\\test01.tmp"); - lpFiles_MoveFileExW_test1[5] = convert("src_dir_non-existant\\test02.tmp"); + lpFiles_MoveFileExW_test1[4] = convert("src_dir_non-existent\\test01.tmp"); + lpFiles_MoveFileExW_test1[5] = convert("src_dir_non-existent\\test02.tmp"); lpFiles_MoveFileExW_test1[6] = convert("dst_existing.tmp\\test01.tmp"); lpFiles_MoveFileExW_test1[7] = convert("dst_existing.tmp\\test02.tmp"); - lpFiles_MoveFileExW_test1[8] = convert("dst_non-existant.tmp\\test01.tmp"); - lpFiles_MoveFileExW_test1[9] = convert("dst_non-existant.tmp\\test02.tmp"); + lpFiles_MoveFileExW_test1[8] = convert("dst_non-existent.tmp\\test01.tmp"); + lpFiles_MoveFileExW_test1[9] = convert("dst_non-existent.tmp\\test02.tmp"); - lpFiles_MoveFileExW_test1[10] = convert("dst_dir_existing\\test01.tmp"); + lpFiles_MoveFileExW_test1[10] = convert("dst_dir_existing\\test01.tmp"); lpFiles_MoveFileExW_test1[11] = convert("dst_dir_existing\\test02.tmp"); - lpFiles_MoveFileExW_test1[12] = convert("dst_dir_non-existant\\test01.tmp"); - lpFiles_MoveFileExW_test1[13] = convert("dst_dir_non-existant\\test02.tmp"); + lpFiles_MoveFileExW_test1[12] = convert("dst_dir_non-existent\\test01.tmp"); + lpFiles_MoveFileExW_test1[13] = convert("dst_dir_non-existent\\test02.tmp"); /* read in the expected results to compare with actual results */ memset (results, 0, 34); @@ -287,7 +287,7 @@ PALTEST(file_io_MoveFileExW_test1_paltest_movefileexw_test1, "file_io/MoveFileEx if (createExisting_MoveFileExW_test1() != PASS) { goto EXIT; - } + } /* lpSource_MoveFileExW_test1 loop */ for (i = 0; i < 4; i++) @@ -307,21 +307,21 @@ PALTEST(file_io_MoveFileExW_test1_paltest_movefileexw_test1, "file_io/MoveFileEx bRc = MoveFileExW(lpSource_MoveFileExW_test1[i], lpDestination_MoveFileExW_test1[j], dwFlag_MoveFileExW_test1[k]); if (!( - ((bRc == TRUE) && (results[nCounter] == '1')) - || + ((bRc == TRUE) && (results[nCounter] == '1')) + || ((bRc == FALSE ) && (results[nCounter] == '0')) ) ) { - Trace("MoveFileExW(%S, %S, %s): Values of i[%d], j[%d], k [%d] and results[%d]=%c LastError[%d]Flag[%d]FAILED\n", - lpSource_MoveFileExW_test1[i], lpDestination_MoveFileExW_test1[j], - k == 1 ? + Trace("MoveFileExW(%S, %S, %s): Values of i[%d], j[%d], k [%d] and results[%d]=%c LastError[%d]Flag[%d]FAILED\n", + lpSource_MoveFileExW_test1[i], lpDestination_MoveFileExW_test1[j], + k == 1 ? "MOVEFILE_REPLACE_EXISTING":"MOVEFILE_COPY_ALLOWED", i, j, k, nCounter, results[nCounter], GetLastError(), bRc); goto EXIT; } - //Trace("MoveFileExW(%S, %S, %s): Values of i[%d], j[%d], k [%d] and results[%d]=%c \n", - // lpSource_MoveFileExW_test1[i], lpDestination_MoveFileExW_test1[j], - // k == 1 ? + //Trace("MoveFileExW(%S, %S, %s): Values of i[%d], j[%d], k [%d] and results[%d]=%c \n", + // lpSource_MoveFileExW_test1[i], lpDestination_MoveFileExW_test1[j], + // k == 1 ? // "MOVEFILE_REPLACE_EXISTING":"MOVEFILE_COPY_ALLOWED", i, j, k, nCounter, results[nCounter]); @@ -338,7 +338,7 @@ PALTEST(file_io_MoveFileExW_test1_paltest_movefileexw_test1, "file_io/MoveFileEx } /* create the temp source file */ - hFile = CreateFileW(tempSource, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, + hFile = CreateFileW(tempSource, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if( hFile == INVALID_HANDLE_VALUE ) @@ -347,7 +347,7 @@ PALTEST(file_io_MoveFileExW_test1_paltest_movefileexw_test1, "file_io/MoveFileEx "create the file correctly.\n"); goto EXIT; } - + bRc = CloseHandle(hFile); if(!bRc) { @@ -383,7 +383,7 @@ PALTEST(file_io_MoveFileExW_test1_paltest_movefileexw_test1, "file_io/MoveFileEx Trace("MoveFileExW: GetFileAttributes failed to get " "the file's attributes.\n"); goto EXIT; - } + } if((result & FILE_ATTRIBUTE_READONLY) != FILE_ATTRIBUTE_READONLY) { diff --git a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test9/createfilemapping.cpp b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test9/createfilemapping.cpp index 70c52936011..fe34754bf73 100644 --- a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test9/createfilemapping.cpp +++ b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test9/createfilemapping.cpp @@ -36,7 +36,7 @@ PALTEST(filemapping_memmgt_CreateFileMappingW_test9_paltest_createfilemappingw_t FILE_SHARE_READ, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, + FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) @@ -68,7 +68,7 @@ PALTEST(filemapping_memmgt_CreateFileMappingW_test9_paltest_createfilemappingw_t Fail(""); } - /* Attempt to create a unnamed file-mapping object to a zero lenght + /* Attempt to create a unnamed file-mapping object to a zero length * file. */ hFileMapping = CreateFileMapping( @@ -102,7 +102,7 @@ PALTEST(filemapping_memmgt_CreateFileMappingW_test9_paltest_createfilemappingw_t Fail(""); } - /* Attempt to create a file mapping that is larger than + /* Attempt to create a file mapping that is larger than * the file. */ hFileMapping = CreateFileMapping( @@ -143,7 +143,7 @@ PALTEST(filemapping_memmgt_CreateFileMappingW_test9_paltest_createfilemappingw_t } /* Terminate the PAL. - */ + */ PAL_Terminate(); return PASS; } diff --git a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/test1.cpp index 97448fadaf9..7c2772857fa 100644 --- a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/test1.cpp +++ b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/FreeLibraryAndExitThread/test1/test1.cpp @@ -2,13 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. /*===================================================================== -** +** ** Source: test1.c (FreeLibraryAndExitThread) ** ** Purpose: Tests the PAL implementation of the FreeLibraryAndExitThread -** function. FreeLibraryAndExitThread when run will exit the +** function. FreeLibraryAndExitThread when run will exit the ** process that it is called within, therefore we create a -** thread to run the API. Then test for the existance of the +** thread to run the API. Then test for the existence of the ** thread and access to the library. ** ** @@ -54,7 +54,7 @@ PALTEST(filemapping_memmgt_FreeLibraryAndExitThread_test1_paltest_freelibraryand BOOL PALAPI StartThreadTest_FreeLibraryAndExitThread_test1() { HMODULE hLib; - HANDLE hThread; + HANDLE hThread; DWORD dwThreadId; LPTHREAD_START_ROUTINE lpStartAddress = &CreateTestThread_FreeLibraryAndExitThread_test1; LPVOID lpParameter = (LPVOID)lpStartAddress; @@ -64,12 +64,12 @@ BOOL PALAPI StartThreadTest_FreeLibraryAndExitThread_test1() if(hLib == NULL) { Trace("ERROR: Unable to load library %s\n", LibraryName); - + return (FALSE); } /*Start the test thread*/ - hThread = CreateThread(NULL, + hThread = CreateThread(NULL, (DWORD)0, lpStartAddress, hLib, @@ -90,22 +90,22 @@ BOOL PALAPI StartThreadTest_FreeLibraryAndExitThread_test1() { Trace("ERROR:%u: hThread=0x%4.4lx not exited by " "FreeLibraryAndExitThread, RC[%d]\n", - GetLastError(), + GetLastError(), hThread, rc); -// There is a possibility that the other thread might +// There is a possibility that the other thread might // still be using the library VSW:337893 // FreeLibrary(hLib); CloseHandle(hThread); return (FALSE); } - + /*Test access to DLL.*/ if(!TestDll_FreeLibraryAndExitThread_test1(hLib, 0)) { Trace("ERROR: TestDll function returned FALSE " "expected TRUE\n."); - + CloseHandle(hThread); return (FALSE); } @@ -121,7 +121,7 @@ BOOL PALAPI TestDll_FreeLibraryAndExitThread_test1(HMODULE hLib, int testResult) { int RetVal; char FunctName[] = "DllTest"; - FARPROC DllAddr; + FARPROC DllAddr; /* Attempt to grab the proc address of the dll function. * This one should succeed.*/ @@ -130,12 +130,12 @@ BOOL PALAPI TestDll_FreeLibraryAndExitThread_test1(HMODULE hLib, int testResult) DllAddr = GetProcAddress(hLib, FunctName); if(DllAddr == NULL) { - Trace("ERROR: Unable to load function \"%s\" library \"%s\"\n", + Trace("ERROR: Unable to load function \"%s\" library \"%s\"\n", FunctName, LibraryName); return (FALSE); } - /* Run the function in the DLL, + /* Run the function in the DLL, * to ensure that the DLL was loaded properly.*/ RetVal = DllAddr(); if (RetVal != 1) @@ -155,8 +155,8 @@ BOOL PALAPI TestDll_FreeLibraryAndExitThread_test1(HMODULE hLib, int testResult) if(DllAddr != NULL) { Trace("ERROR: Able to load function \"%s\" from free'd" - " library \"%s\"\n", - FunctName, + " library \"%s\"\n", + FunctName, LibraryName); return (FALSE); } diff --git a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/VirtualFree/test3/VirtualFree.cpp b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/VirtualFree/test3/VirtualFree.cpp index 133f82c9f86..50c5cfb0a71 100644 --- a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/VirtualFree/test3/VirtualFree.cpp +++ b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/VirtualFree/test3/VirtualFree.cpp @@ -27,10 +27,10 @@ PALTEST(filemapping_memmgt_VirtualFree_test3_paltest_virtualfree_test3, "filemap { ExitProcess(FAIL); } - - //Allocate the physical storage in memory or in the paging file on disk + + //Allocate the physical storage in memory or in the paging file on disk lpVirtualAddress = VirtualAlloc(NULL,//system determine where to allocate the region - VIRTUALSIZE, //specify the size + VIRTUALSIZE, //specify the size MEM_RESERVE, //allocation type PAGE_NOACCESS); //access protection if(NULL == lpVirtualAddress) @@ -40,7 +40,7 @@ PALTEST(filemapping_memmgt_VirtualFree_test3_paltest_virtualfree_test3, "filemap //decommit and release the specified region err = VirtualFree(lpVirtualAddress, //base address - VIRTUALSIZE, //decommited size + VIRTUALSIZE, //decommitted size MEM_DECOMMIT|MEM_RELEASE);//free operation if(0 != err) { diff --git a/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp b/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp index 67981857963..fabf8fda884 100644 --- a/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp +++ b/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test2/test.cpp @@ -17,7 +17,7 @@ WCHAR OutBuffer_FormatMessageW_test2[1024]; /* Pass this test the string "INSERT" and it will succeed */ -int test1(int num, ...) +int test1(int num, ...) { WCHAR * TheString = convert("Pal %1!s! Testing"); @@ -25,7 +25,7 @@ int test1(int num, ...) va_list TheList; va_start(TheList,num); memset( OutBuffer_FormatMessageW_test2, 0, 1024 * sizeof(OutBuffer_FormatMessageW_test2[0]) ); - + ReturnResult = FormatMessage( FORMAT_MESSAGE_FROM_STRING, /* source and processing options */ TheString, /* message source */ @@ -35,39 +35,39 @@ int test1(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string," " with the 's' formatter."); - + } - + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal INSERT Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal INSERT " + Fail("ERROR: The formatted string should have been 'Pal INSERT " "Testing' but '%s' was returned.", convertC(OutBuffer_FormatMessageW_test2)); } - + return PASS; } /* Pass this test the int 40 and it will succeed */ -int test2(int num, ...) +int test2(int num, ...) { WCHAR * TheString = convert("Pal %1!i! Testing"); int ReturnResult; va_list TheList; va_start(TheList,num); - + memset( OutBuffer_FormatMessageW_test2, 0, 1024 * sizeof(OutBuffer_FormatMessageW_test2[0]) ); ReturnResult = FormatMessage( @@ -79,19 +79,19 @@ int test2(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " - "The function failed when trying to Format a simple string," - " with the 'i' formatter."); + "The function failed when trying to Format a simple string," + " with the 'i' formatter."); } - - if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 40 Testing"),wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 40 Testing"),wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal 40 Testing' " + Fail("ERROR: The formatted string should have been 'Pal 40 Testing' " "but '%s' was returned.", convertC(OutBuffer_FormatMessageW_test2)); } return PASS; @@ -115,23 +115,23 @@ int test3(int num, ...) { 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string," " with the 'c' formatter."); } - - if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal a Testing"),wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal a Testing"),wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal a Testing' " + Fail("ERROR: The formatted string should have been 'Pal a Testing' " "but '%s' was returned.", convertC(OutBuffer_FormatMessageW_test2)); - + } - + return PASS; } @@ -153,28 +153,28 @@ int test4(int num, ...) { 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string," - " with the 'C' formatter."); + " with the 'C' formatter."); } - - if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal a Testing"),wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal a Testing"),wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal a Testing' " + Fail("ERROR: The formatted string should have been 'Pal a Testing' " "but '%s' was returned.",convertC(OutBuffer_FormatMessageW_test2)); } - + return PASS; } /* Pass this test the number 57 and it will succeed */ -int test5(int num, ...) +int test5(int num, ...) { WCHAR * TheString = convert("Pal %1!d! Testing"); @@ -192,24 +192,24 @@ int test5(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string, " "with the 'd' formatter."); - + } - + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 57 Testing"),wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal 57 Testing' " + Fail("ERROR: The formatted string should have been 'Pal 57 Testing' " "but '%s' was returned.",convertC(OutBuffer_FormatMessageW_test2)); - + } - + return PASS; } @@ -232,25 +232,25 @@ int test6(int num, ...) { 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string, " "with the 'hc' and 'hC' formatters."); - + } - + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal a and b Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal a and b " + Fail("ERROR: The formatted string should have been 'Pal a and b " "Testing' but '%s' was returned.", convertC(OutBuffer_FormatMessageW_test2)); - + } - + return PASS; } @@ -274,25 +274,25 @@ int test7(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string, " "with the 'hd', 'hs' and 'hS' formatters."); - + } - - if(memcmp(OutBuffer_FormatMessageW_test2, + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 90 and foo and bar Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal 90 and foo " + Fail("ERROR: The formatted string should have been 'Pal 90 and foo " "and bar Testing' but '%s' was returned.",convertC(OutBuffer_FormatMessageW_test2)); } - + return PASS; } @@ -301,7 +301,7 @@ int test7(int num, ...) int test8(int num, ...) { - WCHAR * TheString = + WCHAR * TheString = convert("Pal %1!lc! and %2!lC! and %3!ld! and %4!li! Testing"); int ReturnResult; va_list TheList; @@ -317,31 +317,31 @@ int test8(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string, " "with the 'lc', 'lC', 'ld' and 'li' formatters."); - + } - - if(memcmp(OutBuffer_FormatMessageW_test2, + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal a and b and 50 and 100 Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal a and b and 50" + Fail("ERROR: The formatted string should have been 'Pal a and b and 50" " and 100 Testing' but '%s' was returned.",convertC(OutBuffer_FormatMessageW_test2)); - + } - + return PASS; } -/* Pass this test the wide string 'foo' and 'bar' and the unsigned - int 56 to pass +/* Pass this test the wide string 'foo' and 'bar' and the unsigned + int 56 to pass */ int test9(int num, ...) { @@ -360,26 +360,26 @@ int test9(int num, ...) { 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " - "The function failed when trying to Format a simple string," + "The function failed when trying to Format a simple string," " with the 'ls', 'lS' and 'lu' formatters."); - + } - - if(memcmp(OutBuffer_FormatMessageW_test2, + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal foo and bar and 56 Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal foo and bar " + Fail("ERROR: The formatted string should have been 'Pal foo and bar " "and 56 Testing' but '%s' was returned.",convertC(OutBuffer_FormatMessageW_test2)); - + } - + return PASS; } @@ -402,26 +402,26 @@ int test10(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string, " "with the 'lx' and 'lX' formatters."); - + } - - if(memcmp(OutBuffer_FormatMessageW_test2, + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 123ab and 123CD Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal 123ab and " + Fail("ERROR: The formatted string should have been 'Pal 123ab and " "123CD Testing' but '%s' was returned.", convertC(OutBuffer_FormatMessageW_test2)); - + } - + return PASS; } @@ -445,59 +445,59 @@ int test11(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string, " "with the 'p' and 'S' formatters."); - + } - + /* ** Run only on 64 bit platforms */ #if defined(HOST_64BIT) Trace("Testing for 64 Bit Platforms \n"); - if(memcmp(OutBuffer_FormatMessageW_test2, + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 00000000000123AB and foo Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0 && + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0 && /* BSD style */ memcmp( OutBuffer_FormatMessageW_test2, convert( "Pal 0x123ab and foo Testing" ), - wcslen(OutBuffer_FormatMessageW_test2)*2+2 ) != 0 ) + wcslen(OutBuffer_FormatMessageW_test2)*2+2 ) != 0 ) { - Fail("ERROR: The formated string should have been 'Pal 000123AB and " + Fail("ERROR: The formatted string should have been 'Pal 000123AB and " "foo Testing' but '%s' was returned.",convertC(OutBuffer_FormatMessageW_test2)); - + } #else Trace("Testing for Non 64 Bit Platforms \n"); - if(memcmp(OutBuffer_FormatMessageW_test2, + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 000123AB and foo Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0 && + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0 && /* BSD style */ memcmp( OutBuffer_FormatMessageW_test2, convert( "Pal 0x123ab and foo Testing" ), - wcslen(OutBuffer_FormatMessageW_test2)*2+2 ) != 0 ) + wcslen(OutBuffer_FormatMessageW_test2)*2+2 ) != 0 ) { - Fail("ERROR: The formated string should have been 'Pal 000123AB and " + Fail("ERROR: The formatted string should have been 'Pal 000123AB and " "foo Testing' but '%s' was returned.",convertC(OutBuffer_FormatMessageW_test2)); - + } #endif - + return PASS; } -/* Pass this test the unsigned int 100 and the hex values 0x123ab and 0x123cd +/* Pass this test the unsigned int 100 and the hex values 0x123ab and 0x123cd to succeed */ -int test12(int num, ...) +int test12(int num, ...) { WCHAR * TheString = convert("Pal %1!u! and %2!x! and %3!X! Testing"); @@ -515,27 +515,27 @@ int test12(int num, ...) 1024, /* maximum size of message buffer */ &TheList /* array of message inserts */ ); - + va_end(TheList); - - if(ReturnResult == 0) + + if(ReturnResult == 0) { Fail("ERROR: The return value was 0, which indicates failure. " "The function failed when trying to Format a simple string, " "with the 'u', 'x' and 'X' formatters."); - + } - - if(memcmp(OutBuffer_FormatMessageW_test2, + + if(memcmp(OutBuffer_FormatMessageW_test2, convert("Pal 100 and 123ab and 123CD Testing"), - wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) + wcslen(OutBuffer_FormatMessageW_test2)*2+2) != 0) { - Fail("ERROR: The formated string should have been 'Pal 100 and " + Fail("ERROR: The formatted string should have been 'Pal 100 and " "123ab and 123CD Testing' but '%s' was returned.", convertC(OutBuffer_FormatMessageW_test2)); - + } - + return PASS; } @@ -555,7 +555,7 @@ PALTEST(miscellaneous_FormatMessageW_test2_paltest_formatmessagew_test2, "miscel } if(test1(0,szwInsert) || /* Test %s */ - test2(0,40) || /* Test %i */ + test2(0,40) || /* Test %i */ test3(0,'a') || /* Test %c */ test4(0,'a') || /* Test %C */ test5(0,57) || /* Test %d */ @@ -567,13 +567,13 @@ PALTEST(miscellaneous_FormatMessageW_test2_paltest_formatmessagew_test2, "miscel test11(0,(void *)0x123ab,"foo") || /* Test %p, %S */ test12(0,100,0x123ab,0x123cd)) /* Test %u,x,X */ { - - + + } - + PAL_Terminate(); return PASS; - + } diff --git a/src/coreclr/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp b/src/coreclr/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp index 07756ae4234..4d34414e72c 100644 --- a/src/coreclr/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp +++ b/src/coreclr/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp @@ -6,7 +6,7 @@ ** Source: pal_registerlibraryw_unregisterlibraryw_neg.c ** ** Purpose: Negative test the PAL_RegisterLibrary API. -** Call PAL_RegisterLibrary to map a non-existant module +** Call PAL_RegisterLibrary to map a non-existent module ** into the calling process address space. ** ** diff --git a/src/coreclr/pal/tests/palsuite/threading/CreateEventW/test3/test3.cpp b/src/coreclr/pal/tests/palsuite/threading/CreateEventW/test3/test3.cpp index 023ccd1018a..559348727b7 100644 --- a/src/coreclr/pal/tests/palsuite/threading/CreateEventW/test3/test3.cpp +++ b/src/coreclr/pal/tests/palsuite/threading/CreateEventW/test3/test3.cpp @@ -3,12 +3,12 @@ /*============================================================ ** -** Source: test3.c +** Source: test3.c ** -** Purpose: Tests for CreateEvent. Create an unnamed event, create -** an event with an empty name, create an event with a name longer than -** MAX_PATH, MAX_PATH + 1, create an event with a name already taken -** by a non-event object, create an event with a name already taken +** Purpose: Tests for CreateEvent. Create an unnamed event, create +** an event with an empty name, create an event with a name longer than +** MAX_PATH, MAX_PATH + 1, create an event with a name already taken +** by a non-event object, create an event with a name already taken ** by an event object. ** ** @@ -17,13 +17,13 @@ #define SWAPPTR ((VOID *) (-1)) -struct testCase +struct testCase { LPSECURITY_ATTRIBUTES lpEventAttributes; BOOL bManualReset; BOOL bInitialState; WCHAR lpName[MAX_PATH + 2]; - DWORD dwNameLen; + DWORD dwNameLen; DWORD lastError; BOOL bResult; }; @@ -32,7 +32,7 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea { struct testCase testCases[]= { - {0, TRUE, FALSE, {'\0'}, 0, ERROR_SUCCESS, PASS}, + {0, TRUE, FALSE, {'\0'}, 0, ERROR_SUCCESS, PASS}, {0, TRUE, FALSE, {'\0'}, 5, ERROR_SUCCESS, PASS}, {0, TRUE, FALSE, {'\0'}, 5, ERROR_ALREADY_EXISTS, PASS}, {0, TRUE, FALSE, {'\0'}, 6, ERROR_INVALID_HANDLE, PASS}, @@ -52,14 +52,14 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea HANDLE hUnnamedEvent; DWORD dwRet; int i; - + if(0 != (PAL_Initialize(argc, argv))) { return ( FAIL ); } hUnnamedEvent = CreateEventW(0, TRUE, FALSE, NULL); - + if ( NULL == hUnnamedEvent ) { bRet = FALSE; @@ -73,23 +73,23 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea { bRet = FALSE; Trace("PALSUITE ERROR: CreateEventW: CloseHandle(%lp); call " - "failed\nGetLastError returned '%u'.\n", hUnnamedEvent, + "failed\nGetLastError returned '%u'.\n", hUnnamedEvent, GetLastError()); } /* Create non-event with the same name as one of the testCases */ - hFMap = CreateFileMappingW( SWAPPTR, NULL, PAGE_READONLY, 0, 1, - nonEventName ); + hFMap = CreateFileMappingW( SWAPPTR, NULL, PAGE_READONLY, 0, 1, + nonEventName ); if ( NULL == hFMap ) { bRet = FALSE; Trace ( "PALSUITE ERROR: CreateFileMapping (%p, %p, %d, %d, %d, %S)" - " call returned NULL.\nGetLastError returned %u\n", - SWAPPTR, NULL, PAGE_READONLY, 0, 0, nonEventName, + " call returned NULL.\nGetLastError returned %u\n", + SWAPPTR, NULL, PAGE_READONLY, 0, 0, nonEventName, GetLastError()); } - + /* Create Events */ for (i = 0; i < sizeof(testCases)/sizeof(struct testCase); i++) { @@ -98,19 +98,19 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea memset (name, 'a', testCases[i].dwNameLen ); wName = convert(name); - - wcsncpy(testCases[i].lpName, wName, + + wcsncpy(testCases[i].lpName, wName, testCases[i].dwNameLen); free(wName); SetLastError(ERROR_SUCCESS); - hEvent[i] = CreateEventW( testCases[i].lpEventAttributes, - testCases[i].bManualReset, - testCases[i].bInitialState, - testCases[i].lpName); - + hEvent[i] = CreateEventW( testCases[i].lpEventAttributes, + testCases[i].bManualReset, + testCases[i].bInitialState, + testCases[i].lpName); + if (hEvent[i] != INVALID_HANDLE_VALUE) { DWORD dwError = GetLastError(); @@ -121,7 +121,7 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea Trace ("PALSUITE ERROR:\nCreateEvent(%lp, %d, %d, %S)" "\nGetLastError returned '%u', it should have returned" "'%d' at index '%d'.\n", testCases[i].lpEventAttributes, - testCases[i].bManualReset, testCases[i].bInitialState, + testCases[i].bManualReset, testCases[i].bInitialState, testCases[i].lpName, dwError, testCases[i].lastError, i); } @@ -133,7 +133,7 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea { result [i] = 1; } - /* + /* * If we expected the testcase to FAIL and it passed, * report an error. */ @@ -142,14 +142,14 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea bRet = FALSE; Trace ("PALSUITE ERROR:\nCreateEvent(%lp, %d, %d, %S)" "\nShould have returned INVALID_HANDLE_VALUE but " - "didn't at index '%d'.\n", - testCases[i].lpEventAttributes, - testCases[i].bManualReset, + "didn't at index '%d'.\n", + testCases[i].lpEventAttributes, + testCases[i].bManualReset, testCases[i].bInitialState, testCases[i].lpName, i); } - /* - * If result hasn't been set already set it to 0 so all the + /* + * If result hasn't been set already set it to 0 so all the * resources will be freed. */ if (!result[i]) @@ -157,20 +157,20 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea result[i] = 0; } } - else + else { - /* - * If we get an INVALID_HANDLE_VALUE and we expected the + /* + * If we get an INVALID_HANDLE_VALUE and we expected the * test case to pass, report an error. */ result[i] = 1; - + if (testCases[i].bResult == PASS) { bRet = FALSE; Trace ("PALSUITE ERROR:\nCreateEvent(%lp, %d, %d, %S);" - "\nReturned INVALID_HANDLE_VALUE at index '%d'.\n", - testCases[i].lpEventAttributes, + "\nReturned INVALID_HANDLE_VALUE at index '%d'.\n", + testCases[i].lpEventAttributes, testCases[i].bManualReset, testCases[i].bInitialState, testCases[i].lpName, i); } @@ -185,7 +185,7 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea continue; } dwRet = WaitForSingleObject ( hEvent[i], 0 ); - + if (dwRet != WAIT_TIMEOUT) { bRet = FALSE; @@ -193,12 +193,12 @@ PALTEST(threading_CreateEventW_test3_paltest_createeventw_test3, "threading/Crea "%d) call failed at index %d .\nGetLastError returned " "'%u'.\n", hEvent[i], 0, i, GetLastError()); } - + if (!CloseHandle(hEvent[i])) { bRet = FALSE; Trace("PALSUITE ERROR: CreateEventW: CloseHandle(%lp) call " - "failed at index %d\nGetLastError returned '%u'.\n", + "failed at index %d\nGetLastError returned '%u'.\n", hEvent[i], i, GetLastError()); } } @@ -208,7 +208,7 @@ done: { bRet = FALSE; Trace("PALSUITE ERROR: CreateEventW: CloseHandle(%p) call " - "failed\nGetLastError returned '%u'.\n", hFMap, + "failed\nGetLastError returned '%u'.\n", hFMap, GetLastError()); } @@ -216,15 +216,15 @@ done: { bRet = FAIL; } - else + else { bRet = PASS; } - + PAL_TerminateEx(bRet); - + return(bRet); - + } diff --git a/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.cpp index 03a1849bdb6..df2e6d4b7ec 100644 --- a/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.cpp +++ b/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.cpp @@ -3,7 +3,7 @@ /*============================================================ ** -** Source: test1.c +** Source: test1.c ** ** Purpose: Test for WaitForMultipleObjects. Call the function ** on an array of 4 events, and ensure that it returns correct @@ -25,16 +25,16 @@ BOOL WaitForMultipleObjectsTest() DWORD i = 0, j = 0; LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; - BOOL bManualReset = TRUE; + BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; HANDLE hEvent[MAX_EVENTS]; - /* Run through this for loop and create 4 events */ + /* Run through this for loop and create 4 events */ for (i = 0; i < MAX_EVENTS; i++) { - hEvent[i] = CreateEvent( lpEventAttributes, - bManualReset, bInitialState, NULL); + hEvent[i] = CreateEvent( lpEventAttributes, + bManualReset, bInitialState, NULL); if (hEvent[i] == INVALID_HANDLE_VALUE) { @@ -42,7 +42,7 @@ BOOL WaitForMultipleObjectsTest() bRet = FALSE; break; } - + /* Set the current event */ bRet = SetEvent(hEvent[i]); @@ -52,7 +52,7 @@ BOOL WaitForMultipleObjectsTest() bRet = FALSE; break; } - + /* Ensure that this returns the correct value */ dwRet = WaitForSingleObject(hEvent[i],0); @@ -74,7 +74,7 @@ BOOL WaitForMultipleObjectsTest() bRet = FALSE; break; } - + dwRet = WaitForSingleObject(hEvent[i],0); if (dwRet != WAIT_TIMEOUT) @@ -84,24 +84,24 @@ BOOL WaitForMultipleObjectsTest() break; } } - - /* + + /* * If the first section of the test passed, move on to the - * second. + * second. */ if (bRet) { BOOL bWaitAll = TRUE; DWORD nCount = MAX_EVENTS; - CONST HANDLE *lpHandles = &hEvent[0]; + CONST HANDLE *lpHandles = &hEvent[0]; /* Call WaitForMultipleOjbects on all the events, the return should be WAIT_TIMEOUT */ - dwRet = WaitForMultipleObjects( nCount, - lpHandles, - bWaitAll, + dwRet = WaitForMultipleObjects( nCount, + lpHandles, + bWaitAll, 0); if (dwRet != WAIT_TIMEOUT) @@ -111,18 +111,18 @@ BOOL WaitForMultipleObjectsTest() else { /* Step through each event and one at a time, set the - currect test, while reseting all the other tests + currect test, while resetting all the other tests */ - + for (i = 0; i < MAX_EVENTS; i++) { for (j = 0; j < MAX_EVENTS; j++) { if (j == i) { - + bRet = SetEvent(hEvent[j]); - + if (!bRet) { Trace("WaitForMultipleObjectsTest:SetEvent %u failed (%x)\n", j, GetLastError()); @@ -132,20 +132,20 @@ BOOL WaitForMultipleObjectsTest() else { bRet = ResetEvent(hEvent[j]); - + if (!bRet) { Trace("WaitForMultipleObjectsTest:ResetEvent %u failed (%x)\n", j, GetLastError()); } } } - + bWaitAll = FALSE; - /* Check that WaitFor returns WAIT_OBJECT + i */ - dwRet = WaitForMultipleObjects( nCount, + /* Check that WaitFor returns WAIT_OBJECT + i */ + dwRet = WaitForMultipleObjects( nCount, lpHandles, bWaitAll, 0); - + if (dwRet != WAIT_OBJECT_0+i) { Trace("WaitForMultipleObjectsTest:WaitForMultipleObjects failed (%x)\n", GetLastError()); @@ -154,18 +154,18 @@ BOOL WaitForMultipleObjectsTest() } } } - + for (i = 0; i < MAX_EVENTS; i++) { bRet = CloseHandle(hEvent[i]); - + if (!bRet) { Trace("WaitForMultipleObjectsTest:CloseHandle %u failed (%x)\n", i, GetLastError()); } } } - + return bRet; } @@ -201,12 +201,12 @@ BOOL WaitMultipleDuplicateHandleTest_WFMO_test1() PALTEST(threading_WaitForMultipleObjects_test1_paltest_waitformultipleobjects_test1, "threading/WaitForMultipleObjects/test1/paltest_waitformultipleobjects_test1") { - + if(0 != (PAL_Initialize(argc, argv))) { return ( FAIL ); } - + if(!WaitForMultipleObjectsTest()) { Fail ("Test failed\n"); diff --git a/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.cpp index a6248f6b519..e4a6c844dec 100644 --- a/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.cpp +++ b/src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.cpp @@ -3,7 +3,7 @@ /*============================================================ ** -** Source: test1.c +** Source: test1.c ** ** Purpose: Test for WaitForMultipleObjectsEx. Call the function ** on an array of 4 events, and ensure that it returns correct @@ -14,7 +14,7 @@ #include <palsuite.h> -/* Originally written as WaitForMultipleObjects/test1 */ +/* Originally written as WaitForMultipleObjects/test1 */ /* Number of events in array */ @@ -27,16 +27,16 @@ BOOL WaitForMultipleObjectsExTest() DWORD i = 0, j = 0; LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; - BOOL bManualReset = TRUE; + BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; HANDLE hEvent[MAX_EVENTS]; - /* Run through this for loop and create 4 events */ + /* Run through this for loop and create 4 events */ for (i = 0; i < MAX_EVENTS; i++) { - hEvent[i] = CreateEvent( lpEventAttributes, - bManualReset, bInitialState, NULL); + hEvent[i] = CreateEvent( lpEventAttributes, + bManualReset, bInitialState, NULL); if (hEvent[i] == INVALID_HANDLE_VALUE) { @@ -44,7 +44,7 @@ BOOL WaitForMultipleObjectsExTest() bRet = FALSE; break; } - + /* Set the current event */ bRet = SetEvent(hEvent[i]); @@ -54,7 +54,7 @@ BOOL WaitForMultipleObjectsExTest() bRet = FALSE; break; } - + /* Ensure that this returns the correct value */ dwRet = WaitForSingleObject(hEvent[i],0); @@ -76,7 +76,7 @@ BOOL WaitForMultipleObjectsExTest() bRet = FALSE; break; } - + dwRet = WaitForSingleObject(hEvent[i],0); if (dwRet != WAIT_TIMEOUT) @@ -86,24 +86,24 @@ BOOL WaitForMultipleObjectsExTest() break; } } - - /* + + /* * If the first section of the test passed, move on to the - * second. + * second. */ if (bRet) { BOOL bWaitAll = TRUE; DWORD nCount = MAX_EVENTS; - CONST HANDLE *lpHandles = &hEvent[0]; + CONST HANDLE *lpHandles = &hEvent[0]; /* Call WaitForMultipleObjectsEx on all the events, the return should be WAIT_TIMEOUT */ - dwRet = WaitForMultipleObjectsEx(nCount, - lpHandles, - bWaitAll, + dwRet = WaitForMultipleObjectsEx(nCount, + lpHandles, + bWaitAll, 0, FALSE); @@ -114,18 +114,18 @@ BOOL WaitForMultipleObjectsExTest() else { /* Step through each event and one at a time, set the - currect test, while reseting all the other tests + currect test, while resetting all the other tests */ - + for (i = 0; i < MAX_EVENTS; i++) { for (j = 0; j < MAX_EVENTS; j++) { if (j == i) { - + bRet = SetEvent(hEvent[j]); - + if (!bRet) { Trace("WaitForMultipleObjectsExTest:SetEvent %j failed (%x)\n", j, GetLastError()); @@ -135,20 +135,20 @@ BOOL WaitForMultipleObjectsExTest() else { bRet = ResetEvent(hEvent[j]); - + if (!bRet) { Trace("WaitForMultipleObjectsExTest:ResetEvent %u failed (%x)\n", j, GetLastError()); } } } - + bWaitAll = FALSE; - /* Check that WaitFor returns WAIT_OBJECT + i */ - dwRet = WaitForMultipleObjectsEx( nCount, + /* Check that WaitFor returns WAIT_OBJECT + i */ + dwRet = WaitForMultipleObjectsEx( nCount, lpHandles, bWaitAll, 0, FALSE); - + if (dwRet != WAIT_OBJECT_0+i) { Trace("WaitForMultipleObjectsExTest: WaitForMultipleObjectsEx failed (%x)\n", GetLastError()); @@ -157,18 +157,18 @@ BOOL WaitForMultipleObjectsExTest() } } } - + for (i = 0; i < MAX_EVENTS; i++) { bRet = CloseHandle(hEvent[i]); - + if (!bRet) { Trace("WaitForMultipleObjectsExTest:CloseHandle %u failed (%x)\n", i, GetLastError()); } } } - + return bRet; } @@ -204,12 +204,12 @@ BOOL WaitMultipleDuplicateHandleTest_WFMOEx_test1() PALTEST(threading_WaitForMultipleObjectsEx_test1_paltest_waitformultipleobjectsex_test1, "threading/WaitForMultipleObjectsEx/test1/paltest_waitformultipleobjectsex_test1") { - + if(0 != (PAL_Initialize(argc, argv))) { return ( FAIL ); } - + if(!WaitForMultipleObjectsExTest()) { Fail ("Test failed\n"); |