mirror of https://github.com/FreeRDP/FreeRDP
Improved runtime of unit tests
This commit is contained in:
parent
2a91afb0cf
commit
c5fded2d83
|
@ -133,7 +133,7 @@ static BOOL run_encode_decode(UINT16 bpp, BITMAP_INTERLEAVED_CONTEXT* encoder,
|
|||
PROFILER_CREATE(profiler_comp, get_profiler_name(TRUE, bpp))
|
||||
PROFILER_CREATE(profiler_decomp, get_profiler_name(FALSE, bpp))
|
||||
|
||||
for (x = 0; x < 500; x++)
|
||||
for (x = 0; x < 50; x++)
|
||||
{
|
||||
if (!run_encode_decode_single(bpp, encoder, decoder
|
||||
#if defined(WITH_PROFILER)
|
||||
|
|
|
@ -5547,9 +5547,9 @@ static BOOL RunTestPlanarSingleColor(BITMAP_PLANAR_CONTEXT* planar, const UINT32
|
|||
FreeRDPGetColorFormatName(dstFormat));
|
||||
fflush(stdout);
|
||||
|
||||
for (j = 0; j < 100; j += 8)
|
||||
for (j = 0; j < 32; j += 8)
|
||||
{
|
||||
for (i = 4; i < 64; i += 8)
|
||||
for (i = 4; i < 32; i += 8)
|
||||
{
|
||||
UINT32 compressedSize;
|
||||
const UINT32 fill = j;
|
||||
|
@ -5670,7 +5670,7 @@ static BOOL FuzzPlanar(void)
|
|||
if (!planar)
|
||||
goto fail;
|
||||
|
||||
for (x = 0; x < 10000; x++)
|
||||
for (x = 0; x < 100; x++)
|
||||
{
|
||||
BYTE data[0x10000] = { 0 };
|
||||
size_t dataSize = 0x10000;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
static HANDLE s_sync = NULL;
|
||||
|
||||
static int runInstance(int argc, char* argv[], freerdp** inst)
|
||||
static int runInstance(int argc, char* argv[], freerdp** inst, DWORD timeout)
|
||||
{
|
||||
int rc = -1;
|
||||
RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
|
||||
|
@ -25,6 +25,9 @@ static int runInstance(int argc, char* argv[], freerdp** inst)
|
|||
if (freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE) < 0)
|
||||
goto finish;
|
||||
|
||||
if (!freerdp_settings_set_uint32(context->settings, FreeRDP_TcpConnectTimeout, timeout))
|
||||
goto finish;
|
||||
|
||||
if (!freerdp_client_load_addins(context->channels, context->settings))
|
||||
goto finish;
|
||||
|
||||
|
@ -52,14 +55,15 @@ finish:
|
|||
|
||||
static int testTimeout(int port)
|
||||
{
|
||||
const DWORD timeout = 200;
|
||||
DWORD start, end, diff;
|
||||
char arg1[] = "/v:192.0.2.1:XXXXX";
|
||||
char* argv[] = { "test", "/v:192.0.2.1:XXXXX", NULL };
|
||||
char* argv[] = { "test", "/v:192.0.2.1:XXXXX" };
|
||||
int rc;
|
||||
_snprintf(arg1, 18, "/v:192.0.2.1:%d", port);
|
||||
argv[1] = arg1;
|
||||
start = GetTickCount();
|
||||
rc = runInstance(2, argv, NULL);
|
||||
rc = runInstance(ARRAYSIZE(argv), argv, NULL, timeout);
|
||||
end = GetTickCount();
|
||||
|
||||
if (rc != 1)
|
||||
|
@ -67,10 +71,10 @@ static int testTimeout(int port)
|
|||
|
||||
diff = end - start;
|
||||
|
||||
if (diff > 16000)
|
||||
if (diff > 4 * timeout)
|
||||
return -1;
|
||||
|
||||
if (diff < 14000)
|
||||
if (diff < timeout)
|
||||
return -1;
|
||||
|
||||
printf("%s: Success!\n", __FUNCTION__);
|
||||
|
@ -86,12 +90,12 @@ struct testThreadArgs
|
|||
static DWORD WINAPI testThread(LPVOID arg)
|
||||
{
|
||||
char arg1[] = "/v:192.0.2.1:XXXXX";
|
||||
char* argv[] = { "test", "/v:192.0.2.1:XXXXX", NULL };
|
||||
char* argv[] = { "test", "/v:192.0.2.1:XXXXX" };
|
||||
int rc;
|
||||
struct testThreadArgs* args = arg;
|
||||
_snprintf(arg1, 18, "/v:192.0.2.1:%d", args->port);
|
||||
argv[1] = arg1;
|
||||
rc = runInstance(2, argv, args->arg);
|
||||
rc = runInstance(ARRAYSIZE(argv), argv, args->arg, 5000);
|
||||
|
||||
if (rc != 1)
|
||||
ExitThread(-1);
|
||||
|
@ -125,7 +129,7 @@ static int testAbort(int port)
|
|||
}
|
||||
|
||||
WaitForSingleObject(s_sync, INFINITE);
|
||||
Sleep(1000); /* Wait until freerdp_connect has been called */
|
||||
Sleep(100); /* Wait until freerdp_connect has been called */
|
||||
freerdp_abort_connect(instance);
|
||||
status = WaitForSingleObject(instance->context->abortEvent, 0);
|
||||
|
||||
|
@ -211,8 +215,8 @@ static int testSuccess(int port)
|
|||
if (!CreateProcessA(exe, commandLine, NULL, NULL, FALSE, 0, NULL, wpath, &si, &process))
|
||||
goto fail;
|
||||
|
||||
Sleep(3 * 1000); /* let the server start */
|
||||
r = runInstance(argc, clientArgs, NULL);
|
||||
Sleep(600); /* let the server start */
|
||||
r = runInstance(argc, clientArgs, NULL, 5000);
|
||||
|
||||
if (!TerminateProcess(process.hProcess, 0))
|
||||
goto fail;
|
||||
|
|
|
@ -57,6 +57,7 @@ static void test_dump_data(unsigned char* p, int len, int width, const char* nam
|
|||
{
|
||||
unsigned char* line = p;
|
||||
int i, thisline, offset = 0;
|
||||
return; // TODO: Activate this manually if required. Improves test speed
|
||||
printf("\n%s[%d][%d]:\n", name, len / width, width);
|
||||
|
||||
while (offset < len)
|
||||
|
|
|
@ -263,7 +263,7 @@ int TestPrimitivesColors(int argc, char* argv[])
|
|||
PIXEL_FORMAT_XBGR32, PIXEL_FORMAT_RGBA32, PIXEL_FORMAT_RGBX32,
|
||||
PIXEL_FORMAT_BGRA32, PIXEL_FORMAT_BGRX32 };
|
||||
DWORD x;
|
||||
prim_size_t roi = { 1920, 1080 };
|
||||
prim_size_t roi = { 1920 / 4, 1080 / 4 };
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
prim_test_setup(FALSE);
|
||||
|
|
|
@ -1720,6 +1720,8 @@ int TestPrimitivesYCbCr(int argc, char* argv[])
|
|||
const primitives_t* generics = primitives_get_generic();
|
||||
UINT32 x;
|
||||
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
{
|
||||
|
@ -1757,13 +1759,13 @@ int TestPrimitivesYCbCr(int argc, char* argv[])
|
|||
do
|
||||
{
|
||||
winpr_RAND((BYTE*)&roi.width, sizeof(roi.width));
|
||||
roi.width %= 2048;
|
||||
roi.width %= 2048 / 4;
|
||||
} while (roi.width < 16);
|
||||
|
||||
do
|
||||
{
|
||||
winpr_RAND((BYTE*)&roi.height, sizeof(roi.height));
|
||||
roi.height %= 2048;
|
||||
roi.height %= 2048 / 4;
|
||||
} while (roi.height < 16);
|
||||
|
||||
for (x = 0; x < sizeof(formats) / sizeof(formats[0]); x++)
|
||||
|
@ -1795,7 +1797,7 @@ int TestPrimitivesYCbCr(int argc, char* argv[])
|
|||
/* Do a performance run with full HD */
|
||||
else
|
||||
{
|
||||
prim_size_t roi = { 1928, 1080 };
|
||||
prim_size_t roi = { 1928 / 8, 1080 / 8 };
|
||||
|
||||
for (x = 0; x < sizeof(formats) / sizeof(formats[0]); x++)
|
||||
{
|
||||
|
|
|
@ -127,13 +127,13 @@ int TestPrimitivesYCoCg(int argc, char* argv[])
|
|||
do
|
||||
{
|
||||
winpr_RAND((BYTE*)&w, sizeof(w));
|
||||
w %= 2048;
|
||||
w %= 2048 / 4;
|
||||
} while (w < 16);
|
||||
|
||||
do
|
||||
{
|
||||
winpr_RAND((BYTE*)&h, sizeof(h));
|
||||
h %= 2048;
|
||||
h %= 2048 / 4;
|
||||
} while (h < 16);
|
||||
|
||||
if (!test_YCoCgRToRGB_8u_AC4R_func(w, h))
|
||||
|
@ -141,8 +141,8 @@ int TestPrimitivesYCoCg(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
/* Test once with full HD */
|
||||
if (!test_YCoCgRToRGB_8u_AC4R_func(1920, 1080))
|
||||
/* Test once with full HD/4 */
|
||||
if (!test_YCoCgRToRGB_8u_AC4R_func(1920 / 4, 1080 / 4))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -863,7 +863,7 @@ int TestPrimitivesYUV(int argc, char* argv[])
|
|||
prim_test_setup(FALSE);
|
||||
primitives_t* prims = primitives_get();
|
||||
|
||||
for (x = 0; x < 10; x++)
|
||||
for (x = 0; x < 5; x++)
|
||||
{
|
||||
prim_size_t roi;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ static DWORD WINAPI test_error_thread(LPVOID arg)
|
|||
|
||||
do
|
||||
{
|
||||
dwErrorSet = (DWORD)rand();
|
||||
dwErrorSet = (DWORD)abs(rand()) + 1;
|
||||
SetLastError(dwErrorSet);
|
||||
if ((dwErrorGet = GetLastError()) != dwErrorSet)
|
||||
{
|
||||
|
@ -64,6 +64,9 @@ int TestErrorSetLastError(int argc, char* argv[])
|
|||
HANDLE threads[4];
|
||||
int i;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
/* We must initialize WLog here. It will check for settings
|
||||
* in the environment and if the variables are not set, the last
|
||||
* error state is changed... */
|
||||
|
@ -97,8 +100,8 @@ int TestErrorSetLastError(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
// let the threads run for at least 2 seconds
|
||||
Sleep(2000);
|
||||
// let the threads run for at least 0.2 seconds
|
||||
Sleep(200);
|
||||
bStopTest = TRUE;
|
||||
|
||||
WaitForSingleObject(threads[0], INFINITE);
|
||||
|
|
|
@ -11,7 +11,7 @@ static SYNCHRONIZATION_BARRIER gBarrier;
|
|||
static HANDLE gStartEvent = NULL;
|
||||
static LONG gErrorCount = 0;
|
||||
|
||||
#define MAX_SLEEP_MS 32
|
||||
#define MAX_SLEEP_MS 22
|
||||
|
||||
struct test_params
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ int TestSynchBarrier(int argc, char* argv[])
|
|||
SYSTEM_INFO sysinfo;
|
||||
DWORD dwMaxThreads;
|
||||
DWORD dwMinThreads;
|
||||
DWORD dwNumLoops = 200;
|
||||
DWORD dwNumLoops = 10;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <winpr/thread.h>
|
||||
#include <winpr/interlocked.h>
|
||||
|
||||
#define TEST_SYNC_CRITICAL_TEST1_RUNTIME_MS 500
|
||||
#define TEST_SYNC_CRITICAL_TEST1_RUNTIME_MS 50
|
||||
#define TEST_SYNC_CRITICAL_TEST1_RUNS 4
|
||||
|
||||
static CRITICAL_SECTION critical;
|
||||
|
@ -86,6 +86,7 @@ static DWORD WINAPI TestSynchCritical_Test1(LPVOID arg)
|
|||
*/
|
||||
static DWORD WINAPI TestSynchCritical_Test2(LPVOID arg)
|
||||
{
|
||||
WINPR_UNUSED(arg);
|
||||
if (TryEnterCriticalSection(&critical) == TRUE)
|
||||
{
|
||||
LeaveCriticalSection(&critical);
|
||||
|
@ -155,7 +156,7 @@ static DWORD WINAPI TestSynchCritical_Main(LPVOID arg)
|
|||
|
||||
InitializeCriticalSection(&critical);
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
if (critical.RecursionCount != i)
|
||||
{
|
||||
|
@ -216,7 +217,7 @@ static DWORD WINAPI TestSynchCritical_Main(LPVOID arg)
|
|||
|
||||
for (j = 0; j < TEST_SYNC_CRITICAL_TEST1_RUNS; j++)
|
||||
{
|
||||
dwSpinCount = j * 1000;
|
||||
dwSpinCount = j * 100;
|
||||
InitializeCriticalSectionAndSpinCount(&critical, dwSpinCount);
|
||||
|
||||
gTestValueVulnerable = 0;
|
||||
|
@ -319,7 +320,7 @@ int TestSynchCritical(int argc, char* argv[])
|
|||
WINPR_UNUSED(argv);
|
||||
|
||||
dwDeadLockDetectionTimeMs =
|
||||
6 * TEST_SYNC_CRITICAL_TEST1_RUNTIME_MS * TEST_SYNC_CRITICAL_TEST1_RUNS;
|
||||
2 * TEST_SYNC_CRITICAL_TEST1_RUNTIME_MS * TEST_SYNC_CRITICAL_TEST1_RUNS;
|
||||
|
||||
printf("Deadlock will be assumed after %" PRIu32 " ms.\n", dwDeadLockDetectionTimeMs);
|
||||
|
||||
|
@ -337,12 +338,12 @@ int TestSynchCritical(int argc, char* argv[])
|
|||
* Workaround checking the value of bThreadTerminated which is passed in the thread arg
|
||||
*/
|
||||
|
||||
for (i = 0; i < dwDeadLockDetectionTimeMs; i += 100)
|
||||
for (i = 0; i < dwDeadLockDetectionTimeMs; i += 10)
|
||||
{
|
||||
if (bThreadTerminated)
|
||||
break;
|
||||
|
||||
Sleep(100);
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
if (!bThreadTerminated)
|
||||
|
|
|
@ -19,8 +19,12 @@ static BOOL CALLBACK TestOnceFunction(PINIT_ONCE once, PVOID param, PVOID* conte
|
|||
{
|
||||
LONG calls = InterlockedIncrement(pTestOnceFunctionCalls) - 1;
|
||||
|
||||
WINPR_UNUSED(once);
|
||||
WINPR_UNUSED(param);
|
||||
WINPR_UNUSED(context);
|
||||
|
||||
/* simulate execution time */
|
||||
Sleep(100 + rand() % 400);
|
||||
Sleep(30 + rand() % 40);
|
||||
|
||||
if (calls < TEST_NUM_FAILURES)
|
||||
{
|
||||
|
@ -40,6 +44,9 @@ static DWORD WINAPI TestThreadFunction(LPVOID lpParam)
|
|||
{
|
||||
LONG calls;
|
||||
BOOL ok;
|
||||
|
||||
WINPR_UNUSED(lpParam);
|
||||
|
||||
InterlockedIncrement(pTestThreadFunctionCalls);
|
||||
if (WaitForSingleObject(hStartEvent, INFINITE) != WAIT_OBJECT_0)
|
||||
{
|
||||
|
@ -65,6 +72,9 @@ int TestSynchInit(int argc, char* argv[])
|
|||
DWORD i;
|
||||
BOOL result = FALSE;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
pErrors = _aligned_malloc(sizeof(LONG), sizeof(LONG));
|
||||
pTestThreadFunctionCalls = _aligned_malloc(sizeof(LONG), sizeof(LONG));
|
||||
pTestOnceFunctionCalls = _aligned_malloc(sizeof(LONG), sizeof(LONG));
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
static DWORD WINAPI test_thread(LPVOID arg)
|
||||
{
|
||||
long timeout = 300 + (rand() % 1000);
|
||||
long timeout = 30 + (rand() % 100);
|
||||
WINPR_UNUSED(arg);
|
||||
Sleep(timeout);
|
||||
ExitThread(0);
|
||||
|
@ -62,7 +62,7 @@ static BOOL TestWaitForAll(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ret = WaitForMultipleObjects(THREADS, threads, TRUE, 50);
|
||||
ret = WaitForMultipleObjects(THREADS, threads, TRUE, 10);
|
||||
if (ret != WAIT_TIMEOUT)
|
||||
{
|
||||
fprintf(stderr, "%s: WaitForMultipleObjects bWaitAll, timeout 50 failed, ret=%d\n",
|
||||
|
@ -135,7 +135,7 @@ static BOOL TestWaitOneTimeout(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ret = WaitForMultipleObjects(THREADS, threads, FALSE, 50);
|
||||
ret = WaitForMultipleObjects(THREADS, threads, FALSE, 10);
|
||||
if (ret != WAIT_TIMEOUT)
|
||||
{
|
||||
fprintf(stderr, "%s: WaitForMultipleObjects timeout 50 failed, ret=%d\n", __FUNCTION__,
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
static DWORD WINAPI test_thread(LPVOID arg)
|
||||
{
|
||||
Sleep(1000);
|
||||
WINPR_UNUSED(arg);
|
||||
Sleep(100);
|
||||
ExitThread(0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,6 +15,10 @@ int TestSynchThread(int argc, char* argv[])
|
|||
{
|
||||
DWORD rc;
|
||||
HANDLE thread;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
thread = CreateThread(NULL, 0, test_thread, NULL, 0, NULL);
|
||||
|
||||
if (!thread)
|
||||
|
@ -64,7 +69,7 @@ int TestSynchThread(int argc, char* argv[])
|
|||
}
|
||||
|
||||
/* TryJoin should now fail. */
|
||||
rc = WaitForSingleObject(thread, 50);
|
||||
rc = WaitForSingleObject(thread, 10);
|
||||
|
||||
if (WAIT_TIMEOUT != rc)
|
||||
{
|
||||
|
|
|
@ -19,13 +19,15 @@ struct apc_data
|
|||
};
|
||||
typedef struct apc_data APC_DATA;
|
||||
|
||||
VOID CALLBACK TimerRoutine(PVOID lpParam, BOOLEAN TimerOrWaitFired)
|
||||
static VOID CALLBACK TimerRoutine(PVOID lpParam, BOOLEAN TimerOrWaitFired)
|
||||
{
|
||||
UINT32 TimerTime;
|
||||
APC_DATA* apcData;
|
||||
UINT32 expectedTime;
|
||||
UINT32 CurrentTime = GetTickCount();
|
||||
|
||||
WINPR_UNUSED(TimerOrWaitFired);
|
||||
|
||||
if (!lpParam)
|
||||
return;
|
||||
|
||||
|
@ -40,7 +42,7 @@ VOID CALLBACK TimerRoutine(PVOID lpParam, BOOLEAN TimerOrWaitFired)
|
|||
" ExpectedTime: %" PRIu32 " Discrepancy: %" PRIu32 "\n",
|
||||
apcData->TimerId, apcData->FireCount, TimerTime, expectedTime, TimerTime - expectedTime);
|
||||
|
||||
Sleep(50);
|
||||
Sleep(11);
|
||||
|
||||
if (apcData->FireCount == apcData->MaxFireCount)
|
||||
{
|
||||
|
@ -55,6 +57,9 @@ int TestSynchTimerQueue(int argc, char* argv[])
|
|||
HANDLE hTimers[TIMER_COUNT];
|
||||
APC_DATA apcData[TIMER_COUNT];
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
hTimerQueue = CreateTimerQueue();
|
||||
|
||||
if (!hTimerQueue)
|
||||
|
@ -67,8 +72,8 @@ int TestSynchTimerQueue(int argc, char* argv[])
|
|||
{
|
||||
apcData[index].TimerId = index;
|
||||
apcData[index].StartTime = GetTickCount();
|
||||
apcData[index].DueTime = (index * 100) + 500;
|
||||
apcData[index].Period = 1000;
|
||||
apcData[index].DueTime = (index * 10) + 50;
|
||||
apcData[index].Period = 100;
|
||||
apcData[index].FireCount = 0;
|
||||
apcData[index].MaxFireCount = FIRE_COUNT;
|
||||
|
||||
|
@ -79,9 +84,8 @@ int TestSynchTimerQueue(int argc, char* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!CreateTimerQueueTimer(&hTimers[index], hTimerQueue, (WAITORTIMERCALLBACK)TimerRoutine,
|
||||
&apcData[index], apcData[index].DueTime, apcData[index].Period,
|
||||
0))
|
||||
if (!CreateTimerQueueTimer(&hTimers[index], hTimerQueue, TimerRoutine, &apcData[index],
|
||||
apcData[index].DueTime, apcData[index].Period, 0))
|
||||
{
|
||||
printf("CreateTimerQueueTimer failed (%" PRIu32 ")\n", GetLastError());
|
||||
return -1;
|
||||
|
@ -90,7 +94,7 @@ int TestSynchTimerQueue(int argc, char* argv[])
|
|||
|
||||
for (index = 0; index < TIMER_COUNT; index++)
|
||||
{
|
||||
if (WaitForSingleObject(apcData[index].CompletionEvent, 20000) != WAIT_OBJECT_0)
|
||||
if (WaitForSingleObject(apcData[index].CompletionEvent, 2000) != WAIT_OBJECT_0)
|
||||
{
|
||||
printf("Failed to wait for timer queue timer #%" PRIu32 " (%" PRIu32 ")\n", index,
|
||||
GetLastError());
|
||||
|
|
|
@ -19,7 +19,7 @@ int TestSynchWaitableTimer(int argc, char* argv[])
|
|||
goto out;
|
||||
}
|
||||
|
||||
due.QuadPart = -15000000LL; /* 1.5 seconds */
|
||||
due.QuadPart = -1500000LL; /* 0.15 seconds */
|
||||
|
||||
if (!SetWaitableTimer(timer, &due, 0, NULL, NULL, 0))
|
||||
{
|
||||
|
@ -36,18 +36,18 @@ int TestSynchWaitableTimer(int argc, char* argv[])
|
|||
}
|
||||
|
||||
printf("Timer Signaled\n");
|
||||
status = WaitForSingleObject(timer, 2000);
|
||||
status = WaitForSingleObject(timer, 200);
|
||||
|
||||
if (status != WAIT_TIMEOUT)
|
||||
{
|
||||
printf("WaitForSingleObject(timer, 2000) failure: Actual: 0x%08" PRIX32
|
||||
printf("WaitForSingleObject(timer, 200) failure: Actual: 0x%08" PRIX32
|
||||
", Expected: 0x%08X\n",
|
||||
status, WAIT_TIMEOUT);
|
||||
goto out;
|
||||
}
|
||||
|
||||
due.QuadPart = 0;
|
||||
period = 1200; /* 1.2 seconds */
|
||||
period = 120; /* 0.12 seconds */
|
||||
|
||||
if (!SetWaitableTimer(timer, &due, period, NULL, NULL, 0))
|
||||
{
|
||||
|
|
|
@ -54,15 +54,15 @@ int TestSynchWaitableTimerAPC(int argc, char* argv[])
|
|||
if (!hTimer)
|
||||
goto cleanup;
|
||||
|
||||
due.QuadPart = -1000 * 1000LL; /* 1 seconds */
|
||||
due.QuadPart = -1000 * 100LL; /* 0.1 seconds */
|
||||
apcData.StartTime = GetTickCount();
|
||||
bSuccess = SetWaitableTimer(hTimer, &due, 100, TimerAPCProc, &apcData, FALSE);
|
||||
bSuccess = SetWaitableTimer(hTimer, &due, 10, TimerAPCProc, &apcData, FALSE);
|
||||
|
||||
if (!bSuccess)
|
||||
goto cleanup;
|
||||
|
||||
/* nothing shall happen after 1.2 second, because thread is not in alertable state */
|
||||
rc = WaitForSingleObject(g_Event, 1200);
|
||||
/* nothing shall happen after 0.12 second, because thread is not in alertable state */
|
||||
rc = WaitForSingleObject(g_Event, 120);
|
||||
if (rc != WAIT_TIMEOUT)
|
||||
goto cleanup;
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
static DWORD WINAPI thread_func(LPVOID arg)
|
||||
{
|
||||
WINPR_UNUSED(arg);
|
||||
|
||||
/* exists of the thread the quickest as possible */
|
||||
ExitThread(0);
|
||||
return 0;
|
||||
|
@ -17,9 +19,12 @@ int TestThreadExitThread(int argc, char* argv[])
|
|||
DWORD waitResult;
|
||||
int i;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
/* FIXME: create some noise to better guaranty the test validity and
|
||||
* decrease the number of loops */
|
||||
for (i = 0; i < 50000; i++)
|
||||
for (i = 0; i < 5000; i++)
|
||||
{
|
||||
thread = CreateThread(NULL, 0, thread_func, NULL, 0, NULL);
|
||||
|
||||
|
@ -29,7 +34,7 @@ int TestThreadExitThread(int argc, char* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
waitResult = WaitForSingleObject(thread, 1000);
|
||||
waitResult = WaitForSingleObject(thread, 100);
|
||||
if (waitResult != WAIT_OBJECT_0)
|
||||
{
|
||||
/* When the thread exits before the internal thread_list
|
||||
|
|
Loading…
Reference in New Issue