[CRIU] [PATCH]v2 zdtm: test semi-closed unix stream connection for data loss
Ruslan Kuprieiev
kupruser at gmail.com
Tue Aug 27 04:21:09 EDT 2013
On 08/27/2013 08:28 AM, Andrew Vagin wrote:
> On Tue, Aug 27, 2013 at 01:38:42AM +0400, Ruslan Kuprieiev wrote:
>> On 08/27/2013 01:07 AM, Andrew Vagin wrote:
>>> On Mon, Aug 26, 2013 at 09:27:27PM +0400, Ruslan Kuprieiev wrote:
>>>> Hi!
>>>>
>>>> Added test for data loss in semi-closed stream unix connection.
>>> Why do you decide to add a new test? In a previous attempt you tryed to
>>> expand the socket02 test and I think it was the right way.
>>> You replaced one check on another and I suggested to add one more check
>>> and do nothing with the previous one.
>>>
>> It was impulsive decision=).
>> Here is one more try.
>> If this patch is ok, please, tell me if i should send it again with
>> [PATCH]v3 tag.
>> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
>>
>> diff --git a/test/zdtm/live/static/sockets02.c b/test/zdtm/live/static/sockets02.c
>> index 8ff38f8..3e6829d 100644
>> --- a/test/zdtm/live/static/sockets02.c
>> +++ b/test/zdtm/live/static/sockets02.c
>> @@ -12,6 +12,7 @@
>> #include <sys/stat.h>
>> #include <limits.h>
>> #include <fcntl.h>
>> +#include <time.h>
>>
>> #include "zdtmtst.h"
>>
>> @@ -21,7 +22,10 @@ const char *test_author = "Pavel Emelyanov <xemul at parallels.com>\n";
>> int main(int argc, char *argv[])
>> {
>> int ssk_pair[2], ret;
>> - char aux;
>> + char aux, data;
>> +
>> + srandom(time(NULL));
>> + data = (char)random();
>>
>> test_init(argc, argv);
>>
>> @@ -30,6 +34,12 @@ int main(int argc, char *argv[])
>> exit(1);
>> }
>>
>> + ret = write(ssk_pair[1], &data, sizeof(data));
>> + if (ret != sizeof(data)) {
>> + fail("write\n");
>> + exit(1);
>> + }
>> +
>> close(ssk_pair[1]);
>>
>> test_daemon();
>> @@ -37,9 +47,12 @@ int main(int argc, char *argv[])
>>
> We need to check data and the state of socket. I think we can add a
> separate check for data.
I'm quite confused=). Do you want me to create new socket pair and test
data loss on it, or you want me to add receiving data and checking it
before if(ret != 0 || errno !=0) ?
More information about the CRIU
mailing list