Commit 30deb6b8 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

kernel32/tests: Test Fiber Local Storage functions.

parent e0475a3e
...@@ -28,6 +28,10 @@ static void (WINAPI *pDeleteFiber)(LPVOID); ...@@ -28,6 +28,10 @@ static void (WINAPI *pDeleteFiber)(LPVOID);
static LPVOID (WINAPI *pConvertThreadToFiberEx)(LPVOID,DWORD); static LPVOID (WINAPI *pConvertThreadToFiberEx)(LPVOID,DWORD);
static LPVOID (WINAPI *pCreateFiberEx)(SIZE_T,SIZE_T,DWORD,LPFIBER_START_ROUTINE,LPVOID); static LPVOID (WINAPI *pCreateFiberEx)(SIZE_T,SIZE_T,DWORD,LPFIBER_START_ROUTINE,LPVOID);
static BOOL (WINAPI *pIsThreadAFiber)(void); static BOOL (WINAPI *pIsThreadAFiber)(void);
static DWORD (WINAPI *pFlsAlloc)(PFLS_CALLBACK_FUNCTION);
static BOOL (WINAPI *pFlsFree)(DWORD);
static PVOID (WINAPI *pFlsGetValue)(DWORD);
static BOOL (WINAPI *pFlsSetValue)(DWORD,PVOID);
static LPVOID fibers[2]; static LPVOID fibers[2];
static BYTE testparam = 185; static BYTE testparam = 185;
...@@ -45,9 +49,18 @@ static VOID init_funcs(void) ...@@ -45,9 +49,18 @@ static VOID init_funcs(void)
X(ConvertThreadToFiberEx); X(ConvertThreadToFiberEx);
X(CreateFiberEx); X(CreateFiberEx);
X(IsThreadAFiber); X(IsThreadAFiber);
X(FlsAlloc);
X(FlsFree);
X(FlsGetValue);
X(FlsSetValue);
#undef X #undef X
} }
static VOID WINAPI FiberLocalStorageProc(PVOID lpFlsData)
{
ok(lpFlsData == (PVOID) 1587, "FlsData expected not to be changed\n");
}
static VOID WINAPI FiberMainProc(LPVOID lpFiberParameter) static VOID WINAPI FiberMainProc(LPVOID lpFiberParameter)
{ {
BYTE *tparam = (BYTE *)lpFiberParameter; BYTE *tparam = (BYTE *)lpFiberParameter;
...@@ -136,6 +149,29 @@ static void test_FiberHandling(void) ...@@ -136,6 +149,29 @@ static void test_FiberHandling(void)
ok(!pIsThreadAFiber(), "IsThreadAFiber reported TRUE\n"); ok(!pIsThreadAFiber(), "IsThreadAFiber reported TRUE\n");
} }
static void test_FiberLocalStorage(PFLS_CALLBACK_FUNCTION cbfunc)
{
DWORD fls;
BOOL ret;
PVOID val = (PVOID) 1587;
if (!pFlsAlloc)
{
win_skip( "Fiber Local Storage not supported\n" );
return;
}
fls = pFlsAlloc(cbfunc);
ok(fls != FLS_OUT_OF_INDEXES, "FlsAlloc failed with error %d\n", GetLastError());
ret = pFlsSetValue(fls, val);
ok(ret, "FlsSetValue failed\n");
ok(val == pFlsGetValue(fls), "FlsGetValue failed\n");
ret = pFlsFree(fls);
ok(ret, "FlsFree failed\n");
}
START_TEST(fiber) START_TEST(fiber)
{ {
init_funcs(); init_funcs();
...@@ -147,4 +183,6 @@ START_TEST(fiber) ...@@ -147,4 +183,6 @@ START_TEST(fiber)
} }
test_FiberHandling(); test_FiberHandling();
test_FiberLocalStorage(NULL);
test_FiberLocalStorage(FiberLocalStorageProc);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment