Commit 7a74043c authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: Add mmap03 test case

To be able to test it one need indeed enough
physical memory on the node (at least 16G).
Thus I don't include this test for regular
passes.

Inspired by commit 40dcaf88Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e8ca542c
...@@ -60,6 +60,7 @@ TST_NOFILE = \ ...@@ -60,6 +60,7 @@ TST_NOFILE = \
sem \ sem \
maps01 \ maps01 \
maps02 \ maps02 \
maps03 \
xids00 \ xids00 \
groups \ groups \
file_fown \ file_fown \
......
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include "zdtmtst.h"
const char *test_doc = "Test for huge VMA area";
const char *test_author = "Cyrill Gorcunov <gorcunov@openvz.org>";
int main(int argc, char **argv)
{
test_init(argc, argv);
unsigned char *mem;
test_msg("Alloc huge VMA\n");
mem = (void *)mmap(NULL, (10 << 30), PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if ((void *)mem == MAP_FAILED) {
err("mmap failed: %m");
return -1;
}
mem[4 << 30] = 1;
mem[8 << 30] = 2;
test_daemon();
test_waitsig();
test_msg("Testing restored data\n");
if (mem[4 << 30] != 1 || mem[8 << 30] != 2) {
fail("Data corrupted!\n");
exit(1);
}
pass();
return 0;
}
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