gtk-rs / gtk4-rs

Rust bindings of GTK 4
https://gtk-rs.org/gtk4-rs/
MIT License
1.85k stars 173 forks source link

Silent panic in rust builder scope tests #811

Open bilelmoussaoui opened 2 years ago

bilelmoussaoui commented 2 years ago
test builder_rust_scope::tests::test_rust_builder_scope_closure ... okthread '<unnamed>' panicked at 'Closure returned a value of type guint64 but caller expected gchararray', C:\Users\runneradmin\.cargo\git\checkouts\gtk-rs-core-7be42ca38bd6361c\2ab14f6\glib\src\closure.rs:239:25

check the CI.

cc @jf2048

jf2048 commented 2 years ago

This is an expected failure: https://github.com/gtk-rs/gtk4-rs/blob/ca06eb373d879b8a12994084a4f25d7f4a6e8236/gtk4/src/builder_rust_scope.rs#L269

The problem here is that output is not being captured because this is a glib thread, it would probably be hidden if test_synced used a rust thread. Actually we can't capture output because rust's output capturing only works with threads spawned inside the test

jf2048 commented 2 years ago

Relevant crate? https://crates.io/crates/gag

jf2048 commented 2 years ago

This also could be an option if custom test frameworks are stabilized: https://github.com/rust-lang/rust/issues/50297#issuecomment-414857184

That would also save us any issues where things like g_warning and other C libraries produce output. But we probably should be using glib::log_set_handler in any case.