Skip to content

Fix tests#206

Open
jirutka wants to merge 3 commits into
SeaDve:mainfrom
jirutka:fix-tests
Open

Fix tests#206
jirutka wants to merge 3 commits into
SeaDve:mainfrom
jirutka:fix-tests

Conversation

@jirutka

@jirutka jirutka commented Nov 19, 2022

Copy link
Copy Markdown

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.

@jirutka jirutka force-pushed the fix-tests branch 2 times, most recently from 44e8649 to 82ad67d Compare November 19, 2022 19:38
Comment thread src/meson.build
'--target-dir=@0@'.format(cargo_target_dir),
'--',
'--nocapture',
'--test-threads=1',

Copy link
Copy Markdown
Owner

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?

Copy link
Copy Markdown
Author

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.

Copy link
Copy Markdown
Owner

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

@jirutka

jirutka commented Nov 15, 2023

Copy link
Copy Markdown
Author

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.
Comment thread src/main.rs
Comment on lines +54 to +57
#[cfg(test)]
#[macro_use]
extern crate ctor;

Copy link
Copy Markdown
Owner

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.

Comment thread src/main.rs

#[cfg(test)]
mod test {
use ctor;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as this

Comment thread src/main.rs
use std::{env, process::Command};

// Run once before tests are executed.
#[ctor]

@SeaDve SeaDve Feb 8, 2024

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[ctor]
#[ctor::ctor]

or

use ctor::ctor;

#[ctor]
fn setup_schema() {
    ...
}

Comment thread src/meson.build
],
env: [
'RUST_BACKTRACE=1',
'GSETTINGS_SCHEMA_DIR=@0@/data'.format(meson.project_build_root()),

Copy link
Copy Markdown
Owner

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.

@SeaDve

SeaDve commented Feb 11, 2024

Copy link
Copy Markdown
Owner

Sorry, btw I haven't given this much focus, I have been really busy in other stuff

@SeaDve

SeaDve commented Feb 11, 2024

Copy link
Copy Markdown
Owner

Also, not sure what this patch specifically fixes. Is there any particular error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure during Arch Linux build

2 participants