aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Alistair Veitch <alistair.veitch@gmail.com>2015-01-27 17:31:23 -0800
committerGravatar Alistair Veitch <alistair.veitch@gmail.com>2015-01-27 17:31:23 -0800
commit4d9f3d7b6337880ff1bb72de91e1421589f09582 (patch)
tree59d4c6635602514367c7c00d714dcc11f1c954db /test/core
parent3b56a57b25fcf2536b817856ed56221d86f48d73 (diff)
parent295699425a0165c62d9f347806d42eab104269d3 (diff)
Merge pull request #167 from maxwell-demon/master
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);