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

what is the correct way to invoke xvfb on osx? #7313

Closed
wchristian opened this issue Feb 13, 2017 · 14 comments
Closed

what is the correct way to invoke xvfb on osx? #7313

wchristian opened this issue Feb 13, 2017 · 14 comments
Labels

Comments

@wchristian
Copy link

There are some instructions in https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI , however they are entirely wrong for osx, as /etc/init.d/xvfb does not exist on OSX.

This does however not mean that xvfb is not on OSX at all. According to #2351 (comment) XQuartz is installed, and indeed when i try to run Xvfb, i actually get a little further:

$ if [ "${TRAVIS_OS_NAME}" = "osx" ]; then Xvfb :99 -ac -screen 0 1024x768x8 -extension GLX; fi
[mi] Extension "GLX" is not recognized
[mi] Only the following extensions can be run-time disabled:
[mi]    Generic Events
[mi]    Composite
[mi]    DAMAGE
[mi]    DOUBLE-BUFFER
[mi]    DPMS
[mi]    MIT-SCREEN-SAVER
[mi]    MIT-SHM
[mi]    RANDR
[mi]    RENDER
[mi]    X-Resource
[mi]    XFIXES
[mi]    XINERAMA
[mi]    XTEST
[mi]    XVideo
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
_XSERVTransSocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 
The command "if [ "${TRAVIS_OS_NAME}" = "osx" ]; then Xvfb :99 -ac -screen 0 1024x768x8 -extension GLX; fi" failed and exited with 1 during .

However, as shown, there are still dire errors preventing it from actually working.

Due to being inexperienced with macs in general, not having a mac, and the change/execute cycle of travis-ci being quite slow, i find myself looking at hours and days of testing various incantations in hopes of finding the right one.

Can anyone please provide the correct incantation of xvfb on OSX?

I'd even do the legwork of making a doc patch out of it.

@BanzaiMan
Copy link
Contributor

So the error message says it's not compiled with GLX extension. Does X start without it?

@wchristian
Copy link
Author

@BanzaiMan I only pasted the whole thing for completeness. I beleive the GLX thing is a red herring (including it was only an experiment in itself), and the _XSERV errors are unrelated to it, but the important bits.

@BanzaiMan
Copy link
Contributor

OK. So it's complaining about euid not being 0. Try sudo.

@wchristian
Copy link
Author

wchristian commented Feb 14, 2017

@BanzaiMan Well, that got me a little further:

$ if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo Xvfb :99 -ac -screen 0 1024x768x8; fi

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.

How do i make that not take over the session?

@BanzaiMan
Copy link
Contributor

Send it to the background.

@wchristian
Copy link
Author

By putting & before the ;? Last time i tried i only got an error from that for my troubles. Maybe it needs more spaces? Or with sh -e?

I'd really like to be sure what exactly belongs where, because: 1. i do not have a mac 2. i have never had a mac 3. right now travis runs take several hours due to the queue being completely packed.

@BanzaiMan
Copy link
Contributor

Yes. Send it to the background with &.

if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo Xvfb :99 -ac -screen 0 1024x768x8 &; fi

Any valid bash statement can go in there.

We apologize for the delay in Mac builds, but as it stands, there is much larger demand for the Macs than we have capacity for.

I would also remind you that X Window on the Mac is not very common, so whatever you are testing may be of limited value, unless you demand your users to have X available.

@wchristian
Copy link
Author

Thanks for the clear example, gonna try that then. :)

As for the delays, no worries. I'm happy that the service exists at all! :D
Only mentioned it to explain why i asked again instead of giving it a try.

And what we're testing here is a Perl OpenGL module which needs access to some kind of sane OpenGL context to make the tests in any way useful. I'm hoping xvfb will be able to provide that.

@wchristian
Copy link
Author

And that resulted in:

$ if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo Xvfb :99 -ac -screen 0 1024x768x8 &; fi
/Users/travis/build.sh: eval: line 59: syntax error near unexpected token `;'
/Users/travis/build.sh: eval: line 59: `if [ "${TRAVIS_OS_NAME}" = "osx" ]; then sudo Xvfb :99 -ac -screen 0 1024x768x8 &; fi '

Does the & need to be escaped maybe?

@wchristian
Copy link
Author

Adding a slash in front of the & didn't help. xvfb tried to parse the & as an option.

@BanzaiMan
Copy link
Contributor

Interesting. Xvfb's option parsing is weird. http://stackoverflow.com/a/37429660/136333

@wchristian
Copy link
Author

That solution doesn't help me around the &; = syntax error thing, sadly.

Looks like i'm running into this problem: http://unix.stackexchange.com/questions/26530/send-task-to-background-in-an-if

Trying this now:

- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ( sudo Xvfb :99 -ac -screen 0 1024x768x8; echo ok )& fi

@wchristian
Copy link
Author

Alright, that made the command succeed, so i can at least make a PR for that: https://travis-ci.org/devel-chm/OpenGL-Modern/builds/201749028

However it still didn't make an OpenGL context available. Possibly i need to install GLX for that? Googling didn't give any hints as to how though. Any other ideas maybe, or is osx opengl testing just not possible with travis?

@BanzaiMan
Copy link
Contributor

Quite possible. Since you were able to start X, however, I'm going to close this ticket. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants