ntdll/tests: Add tests for job objects.

Alexandre Julliard julliard at winehq.org
Thu Sep 5 09:02:52 CDT 2013


Andrew Cook <ariscop at gmail.com> writes:

> diff --git a/dlls/ntdll/tests/Makefile.in b/dlls/ntdll/tests/Makefile.in
> index 10d6674..1903d10 100644
> --- a/dlls/ntdll/tests/Makefile.in
> +++ b/dlls/ntdll/tests/Makefile.in
> @@ -11,6 +11,7 @@ C_SRCS = \
>  	file.c \
>  	generated.c \
>  	info.c \
> +	job.c \

Please put this in an existing file, like om.c

> +static DWORD getProcess(PHANDLE handle) {
> +    STARTUPINFO startup = {};
> +    PROCESS_INFORMATION info = {};
> +
> +    if(!CreateProcessA(NULL, GetCommandLine(), NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info)) {
> +        ok(FALSE, "CreateProcess: %x\n", GetLastError());
> +        return 0;
> +    }
> +
> +    CloseHandle(info.hThread);
> +    *handle = info.hProcess;
> +
> +    return info.dwProcessId;
> +}

You should use the existing winetest support for creating child
processes.

> +    ok(TerminateProcess(hprocess[0], 1), "TerminateProcess: %x\n", GetLastError());
> +    Sleep(1000);
> +    ok(TerminateProcess(hprocess[1], 2), "TerminateProcess: %x\n", GetLastError());
> +    Sleep(1000);

Don't add sleeps when not necessary.

> +static void is_zombie(void)
> +{
> +    WCHAR val[32] = {0};
> +    static const WCHAR envName[] = { 'T','E','S','T',0 };
> +    static const WCHAR envVal[] = { 'J','o','b','O','b','j','e','c','t',0 };
> +
> +    GetEnvironmentVariableW(envName, val, 32);
> +
> +    if(lstrcmpW(envVal, val) == 0)
> +        /* Wait forever, we've been created for a process handle */
> +        while(1) Sleep(INFINITE);
> +
> +    SetEnvironmentVariableW(envName, envVal);
> +}

That's ugly. Again, check how child processes are handled in
other tests.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list