fuzz: Increase more limits when spectest fuzzing (#3926)

When using the pooling instance allocator for running spec tests we have
to make sure that the configured limits of the allocator aren't so low
as to cause the spec tests to fail due to resource exhaustion issues or
similar. This commit adds in minimum thresholds for instance size as
well as instance count. While here this goes ahead and refactors
everything here to look similar.
This commit is contained in:
Alex Crichton
2022-03-14 11:35:17 -05:00
committed by GitHub
parent a68f44a924
commit 44351cc4af

View File

@@ -354,12 +354,16 @@ impl Config {
..
} = &mut self.wasmtime.strategy
{
limits.memories = 1;
limits.tables = 5;
limits.table_elements = 1_000;
// Set a lower bound of as the spec tests define memories with at
// least a few pages and some tests do memory grow operations.
limits.memory_pages = std::cmp::max(limits.memory_pages, 900);
// Configure the lower bound of a number of limits to what's
// required to actually run the spec tests. Fuzz-generated inputs
// may have limits less than these thresholds which would cause the
// spec tests to fail which isn't particularly interesting.
limits.memories = limits.memories.max(1);
limits.tables = limits.memories.max(5);
limits.table_elements = limits.memories.max(1_000);
limits.memory_pages = limits.memory_pages.max(900);
limits.count = limits.count.max(40);
limits.size = limits.size.max(4096);
match &mut self.wasmtime.memory_config {
MemoryConfig::Normal(config) => {