[PATCH v2 1/6] ws2_32/tests: Add tests for setting and getting socket options with shorter length.

Zebediah Figura zfigura at codeweavers.com
Fri Mar 4 12:09:14 CST 2022



On 3/4/22 12:04, Paul Gofman wrote:
> On 3/4/22 20:36, Zebediah Figura wrote:
>>
>>> +
>>> +    /* Test option short length. */
>>> +    for (i = 0; i < ARRAY_SIZE(test_optsize); ++i)
>>> +    {
>>> +        s2 = socket( test_optsize[i].af, test_optsize[i].type, 0 );
>>> +        ok(s2 != INVALID_SOCKET, "socket() failed error %d\n", 
>>> WSAGetLastError());
>>> +        for (j = 0; j < 3; ++j)
>>
>> ARRAY_SIZE(test_optsize[i].sizes)?
>>
>> The way this test is structured does not make it very easy to read, 
>> but I'm struggling to find a better option. The individual sockopts 
>> seem very idiosyncratic...
> 
> Yes, those behaviour details don't seem to fit any obvious pattern. 
> Maybe I can make it a bit easier if always code the values returned from 
> getsockopt() instead of setting the "default" cases in the code?
> 

Possibly, yeah, although of course that makes it more annoying to write...

> 
>>
>> Finding a way to include TCP_NODELAY in this table, as well as finding 
>> a way to test lengths less than 1 and greater than 4, would probably 
>> be helpful. I don't know if you have those in your pending patches.
> 
> I am introducing TCP_NODELAY in the same table later, yeah. The reason 
> that it is not here immediately is that TCP_NODELAY needs output length 
> fixup in getsockopt() not to introduce obsucre todo_wine and the remove 
> it, thus a separate patch.
> 
> I tested greater sizes separately for some options, I will add some 
> tests (hopefully they are all work the same as size 4, at least those 
> that I tried did). Didn't try length < 0 but I will.

Sounds great, thanks!



More information about the wine-devel mailing list