@@ -1369,45 +1369,9 @@ pub fn call_async(wasm: &[u8], config: &generators::Config, mut poll_amts: &[u32
13691369#[ cfg( test) ]
13701370mod tests {
13711371 use super :: * ;
1372- use arbitrary:: Unstructured ;
1373- use rand:: prelude:: * ;
1372+ use crate :: test:: { gen_until_pass, test_n_times} ;
13741373 use wasmparser:: { Validator , WasmFeatures } ;
13751374
1376- fn gen_until_pass < T : for < ' a > Arbitrary < ' a > > (
1377- mut f : impl FnMut ( T , & mut Unstructured < ' _ > ) -> Result < bool > ,
1378- ) -> bool {
1379- let mut rng = SmallRng :: seed_from_u64 ( 0 ) ;
1380- let mut buf = vec ! [ 0 ; 2048 ] ;
1381- let n = 3000 ;
1382- for _ in 0 ..n {
1383- rng. fill_bytes ( & mut buf) ;
1384- let mut u = Unstructured :: new ( & buf) ;
1385-
1386- if let Ok ( config) = u. arbitrary ( ) {
1387- if f ( config, & mut u) . unwrap ( ) {
1388- return true ;
1389- }
1390- }
1391- }
1392- false
1393- }
1394-
1395- /// Runs `f` with random data until it returns `Ok(())` `iters` times.
1396- fn test_n_times < T : for < ' a > Arbitrary < ' a > > (
1397- iters : u32 ,
1398- mut f : impl FnMut ( T , & mut Unstructured < ' _ > ) -> arbitrary:: Result < ( ) > ,
1399- ) {
1400- let mut to_test = 0 ..iters;
1401- let ok = gen_until_pass ( |a, b| {
1402- if f ( a, b) . is_ok ( ) {
1403- Ok ( to_test. next ( ) . is_none ( ) )
1404- } else {
1405- Ok ( false )
1406- }
1407- } ) ;
1408- assert ! ( ok) ;
1409- }
1410-
14111375 // Test that the `gc_ops` fuzzer eventually runs the gc function in the host.
14121376 // We've historically had issues where this fuzzer accidentally wasn't fuzzing
14131377 // anything for a long time so this is an attempt to prevent that from happening
@@ -1501,4 +1465,9 @@ mod tests {
15011465 fn wast_smoke_test ( ) {
15021466 test_n_times ( 50 , |( ) , u| super :: wast_test ( u) ) ;
15031467 }
1468+
1469+ #[ test]
1470+ fn dynamic_component_api_smoke_test ( ) {
1471+ test_n_times ( 50 , |( ) , u| super :: dynamic_component_api_target ( u) ) ;
1472+ }
15041473}
0 commit comments