Sha256: f337576ba8f7886fe3974c53eaabdebf3f6ba79aa4c0e42bed5a3e7dc30d4e27

Contents?: true

Size: 676 Bytes

Versions: 16

Compression:

Stored size: 676 Bytes

Contents

use std::time::Instant;

mod common;

#[macro_use]
extern crate more_asserts;

#[test]
fn test_sleep() {
    let (store, instance) = common::create_instance("scheduler.wasm");
    let start = Instant::now();
    common::invoke_func::<(), ()>(store, instance, "sleep", ());
    let duration = start.elapsed();
    assert_lt!(duration.as_millis(), 100);
}

#[test]
fn test_yield() {
    let (store, instance) = common::create_instance("scheduler.wasm");

    // it's difficult to test that yielding isn't yielding in practice since sched_yield is very fast
    // it's still worth testing that it doesn't panic
    common::invoke_func::<(), ()>(store, instance, "yield", ());
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.29/tests/scheduler.rs
wasmtime-28.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.28/tests/scheduler.rs
wasmtime-27.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.27/tests/scheduler.rs
wasmtime-26.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.26/tests/scheduler.rs
wasmtime-25.0.2 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.25/tests/scheduler.rs
wasmtime-25.0.1 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.25/tests/scheduler.rs
wasmtime-25.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.25/tests/scheduler.rs
wasmtime-24.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.24/tests/scheduler.rs
wasmtime-23.0.2 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.23/tests/scheduler.rs
wasmtime-22.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.22/tests/scheduler.rs
wasmtime-21.0.1 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.22/tests/scheduler.rs
wasmtime-20.0.2 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.21/tests/scheduler.rs
wasmtime-20.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.21/tests/scheduler.rs
wasmtime-18.0.3 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.19/tests/scheduler.rs
wasmtime-17.0.1 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.18/tests/scheduler.rs
wasmtime-17.0.0 ./ext/cargo-vendor/deterministic-wasi-ctx-0.1.18/tests/scheduler.rs