aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar maxwell-demon <hongyu@instance-1.c.zinc-involution-796.internal>2015-01-22 23:20:48 +0000
committerGravatar maxwell-demon <hongyu@instance-1.c.zinc-involution-796.internal>2015-01-22 23:20:48 +0000
commit164ac96024bf0d4368c681c3967ce13fbbcbbf66 (patch)
tree5bfd63b0857ec84ef4b9c3614ac19055323b926c /test/core
parent43598ccc39adfdc1c8019f28222b6d06b2ca632a (diff)
Fix census_log_tests on platforms with only one core.
Diffstat (limited to 'test/core')
-rw-r--r--test/core/statistics/census_log_tests.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c
index 6a3c8adcc5..ca2d1dedb0 100644
--- a/test/core/statistics/census_log_tests.c
+++ b/test/core/statistics/census_log_tests.c
@@ -123,11 +123,11 @@ static void assert_log_empty(void) {
/* Given log size and record size, computes the minimum usable space. */
static gpr_int32 min_usable_space(size_t log_size, size_t record_size) {
gpr_int32 usable_space;
- gpr_int32 num_blocks = log_size / CENSUS_LOG_MAX_RECORD_SIZE;
+ gpr_int32 num_blocks = GPR_MAX(log_size / CENSUS_LOG_MAX_RECORD_SIZE,
+ gpr_cpu_num_cores());
gpr_int32 waste_per_block = CENSUS_LOG_MAX_RECORD_SIZE % record_size;
/* In the worst case, all except one core-local block is full. */
- gpr_int32 num_full_blocks = GPR_MAX(gpr_cpu_num_cores() - 2, 2);
- GPR_ASSERT(num_blocks >= num_full_blocks);
+ gpr_int32 num_full_blocks = num_blocks - 1;
usable_space = (gpr_int32)log_size -
(num_full_blocks * CENSUS_LOG_MAX_RECORD_SIZE) -
((num_blocks - num_full_blocks) * waste_per_block);