| 487 | } |
| 488 | |
| 489 | static bool gic_quota_pair(const gic_replay_result *full, cbm_ignore_cap_t cap) { |
| 490 | cbm_ignore_checked_limits_t limits = gic_limits(); |
| 491 | if (cap == CBM_IGNORE_CAP_BYTES) |
| 492 | limits.max_bytes = full->usage.bytes_reserved; |
| 493 | if (cap == CBM_IGNORE_CAP_PATTERNS) |
| 494 | limits.max_patterns = full->usage.patterns_reserved; |
| 495 | if (cap == CBM_IGNORE_CAP_ARENA) |
| 496 | limits.max_arena_bytes = full->usage.arena_requested_bytes; |
| 497 | if (cap == CBM_IGNORE_CAP_WORK) |
| 498 | limits.max_work = full->usage.work_used; |
| 499 | gic_replay_result exact = {0}, short_cap = {0}; |
| 500 | if (!gic_replay(&limits, &exact) || exact.status != CBM_IGNORE_CHECKED_OK || |
| 501 | exact.cap != CBM_IGNORE_CAP_NONE || !gic_usage_equal(&full->usage, &exact.usage)) |
| 502 | return false; |
| 503 | if (cap == CBM_IGNORE_CAP_BYTES) |
| 504 | limits.max_bytes--; |
| 505 | if (cap == CBM_IGNORE_CAP_PATTERNS) |
| 506 | limits.max_patterns--; |
| 507 | if (cap == CBM_IGNORE_CAP_ARENA) |
| 508 | limits.max_arena_bytes--; |
| 509 | if (cap == CBM_IGNORE_CAP_WORK) |
| 510 | limits.max_work--; |
| 511 | return gic_replay(&limits, &short_cap) && short_cap.status == CBM_IGNORE_CHECKED_LIMIT && |
| 512 | short_cap.cap == cap && short_cap.usage.terminal_status == CBM_IGNORE_CHECKED_LIMIT && |
| 513 | short_cap.usage.bytes_reserved <= limits.max_bytes && |
| 514 | short_cap.usage.patterns_reserved <= limits.max_patterns && |
| 515 | short_cap.usage.arena_requested_bytes <= limits.max_arena_bytes && |
| 516 | short_cap.usage.work_used <= limits.max_work; |
| 517 | } |
| 518 | |
| 519 | TEST(gic_d_aggregate_quota_boundaries) { |
| 520 | cbm_ignore_checked_limits_t limits = gic_limits(); |
no test coverage detected