diff options
author | Jason Evans <je@fb.com> | 2014-01-29 01:22:06 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2014-01-29 01:25:09 (GMT) |
commit | 2b51a3e9e9bfebf081d25dfa92f3cd89e4a8ed73 (patch) | |
tree | a73cec177b1a2807e9b9fc1c86e1dbde4174b8bf /test | |
parent | 9c8baec0a310f7bbd00c7dc76cfbf663dd9c14ce (diff) | |
download | jemalloc-2b51a3e9e9bfebf081d25dfa92f3cd89e4a8ed73.zip jemalloc-2b51a3e9e9bfebf081d25dfa92f3cd89e4a8ed73.tar.gz jemalloc-2b51a3e9e9bfebf081d25dfa92f3cd89e4a8ed73.tar.bz2 |
Fix mallctl argument size mismatches (size_t vs. uint64_t).
Reported by İsmail Dönmez.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/stats.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/test/unit/stats.c b/test/unit/stats.c index 6cd9773..03a55c7 100644 --- a/test/unit/stats.c +++ b/test/unit/stats.c @@ -31,21 +31,25 @@ TEST_END TEST_BEGIN(test_stats_chunks) { - size_t current, total, high; - size_t sz = sizeof(size_t); + size_t current, high; + uint64_t total; + size_t sz; int expected = config_stats ? 0 : ENOENT; + sz = sizeof(size_t); assert_d_eq(mallctl("stats.chunks.current", ¤t, &sz, NULL, 0), expected, "Unexpected mallctl() result"); + sz = sizeof(uint64_t); assert_d_eq(mallctl("stats.chunks.total", &total, &sz, NULL, 0), expected, "Unexpected mallctl() result"); + sz = sizeof(size_t); assert_d_eq(mallctl("stats.chunks.high", &high, &sz, NULL, 0), expected, "Unexpected mallctl() result"); if (config_stats) { assert_zu_le(current, high, "current should be no larger than high"); - assert_zu_le(high, total, + assert_u64_le((uint64_t)high, total, "high should be no larger than total"); } } @@ -247,9 +251,9 @@ TEST_BEGIN(test_stats_arenas_bins) { unsigned arena; void *p; - size_t sz, allocated; + size_t sz, allocated, curruns; uint64_t epoch, nmalloc, ndalloc, nrequests, nfills, nflushes; - uint64_t nruns, nreruns, curruns; + uint64_t nruns, nreruns; int expected = config_stats ? 0 : ENOENT; arena = 0; @@ -287,6 +291,7 @@ TEST_BEGIN(test_stats_arenas_bins) NULL, 0), expected, "Unexpected mallctl() result"); assert_d_eq(mallctl("stats.arenas.0.bins.0.nreruns", &nreruns, &sz, NULL, 0), expected, "Unexpected mallctl() result"); + sz = sizeof(size_t); assert_d_eq(mallctl("stats.arenas.0.bins.0.curruns", &curruns, &sz, NULL, 0), expected, "Unexpected mallctl() result"); @@ -307,7 +312,7 @@ TEST_BEGIN(test_stats_arenas_bins) } assert_u64_gt(nruns, 0, "At least one run should have been allocated"); - assert_u64_gt(curruns, 0, + assert_zu_gt(curruns, 0, "At least one run should be currently allocated"); } @@ -319,8 +324,8 @@ TEST_BEGIN(test_stats_arenas_lruns) { unsigned arena; void *p; - uint64_t epoch, nmalloc, ndalloc, nrequests, curruns; - size_t sz = sizeof(uint64_t); + uint64_t epoch, nmalloc, ndalloc, nrequests; + size_t curruns, sz; int expected = config_stats ? 0 : ENOENT; arena = 0; @@ -333,12 +338,14 @@ TEST_BEGIN(test_stats_arenas_lruns) assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0, "Unexpected mallctl() failure"); + sz = sizeof(uint64_t); assert_d_eq(mallctl("stats.arenas.0.lruns.0.nmalloc", &nmalloc, &sz, NULL, 0), expected, "Unexpected mallctl() result"); assert_d_eq(mallctl("stats.arenas.0.lruns.0.ndalloc", &ndalloc, &sz, NULL, 0), expected, "Unexpected mallctl() result"); assert_d_eq(mallctl("stats.arenas.0.lruns.0.nrequests", &nrequests, &sz, NULL, 0), expected, "Unexpected mallctl() result"); + sz = sizeof(size_t); assert_d_eq(mallctl("stats.arenas.0.lruns.0.curruns", &curruns, &sz, NULL, 0), expected, "Unexpected mallctl() result"); |