Make TestSynchBarrier verbose

This commit is contained in:
Armin Novak 2021-05-31 12:26:30 +02:00
parent 7467f599b9
commit d4b3267860
1 changed files with 29 additions and 4 deletions

View File

@ -182,6 +182,10 @@ int TestSynchBarrier(int argc, char* argv[])
DWORD dwMaxThreads;
DWORD dwMinThreads;
DWORD dwNumLoops = 200;
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
GetNativeSystemInfo(&sysinfo);
printf("%s: Number of processors: %" PRIu32 "\n", __FUNCTION__, sysinfo.dwNumberOfProcessors);
dwMinThreads = sysinfo.dwNumberOfProcessors;
@ -193,7 +197,8 @@ int TestSynchBarrier(int argc, char* argv[])
/* Test invalid parameters */
if (InitializeSynchronizationBarrier(&gBarrier, 0, -1))
{
printf(
fprintf(
stderr,
"%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = 0\n",
__FUNCTION__);
return -1;
@ -201,7 +206,8 @@ int TestSynchBarrier(int argc, char* argv[])
if (InitializeSynchronizationBarrier(&gBarrier, -1, -1))
{
printf(
fprintf(
stderr,
"%s: InitializeSynchronizationBarrier unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__);
return -1;
@ -209,23 +215,42 @@ int TestSynchBarrier(int argc, char* argv[])
if (InitializeSynchronizationBarrier(&gBarrier, 1, -2))
{
printf("%s: InitializeSynchronizationBarrier unecpectedly succeeded with lSpinCount = -2\n",
__FUNCTION__);
fprintf(
stderr,
"%s: InitializeSynchronizationBarrier unecpectedly succeeded with lSpinCount = -2\n",
__FUNCTION__);
return -1;
}
/* Functional tests */
if (!TestSynchBarrierWithFlags(0, dwMaxThreads, dwNumLoops))
{
fprintf(stderr,
"%s: TestSynchBarrierWithFlags(0) unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__);
return -1;
}
if (!TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY, dwMinThreads,
dwNumLoops))
{
fprintf(stderr,
"%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_SPIN_ONLY) "
"unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__);
return -1;
}
if (!TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY, dwMaxThreads,
dwNumLoops))
{
fprintf(stderr,
"%s: TestSynchBarrierWithFlags(SYNCHRONIZATION_BARRIER_FLAGS_BLOCK_ONLY) "
"unecpectedly succeeded with lTotalThreads = -1\n",
__FUNCTION__);
return -1;
}
printf("%s: Test successfully completed\n", __FUNCTION__);
return 0;