Skip to content
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

Test: Use a xvfb wrapper for x11 test #348

Merged
merged 4 commits into from
Sep 18, 2023

Conversation

wismill
Copy link
Member

@wismill wismill commented Jun 26, 2023

The X11 test is currently silently skipped in CI. Use a xvfb wrapper to ensure to run it. See #339 for the rationale.

The code is adapted from #339 and it is intended to be rebased on it, then refactor the x11comp test as well with the wrapper, which is closed in favour of this new PR.

Question: should we use an option to disable the wrapper, in order to test with a local X11 server as previously?

@wismill wismill added the testing Indicates a need for improvements or additions to testing label Jun 26, 2023
Copy link
Contributor

@whot whot left a comment

Choose a reason for hiding this comment

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

Personally, the only thing that needs to be fixed is the typo, the rest is good enough for a test case. Some suggestions on improvements but at some point there's a valid effort vs gain argument...

test/xvfb-wrapper.c Outdated Show resolved Hide resolved
meson.build Outdated Show resolved Hide resolved
test/xvfb-wrapper.c Outdated Show resolved Hide resolved
test/xvfb-wrapper.c Outdated Show resolved Hide resolved
test/x11.c Show resolved Hide resolved
@wismill wismill force-pushed the wip/test/use-xvfb-for-x11-test branch from 5cc9f26 to ff2b1dc Compare June 27, 2023 14:34
@wismill wismill mentioned this pull request Jun 27, 2023
@wismill
Copy link
Member Author

wismill commented Jun 27, 2023

I closed #339 in favour of this PR.

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

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

LGTM! It'd be nice to have the x11 not rely on a running x server.

.github/workflows/linux.yml Outdated Show resolved Hide resolved
@bluetech
Copy link
Member

Question: should we use an option to disable the wrapper, in order to test with a local X11 server as previously?

I think it's not necessary.

@wismill wismill force-pushed the wip/test/use-xvfb-for-x11-test branch from 9ea7271 to 975c05b Compare June 30, 2023 15:52
@wismill wismill mentioned this pull request Jun 30, 2023
@wismill wismill added this to the 1.6.0 milestone Jul 3, 2023
@wismill wismill marked this pull request as ready for review July 3, 2023 19:56
Copy link
Contributor

@whot whot left a comment

Choose a reason for hiding this comment

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

my only "concern" right now is the different coding style in the wrapper function compared to the rest of xkbcommon (which also introduces a potential uninitialized variable bug). Other than that, the usual nitpicks but this LGTM, thanks.

test/xvfb-wrapper.c Outdated Show resolved Hide resolved
test/xvfb-wrapper.c Show resolved Hide resolved
test/xvfb-wrapper.c Outdated Show resolved Hide resolved
test/xvfb-wrapper.c Outdated Show resolved Hide resolved
test/xvfb-wrapper.c Outdated Show resolved Hide resolved
kill(xvfb_pid, SIGTERM);
fclose(display_fd);
err_display_fd:
return ret;
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nitpick: if you declare and init the pid and fd variables to 0/-1 at the top of the functions, you can have a single error: label that kills and closes since they're at default values. slight simplification

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure of this: I get a warning if I set display_fd to -1. We surely do not want to depend on undefined behaviour.

test/xvfb-wrapper.c Outdated Show resolved Hide resolved
test/x11.c Show resolved Hide resolved
The x11 test is currently silently skipped in CI, because it requires a
running X server.

Create a xvfb wrapper to run the test. We do not use `xvfb-run`, because
it is a shell script and it causes valgrind to detect unrelated memory
issues in the shell (dash, bash).

Improve wrapper using a special ELF section

TODO: The wrapper is intended to be used with the x11comp test as well.
Based on the work done by Peter Hutterer. Original commit message:

If SIGUSR1 is set to SIG_IGN, X servers (all of them, including Xvfb)
will send that signal to the parent process when they're ready to accept
connections. We can use that instead of a hardcoded sleep which brings
the wait down to ~37ms on my box.
This test was previously disabled in 914e84e.

Note that it requires a recent version of xkeyboard-config to succeed.
xkeyboard-config and xkbcommon projects are quite intertwined so we
want things to blow up early.

It also solves an issue with the x11comp test.
@wismill wismill force-pushed the wip/test/use-xvfb-for-x11-test branch from 1733d90 to 76b3799 Compare September 18, 2023 14:01
@wismill
Copy link
Member Author

wismill commented Sep 18, 2023

Rebased & improved commits. Review done and tests passed. Let’s merge!

@wismill wismill merged commit cf228ac into xkbcommon:master Sep 18, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Indicates a need for improvements or additions to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants