diff --git a/test/zdtm/live/static/shm.c b/test/zdtm/live/static/shm.c index b29da4a0a..003474a38 100644 --- a/test/zdtm/live/static/shm.c +++ b/test/zdtm/live/static/shm.c @@ -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);