summaryrefslogtreecommitdiffstats
path: root/test/unit/stats.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2014-01-21 22:20:29 (GMT)
committerJason Evans <jasone@canonware.com>2014-01-21 22:20:29 (GMT)
commit7d8fea987182fe2ee17eb5c1c6f3ae620f82beb0 (patch)
tree4972fa0aed2bf0df0bade25b060d2e0bf6038859 /test/unit/stats.c
parent264dfd35d05fd7304cd3f023aa7497cf4efc0b32 (diff)
downloadjemalloc-7d8fea987182fe2ee17eb5c1c6f3ae620f82beb0.zip
jemalloc-7d8fea987182fe2ee17eb5c1c6f3ae620f82beb0.tar.gz
jemalloc-7d8fea987182fe2ee17eb5c1c6f3ae620f82beb0.tar.bz2
Avoid lazy-lock in a tcache-dependent test.
Diffstat (limited to 'test/unit/stats.c')
-rw-r--r--test/unit/stats.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/test/unit/stats.c b/test/unit/stats.c
index 6ebe369..6cd9773 100644
--- a/test/unit/stats.c
+++ b/test/unit/stats.c
@@ -123,7 +123,8 @@ TEST_BEGIN(test_stats_arenas_summary)
expected, "Unexepected mallctl() result");
if (config_stats) {
- assert_u64_gt(npurge, 0, "At least one purge occurred");
+ assert_u64_gt(npurge, 0,
+ "At least one purge should have occurred");
assert_u64_le(nmadvise, purged,
"nmadvise should be no greater than purged");
}
@@ -133,6 +134,22 @@ TEST_BEGIN(test_stats_arenas_summary)
}
TEST_END
+void *
+thd_start(void *arg)
+{
+
+ return (NULL);
+}
+
+static void
+no_lazy_lock(void)
+{
+ thd_t thd;
+
+ thd_create(&thd, thd_start, NULL);
+ thd_join(thd, NULL);
+}
+
TEST_BEGIN(test_stats_arenas_small)
{
unsigned arena;
@@ -141,6 +158,8 @@ TEST_BEGIN(test_stats_arenas_small)
uint64_t epoch, nmalloc, ndalloc, nrequests;
int expected = config_stats ? 0 : ENOENT;
+ no_lazy_lock(); /* Lazy locking would dodge tcache testing. */
+
arena = 0;
assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
0, "Unexpected mallctl() failure");
@@ -211,13 +230,13 @@ TEST_BEGIN(test_stats_arenas_large)
if (config_stats) {
assert_zu_gt(allocated, 0,
- "allocated should be greated than zero");
+ "allocated should be greater than zero");
assert_zu_gt(nmalloc, 0,
- "nmalloc should be no greater than zero");
+ "nmalloc should be greater than zero");
assert_zu_ge(nmalloc, ndalloc,
"nmalloc should be at least as large as ndalloc");
assert_zu_gt(nrequests, 0,
- "nrequests should be no greater than zero");
+ "nrequests should be greater than zero");
}
dallocx(p, 0);
@@ -273,22 +292,23 @@ TEST_BEGIN(test_stats_arenas_bins)
if (config_stats) {
assert_zu_gt(allocated, 0,
- "allocated should be greated than zero");
+ "allocated should be greater than zero");
assert_u64_gt(nmalloc, 0,
- "nmalloc should be no greater than zero");
+ "nmalloc should be greater than zero");
assert_u64_ge(nmalloc, ndalloc,
"nmalloc should be at least as large as ndalloc");
assert_u64_gt(nrequests, 0,
- "nrequests should be no greater than zero");
+ "nrequests should be greater than zero");
if (config_tcache) {
assert_u64_gt(nfills, 0,
- "At least one fill has occurred");
+ "At least one fill should have occurred");
assert_u64_gt(nflushes, 0,
- "At least one flush has occurred");
+ "At least one flush should have occurred");
}
- assert_u64_gt(nruns, 0, "At least one run has been allocated");
+ assert_u64_gt(nruns, 0,
+ "At least one run should have been allocated");
assert_u64_gt(curruns, 0,
- "At least one run is currently allocated");
+ "At least one run should be currently allocated");
}
dallocx(p, 0);
@@ -324,13 +344,13 @@ TEST_BEGIN(test_stats_arenas_lruns)
if (config_stats) {
assert_u64_gt(nmalloc, 0,
- "nmalloc should be no greater than zero");
+ "nmalloc should be greater than zero");
assert_u64_ge(nmalloc, ndalloc,
"nmalloc should be at least as large as ndalloc");
assert_u64_gt(nrequests, 0,
- "nrequests should be no greater than zero");
+ "nrequests should be greater than zero");
assert_u64_gt(curruns, 0,
- "At least one run is currently allocated");
+ "At least one run should be currently allocated");
}
dallocx(p, 0);