From 39ea30e3a36726e8503812a98a029424709085a6 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Fri, 25 Jul 2014 12:23:00 +0200 Subject: [PATCH] [mc] Expand unit test of mc_snapshot.c --- src/mc/mc_snapshot.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mc/mc_snapshot.c b/src/mc/mc_snapshot.c index 2836e4e91d..dfe0a822de 100644 --- a/src/mc/mc_snapshot.c +++ b/src/mc/mc_snapshot.c @@ -182,7 +182,7 @@ static void test_snapshot(bool sparse_checkpoint) { mc_model_checker = xbt_new0(s_mc_model_checker_t, 1); mc_model_checker->pages = mc_pages_store_new(); - for(int n=1; n!=10; ++n) { + for(int n=1; n!=256; ++n) { // Store region page(s): size_t byte_size = n * xbt_pagesize; @@ -219,7 +219,7 @@ static void test_snapshot(bool sparse_checkpoint) { xbt_test_assert(mc_snapshot_region_memcmp(source, region0, source, region, byte_size), "Unexpected match in mc_snapshot_region_memcmp() with previous snapshot"); - xbt_test_add("Compare parts of region data for %i page(s)", n); + xbt_test_add("Compare parts of region data for %i page(s) with current value", n); for(int j=0; j!=100; ++j) { size_t offset = rand() % byte_size; size_t size = rand() % (byte_size - offset); @@ -227,6 +227,14 @@ static void test_snapshot(bool sparse_checkpoint) { "Mismatch in mc_snapshot_region_memcmp()"); } + xbt_test_add("Compare parts of region data for %i page(s) with itself", n); + for(int j=0; j!=100; ++j) { + size_t offset = rand() % byte_size; + size_t size = rand() % (byte_size - offset); + xbt_test_assert(!mc_snapshot_region_memcmp((char*) source+offset, region, (char*) source+offset, region, size), + "Mismatch in mc_snapshot_region_memcmp()"); + } + if (n==1) { xbt_test_add("Read pointer for %i page(s)", n); memcpy(source, &mc_model_checker, sizeof(void*)); -- 2.20.1