• Vladimir Davydov's avatar
    zdtm/pty02: never close master before reading slave · 888cae43
    Vladimir Davydov authored
    We may close the master before reading the slave if the child runs first
    when the parent wakes it up using task_waiter_complete. In this case the
    subsequent read from the slave will return 0 resulting in a false
    positive test failure:
    
    13:23:42.194: 30914: ERR: pty02.c:89: read(slave) failed (errno = 11 (Resource temporarily unavailable))
    
    Fix this by waking the child, which closes the master, only after the
    read has been completed.
    
    Also note errno = EAGAIN in the failure report above, which looks really
    confusing. Let's print the actual number of bytes read/written along
    with the errno while reporting a read/write failure to make the error
    reporting clearer in this test.
    Signed-off-by: 's avatarVladimir Davydov <vdavydov@parallels.com>
    Cc: Cyrill Gorcunov <gorcunov@parallels.com>
    Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
    Acked-by: 's avatarCyrill Gorcunov <gorcunov@parallels.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    888cae43
pty02.c 1.86 KB