Skip to content

Commit

Permalink
fix: Init logging in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xdoardo committed Nov 5, 2024
1 parent 9246c68 commit fcd5326
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
27 changes: 26 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lib/wasix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ tokio = { workspace = true, features = [
pretty_assertions.workspace = true
tracing-test = "0.2.4"
wasm-bindgen-test = "0.3.0"
env_logger = "0.11.5"
log = "0.4.22"

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.0"
Expand Down
13 changes: 13 additions & 0 deletions lib/wasix/tests/runners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
// there.
#![cfg(not(target_family = "wasm"))]

use std::sync::Once;
use std::{
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};

static INIT: Once = Once::new();

use reqwest::Client;
use tokio::runtime::Handle;
use wasmer::Engine;
Expand All @@ -29,6 +32,13 @@ mod wasi {

use super::*;

fn setup() {
INIT.call_once(|| {
env_logger::builder()
.filter_level(log::LevelFilter::max())
.init();
});
}
#[tokio::test]
async fn can_run_wat2wasm() {
let webc = download_cached("https://wasmer.io/wasmer/[email protected]").await;
Expand All @@ -40,6 +50,7 @@ mod wasi {

#[tokio::test(flavor = "multi_thread")]
async fn wat2wasm() {
setup();
let webc = download_cached("https://wasmer.io/wasmer/[email protected]").await;
let container = from_bytes(webc).unwrap();
let (rt, tasks) = runtime();
Expand Down Expand Up @@ -81,6 +92,8 @@ mod wasi {

#[tokio::test(flavor = "multi_thread")]
async fn python() {
setup();

let webc = download_cached("https://wasmer.io/python/[email protected]").await;
let (rt, tasks) = runtime();
let container = from_bytes(webc).unwrap();
Expand Down

0 comments on commit fcd5326

Please sign in to comment.