MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / from_env

Method from_env

hail-fuzz/src/config.rs:86–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84
85impl EnabledFeatures {
86 pub fn from_env() -> anyhow::Result<Self> {
87 let dump_jit_mapping = parse_bool_env("DUMP_JIT_MAPPING")?.unwrap_or(false);
88
89 let simple_energy_assignment = parse_bool_env("SIMPLE_ENERGY_ASSIGNMENT")?.unwrap_or(false);
90 let access_contexts =
91 icicle_fuzzing::parse_bool_env("USE_ACCESS_CONTEXTS")?.unwrap_or(false);
92 let extension_factor =
93 icicle_fuzzing::parse_bool_env("USE_EXTENSION_FACTOR")?.unwrap_or(true);
94 let add_favored_inputs = parse_bool_env("ADD_FAVORED_INPUTS")?.unwrap_or(false);
95
96 let resize_load_level = match std::env::var("ICICLE_RESIZE_LOADS").as_deref() {
97 Ok("0") => 0,
98 Ok("1") => 1,
99 Ok("2") => 2,
100 Ok("3") | Ok("true") | Err(std::env::VarError::NotPresent) => 3,
101 Ok(other) => anyhow::bail!("unknown level for resize loads: {other}"),
102 Err(e) => anyhow::bail!("error reading environment variable: {e}"),
103 };
104
105 if icicle_fuzzing::parse_bool_env("LENGTH_EXTENSION_ONLY")?.unwrap_or(false) {
106 return Ok(Self {
107 access_contexts,
108 resize_load_level,
109 havoc: false,
110 cmplog: false,
111 max_i2s_bytes: 0,
112 strided_int_matches: false,
113 colorization: false,
114 auto_trim: false,
115 smart_trim: false,
116 auto_dict: false,
117 simple_energy_assignment,
118 extension_factor,
119 add_favored_inputs,
120 skip_prefix: false,
121 dump_jit_mapping,
122 });
123 }
124
125 // Enabled by default
126 let cmplog = parse_bool_env("ENABLE_CMPLOG")?.unwrap_or(true);
127 let max_i2s_bytes =
128 std::env::var("MAX_I2S_BYTES").ok().and_then(|s| s.parse().ok()).unwrap_or(512);
129 let strided_int_matches = parse_bool_env("ENABLE_STRIDED_INT_MATCHES")?.unwrap_or(true);
130 let colorization = parse_bool_env("ENABLE_COLORIZATION")?.unwrap_or(cmplog);
131 let havoc = parse_bool_env("ENABLE_HAVOC")?.unwrap_or(true);
132 let auto_trim = parse_bool_env("ENABLE_AUTO_TRIM")?.unwrap_or(true);
133 let smart_trim = parse_bool_env("ENABLE_TRIM")?.unwrap_or(true);
134 let auto_dict = parse_bool_env("ENABLE_AUTO_DICT")?.unwrap_or(true);
135
136 // Disable by default
137 let skip_prefix = parse_bool_env("SKIP_PREFIX")?.unwrap_or(false);
138
139 Ok(Self {
140 access_contexts,
141 resize_load_level,
142 havoc,
143 cmplog,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected