Commit d7865bee authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

test: shm -- Make sure SysV memory restored properly

In criu we carry SysV memory via @VMA_AREA_SYSVIPC
attribute but to the test must have a live reference
to real memory area to check that shmem address was
restored correctly. Add it.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c2cae358
......@@ -107,6 +107,9 @@ static int test_fn(int argc, char **argv)
int fail_count = 0;
int ret = -1;
void *mem;
uint32_t crc = INIT_CRC;
key = ftok(argv[0], 822155666);
if (key == -1) {
err("Can't make key");
......@@ -119,6 +122,12 @@ static int test_fn(int argc, char **argv)
goto out;
}
mem = shmat(shm, NULL, 0);
if (mem == (void *)-1) {
err("Can't shmat");
goto out;
}
test_daemon();
test_waitsig();
......@@ -136,6 +145,16 @@ static int test_fn(int argc, char **argv)
goto out_shm;
}
if (datachk(mem, shmem_size, &crc)) {
fail("shmem data is corrupted");
return -1;
}
if (shmdt(mem) < 0) {
err("Can't detach shm");
return -1;
}
ret = shmctl(shm, IPC_RMID, NULL);
if (ret < 0) {
fail("Failed (1) to destroy segment: %d\n", -errno);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment