-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tests #206
base: main
Are you sure you want to change the base?
Fix tests #206
Conversation
44e8649
to
82ad67d
Compare
@@ -64,10 +64,12 @@ test( | |||
'--target-dir=@0@'.format(cargo_target_dir), | |||
'--', | |||
'--nocapture', | |||
'--test-threads=1', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still required, even though gtk tests already run single threaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't add it if it wasn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not sure why this is still needed
Why is this still not merged? And yes, it’s still relevant. |
https://github.com/gtk-rs/gtk-test#general-setup: > When running test, you need to specify that you only want ONE thread. > Otherwise, GTK contexts might conflict into each others.
There are multiple tests that require schema to be compiled and GSETTINGS_SCHEMA_DIR set, not just the one in settings.rs. The other tests currently fail due to missing schema.
#[cfg(test)] | ||
#[macro_use] | ||
extern crate ctor; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not needed.
|
||
#[cfg(test)] | ||
mod test { | ||
use ctor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as this
use std::{env, process::Command}; | ||
|
||
// Run once before tests are executed. | ||
#[ctor] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[ctor] | |
#[ctor::ctor] |
or
use ctor::ctor;
#[ctor]
fn setup_schema() {
...
}
], | ||
env: [ | ||
'RUST_BACKTRACE=1', | ||
'GSETTINGS_SCHEMA_DIR=@0@/data'.format(meson.project_build_root()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be needed too since it is set on setup_schema
.
Sorry, btw I haven't given this much focus, I have been really busy in other stuff |
Also, not sure what this patch specifically fixes. Is there any particular error? |
Now the tests finally pass.
However, it still doesn’t run on CI out-of-box because some of the tests are not unit tests but integration tests utilizing Gtk that require a display. I successfully run it via
xvfb-run
, but this provides a virtual X server, not a Wayland server. I haven’t found a similar tool for Wayland yet.Fixes #197.