From 75911ed3a765fad620e8f45e35e6b8697e41e934 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Wed, 3 Jul 2024 16:49:10 -0400 Subject: [PATCH] experiment --- .github/workflows/test-ffi-bindings.yml | 10 +--------- bindings_ffi/Cargo.toml | 1 + bindings_ffi/src/mls.rs | 12 ++++++++++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-ffi-bindings.yml b/.github/workflows/test-ffi-bindings.yml index e6ebac803..35d1485cc 100644 --- a/.github/workflows/test-ffi-bindings.yml +++ b/.github/workflows/test-ffi-bindings.yml @@ -1,10 +1,8 @@ name: Test FFI Bindings - on: push: branches: - main - pull_request: # only run tests when related changes are made paths: @@ -21,7 +19,6 @@ on: - "Cargo.toml" - "Cargo.lock" - "rust-toolchain" - jobs: test: name: Test @@ -29,19 +26,15 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Update rust toolchains run: rustup update - - uses: Swatinem/rust-cache@v2 with: workspaces: | . bindings_ffi - - name: Start Docker containers run: dev/up - - name: Setup Kotlin run: | sudo apt update -q @@ -50,8 +43,7 @@ jobs: cd bindings_ffi make install-jar echo "$(make echo-jar | tail -n 1 | sed -e 's/\.*export //')" >> "$GITHUB_ENV" - - name: Run cargo test on FFI bindings run: | export CLASSPATH="${{ env.CLASSPATH }}" - cargo test --manifest-path bindings_ffi/Cargo.toml -- --test-threads=2 + RUST_LOG=info,mls::tests=debug cargo test --manifest-path bindings_ffi/Cargo.toml -- --test-threads=2 diff --git a/bindings_ffi/Cargo.toml b/bindings_ffi/Cargo.toml index 99488e085..e28bd0ffe 100644 --- a/bindings_ffi/Cargo.toml +++ b/bindings_ffi/Cargo.toml @@ -23,6 +23,7 @@ xmtp_proto = { path = "../xmtp_proto", features = ["proto_full", "grpc"] } xmtp_user_preferences = { path = "../xmtp_user_preferences" } xmtp_v2 = { path = "../xmtp_v2" } +tracing-subscriber = { "0.3", features = ["env-filter"] } # NOTE: A regression in openssl-sys exists where libatomic is dynamically linked # for i686-linux-android targets. https://github.com/sfackler/rust-openssl/issues/2163 # diff --git a/bindings_ffi/src/mls.rs b/bindings_ffi/src/mls.rs index 05fbe32e9..c7d83eb52 100644 --- a/bindings_ffi/src/mls.rs +++ b/bindings_ffi/src/mls.rs @@ -81,7 +81,12 @@ pub async fn create_client( legacy_signed_private_key_proto: Option>, history_sync_url: Option, ) -> Result, GenericError> { - init_logger(logger); + use tracing_subscriber::prelude::*; + //init_logger(logger); + let _ = tracing_subscriber::registry() + .with(tracing_subscriber::fmt::layer()) + .with(tracing_subscriber::EnvFilter::from_default_env()) + .try_init(); log::info!( "Creating API client for host: {}, isSecure: {}", host, @@ -1933,16 +1938,19 @@ mod tests { let stream_callback = RustStreamCallback::default(); let stream_closer = group.stream(Box::new(stream_callback.clone())); + log::info!("WAITING FOR READY"); stream_closer.wait_for_ready().await; group.send("hello".as_bytes().to_vec()).await.unwrap(); + log::info!("SEND HELLO"); stream_callback.wait_for_delivery().await; group.send("goodbye".as_bytes().to_vec()).await.unwrap(); + log::info!("SEND GOODBYE"); stream_callback.wait_for_delivery().await; assert_eq!(stream_callback.message_count(), 5); - println!("WAITING FOR STREAM TO END"); + log::info!("STREAM CLSOER"); stream_closer.end_and_wait().await.unwrap(); }