MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / test_tuples

Function test_tuples

cranelift/filetests/src/runone.rs:112–139  ·  view source on GitHub ↗

Given a slice of tests, generate a vector of (test, flags, isa) tuples.

(
    tests: &'a [Box<dyn SubTest>],
    isa_spec: &'a IsaSpec,
    no_isa_flags: &'a Flags,
)

Source from the content-addressed store, hash-verified

110
111// Given a slice of tests, generate a vector of (test, flags, isa) tuples.
112fn test_tuples<'a>(
113 tests: &'a [Box<dyn SubTest>],
114 isa_spec: &'a IsaSpec,
115 no_isa_flags: &'a Flags,
116) -> anyhow::Result<Vec<(&'a dyn SubTest, &'a Flags, Option<&'a dyn TargetIsa>)>> {
117 let mut out = Vec::new();
118 for test in tests {
119 if test.needs_isa() {
120 match *isa_spec {
121 IsaSpec::None(_) => {
122 // TODO: Generate a list of default ISAs.
123 anyhow::bail!("test {} requires an ISA", test.name());
124 }
125 IsaSpec::Some(ref isas) => {
126 for isa in isas {
127 out.push((&**test, isa.flags(), Some(&**isa)));
128 }
129 }
130 }
131 } else {
132 // This test doesn't require an ISA, and we only want to run one instance of it.
133 // Still, give it an ISA ref if we happen to have a unique one.
134 // For example, `test cat` can use this to print encodings and register names.
135 out.push((&**test, no_isa_flags, isa_spec.unique_isa()));
136 }
137 }
138 Ok(out)
139}
140
141/// A helper struct to update a file in-place as test expectations are
142/// automatically updated.

Callers 1

runFunction · 0.85

Calls 6

OkFunction · 0.85
unique_isaMethod · 0.80
newFunction · 0.50
needs_isaMethod · 0.45
pushMethod · 0.45
flagsMethod · 0.45

Tested by

no test coverage detected