<div dir="ltr">This test checks for cases not supported by current anon shmem implementation. New fixed implementation should pass them.<div>We don't want to forget about this failed cases. So we need to commit this test and even add to CI.</div><div>So the developer of new anon shmem changes tracking won't forget about this case.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-10-12 11:03 GMT+03:00 Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@virtuozzo.com" target="_blank">xemul@virtuozzo.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 10/12/2016 02:00 AM, Andrei Vagin wrote:<br>
> Pavel, could you commit this patch?<br>
<br>
</span>But this new test fails as I see from the commit message. Also, we've<br>
disabled the shmem pre-dump, so what's the point?<br>
<div><div class="h5"><br>
> On Fri, Sep 16, 2016 at 03:31:28PM +0300, Andrei Vagin wrote:<br>
>> From: Andrei Vagin <<a href="mailto:avagin@virtuozzo.com">avagin@virtuozzo.com</a>><br>
>><br>
>> [root@fc24 criu]# python test/zdtm.py run -t zdtm/transition/shmem --pre 3<br>
>> === Run 1/1 ================<br>
>><br>
>> ======================== Run zdtm/transition/shmem in h ========================<br>
>> cc -g -O2 -Wall -Werror -fno-strict-aliasing -iquote ../lib/arch/x86/include -I../lib shmem.c ../lib/libzdtmtst.a ../lib/libzdtmtst.a -o shmem<br>
>> Start test<br>
>> ./shmem --pidfile=shmem.pid --outfile=shmem.out<br>
>> Run criu pre-dump<br>
>> Run criu pre-dump<br>
>> Run criu pre-dump<br>
>> Run criu dump<br>
>> Run criu restore<br>
>> Send the 15 signal to 33<br>
>> Wait for zdtm/transition/shmem(33) to die for 0.100000<br>
>> Test output: ==============================<wbr>==<br>
>> 15:12:25.444: 33: FAIL: shmem.c:70: checksum mismatch: ea71000 109c9000<br>
>><br>
>> Cc: Eugene Batalov <<a href="mailto:eabatalov89@gmail.com">eabatalov89@gmail.com</a>><br>
>> Signed-off-by: Andrei Vagin <<a href="mailto:avagin@virtuozzo.com">avagin@virtuozzo.com</a>><br>
>> ---<br>
>> test/zdtm/transition/Makefile | 1 +<br>
>> test/zdtm/transition/shmem.c | 82 ++++++++++++++++++++++++++++++<wbr>+++++++++++++<br>
>> 2 files changed, 83 insertions(+)<br>
>> create mode 100644 test/zdtm/transition/shmem.c<br>
>><br>
>> diff --git a/test/zdtm/transition/<wbr>Makefile b/test/zdtm/transition/<wbr>Makefile<br>
>> index f3797ad..7ddb238 100644<br>
>> --- a/test/zdtm/transition/<wbr>Makefile<br>
>> +++ b/test/zdtm/transition/<wbr>Makefile<br>
>> @@ -23,6 +23,7 @@ TST_NOFILE = \<br>
>> file_aio \<br>
>> socket-tcp \<br>
>> socket-tcp6 \<br>
>> + shmem \<br>
>><br>
>><br>
>> TST_FILE = \<br>
>> diff --git a/test/zdtm/transition/shmem.c b/test/zdtm/transition/shmem.c<br>
>> new file mode 100644<br>
>> index 0000000..f6b093c<br>
>> --- /dev/null<br>
>> +++ b/test/zdtm/transition/shmem.c<br>
>> @@ -0,0 +1,82 @@<br>
>> +#define _GNU_SOURCE<br>
>> +#include <errno.h><br>
>> +#include <stdlib.h><br>
>> +#include <string.h><br>
>> +#include <sys/mman.h><br>
>> +#include <signal.h><br>
>> +#include <sys/wait.h><br>
>> +<br>
>> +#include "zdtmtst.h"<br>
>> +<br>
>> +const char *test_author = "Andrei Vagin <<a href="mailto:avagin@virtuozzo.com">avagin@virtuozzo.com</a>>";<br>
>> +<br>
>> +#define MEM_SIZE (1<<25)<br>
>> +<br>
>> +int main(int argc, char **argv)<br>
>> +{<br>
>> + pid_t pid;<br>
>> + void *addr;<br>
>> + int *sum, status;<br>
>> + long size;<br>
>> +<br>
>> + test_init(argc, argv);<br>
>> +<br>
>> + sum = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);<br>
>> + if (sum == MAP_FAILED)<br>
>> + return 1;<br>
>> + addr = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);<br>
>> + if (addr == MAP_FAILED)<br>
>> + return 1;<br>
>> +<br>
>> + pid = fork();<br>
>> + if (pid < 0)<br>
>> + return 1;<br>
>> +<br>
>> + if (pid == 0) {<br>
>> + int i = 0;<br>
>> + long size = PAGE_SIZE, old_size = MEM_SIZE;<br>
>> +<br>
>> + status = 0;<br>
>> + while (test_go()) {<br>
>> + addr = mremap(addr, old_size, size, MREMAP_MAYMOVE);<br>
>> +<br>
>> + status -= *((int *)(addr + size - PAGE_SIZE));<br>
>> +<br>
>> + *((int *)(addr + size - PAGE_SIZE)) = i++;<br>
>> +<br>
>> + status += *((int *)(addr + size - PAGE_SIZE));<br>
>> +<br>
>> + old_size = size;<br>
>> + size += PAGE_SIZE;<br>
>> + if (size > MEM_SIZE)<br>
>> + size = PAGE_SIZE;<br>
>> + }<br>
>> + *sum = status;<br>
>> + return 0;<br>
>> + }<br>
>> +<br>
>> + test_daemon();<br>
>> + test_waitsig();<br>
>> +<br>
>> + kill(pid, SIGTERM);<br>
>> + status = -1;<br>
>> + waitpid(pid, &status, 0);<br>
>> + if (status) {<br>
>> + pr_perror("The child return non-zero code: %d\n", status);<br>
>> + return 1;<br>
>> + }<br>
>> +<br>
>> + status = 0;<br>
>> + for (size = PAGE_SIZE; size <= MEM_SIZE; size += PAGE_SIZE) {<br>
>> + status += *((int *)(addr + size - PAGE_SIZE));<br>
>> + }<br>
>> +<br>
>> + if (status != *sum) {<br>
>> + fail("checksum mismatch: %x %x\n", status, *sum);<br>
>> + return 1;<br>
>> + }<br>
>> +<br>
>> + pass();<br>
>> +<br>
>> + return 0;<br>
>> +}<br>
>> --<br>
>> 2.7.4<br>
>><br>
</div></div>> .<br>
><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Best regards,<br>Eugene Batalov.</div>
</div>