Benign crates 3,787,336 installs Download

wasm-smith 0.257.0

“A WebAssembly test case generator”

Archive ships a root-level test treeRust test marker or harness
SHA-256c3b39dfaba6768ca03109a51072a22f30283fa92c91a1f0d39ba58d9497cd796

Evidence

Enumerates a directory with Rust std::fs corpus.rs · lines 1–30
1use arbitrary::{Arbitrary, Unstructured};
2use criterion::{Criterion, criterion_group, criterion_main};
3use std::hint::black_box;
4use wasm_smith::Module;
5
6pub fn benchmark_corpus(c: &mut Criterion) {
7 let mut corpus = Vec::with_capacity(2000);
8 let entries = std::fs::read_dir("./benches/corpus").expect("failed to read dir");
9 for e in entries {
10 let e = e.expect("failed to read dir entry");
11 let seed = std::fs::read(e.path()).expect("failed to read seed file");
12 corpus.push(seed);
13 }
14
15 // Benchmark how long it takes to generate a module for every seed in our
16 // corpus (taken from the `validate` fuzz target).
17 c.bench_function("corpus", |b| {
18 b.iter(|| {
19 for seed in &corpus {
20 let seed = black_box(seed);
21 let mut u = Unstructured::new(seed);
22 let result = Module::arbitrary(&mut u);
23 let _ = black_box(result);
24 }
⋯6 lines
imports arbitrary::Unstructured available_imports.rs · lines 1–17
1#![cfg(feature = "wasmparser")]
2
3use arbitrary::Unstructured;
4use rand::{Rng, SeedableRng, rngs::SmallRng};
5use std::collections::HashMap;
6use wasm_smith::{Config, Module};
7use wasmparser::Validator;
8use wasmparser::{Parser, TypeRef, ValType};
9
10mod common;
11use common::validate;
12
13#[test]
14fn smoke_test_imports_config() {
15 let mut n_partial = 0;
16 let mut global_imports_seen = HashMap::<_, bool>::new();
17 le …
imports AvailableImportKind as I available_imports.rs · lines 58–60
58:35… = import.unwrap();
59 use AvailableImportKind as I;
60 let entry = imports_seen.get_mut(&(import.module, import.name));
imports AvailableImportKind::* available_imports.rs · lines 140–148
140 let available = {
141 use {
142 AvailableImportKind::*,
143 ValType::*,
144 wasmparser::{PackedIndex, RefType},
145 };
146 vec![
147 ("env", "pi", Func(vec![I32], vec![])),
148 ("env", "pi2", F …
imports arbitrary::Arbitrary component.rs · lines 1–42
1#![cfg(feature = "component-model")]
2
3use arbitrary::{Arbitrary, Unstructured};
4use rand::{Rng, SeedableRng, rngs::SmallRng};
5use wasm_smith::Component;
6
7#[test]
8#[ignore] // FIXME(#1000): need to update wasm-smith's support for components
9fn smoke_test_component() {
10 const NUM_RUNS: usize = 4096;
⋯32 lines

Showing the top 5 files — 1 more file (9 regions) not shown.

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.