[PATCH v2] kernel32/tests: Detect and handle a redirected stdin.

Alex Henrie alexhenrie24 at gmail.com
Fri Nov 3 11:28:34 CDT 2017


2017-11-03 15:31 GMT+01:00 Zebediah Figura <z.figura12 at gmail.com>:
> On 11/03/2017 05:43 AM, Alex Henrie wrote:
>>
>> Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
>> ---
>> v2: Simply skip the tests if the input is redirected.
>> ---
>>   dlls/kernel32/tests/console.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c
>> index a14bc45034..926c052686 100644
>> --- a/dlls/kernel32/tests/console.c
>> +++ b/dlls/kernel32/tests/console.c
>> @@ -2582,6 +2582,11 @@ static void test_ReadConsole(void)
>>         SetLastError(0xdeadbeef);
>>       ret = GetFileSize(std_input, NULL);
>> +    if (GetLastError() == 0xdeadbeef)
>> +    {
>> +        skip("stdin is redirected\n");
>> +        return;
>> +    }
>>       ok(ret == INVALID_FILE_SIZE, "expected INVALID_FILE_SIZE, got
>> %#x\n", ret);
>>       ok(GetLastError() == ERROR_INVALID_HANDLE ||
>>          GetLastError() == ERROR_INVALID_FUNCTION, /* Win 8, 10 */
>>
>
> Couldn't we just skip those two tests? The others don't seem to fail under
> that circumstance.

stdin could be connected to an invalid handle, in which case the other
tests would fail. The fact that those tests generally succeed with
redirected input is not something I think we should count on.

-Alex



More information about the wine-devel mailing list