tests: multisocketsink: fix flaky unit test
authorTim-Philipp Müller <tim@centricular.com>
Sun, 5 Apr 2015 11:30:39 +0000 (12:30 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sun, 5 Apr 2015 11:59:11 +0000 (12:59 +0100)
commit46aa47440fc3d278ff4daf094b9aeb361ceab298
treeb1745b21f5e1fdaf396979e742b9d63daaffa34a
parent6db2ee56b6e862f54c479e553f179daf2056da74
tests: multisocketsink: fix flaky unit test

On slower systems, or under high system load (e.g. check-valgrind),
the sending_buffers_with_9_gstmemories test would sometimes fail,
because the read call only returns 32 bytes instead of the full
36 bytes expected. This is because multisocketsink might end up
doing a partial write of 32 bytes first, and then write the
missing 4 bytes later, but since we don't wait for all of data
to be written, there's a short window where our read call in the
unit test might then only receive the 32 bytes written so far,
which makes it deeply unhappy.

Instead, make sure we loop to read all bytes.
tests/check/elements/multisocketsink.c