Linux travis tries and fails to open Gtk display

I’m writing this package, and wanted to test it on Travis. It includes Gtk.jl.

While the osx build works fine, the linux one doesn’t:

INFO: Testing Associations

WARNING: Method definition depth_buffer(Gtk.GtkGLArea, Bool) in module Gtk at /home/travis/.julia/v0.5/Gtk/src/gl_area.jl:33 overwritten at /home/travis/.julia/v0.5/Gtk/src/gl_area.jl:35.

WARNING: Method definition stencil_buffer(Gtk.GtkGLArea) in module Gtk at /home/travis/.julia/v0.5/Gtk/src/gl_area.jl:37 overwritten at /home/travis/.julia/v0.5/Gtk/src/gl_area.jl:39.

ERROR: LoadError: InitError: Cannot open display: 

 in Gtk.GLib.GError(::Gtk.##229#230) at /home/travis/.julia/v0.5/Gtk/src/GLib/gerror.jl:17

 in __init__() at /home/travis/.julia/v0.5/Gtk/src/events.jl:10

 in _include_from_serialized(::String) at ./loading.jl:150

 in _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:187

 in require(::Symbol) at ./loading.jl:394

 in include_from_node1(::String) at ./loading.jl:488

 in macro expansion; at ./none:2 [inlined]

 in anonymous at ./<missing>:?

 in eval(::Module, ::Any) at ./boot.jl:234

 in process_options(::Base.JLOptions) at ./client.jl:242

 in _start() at ./client.jl:321

during initialization of module Gtk

while loading /home/travis/.julia/v0.5/Associations/src/Associations.jl, in expression starting on line 4

ERROR: LoadError: Failed to precompile Associations to /home/travis/.julia/lib/v0.5/Associations.ji.

 in compilecache(::String) at ./loading.jl:593

 in require(::Symbol) at ./loading.jl:422

 in include_from_node1(::String) at ./loading.jl:488

 in process_options(::Base.JLOptions) at ./client.jl:265

 in _start() at ./client.jl:321

while loading /home/travis/.julia/v0.5/Associations/test/runtests.jl, in expression starting on line 1

============================[ ERROR: Associations ]=============================

While my package does involve some GUI, none of my testing does (I only test non-GUI parts of the code). Any ideas?

Use xvfb-run, such as demonstrated at https://github.com/JuliaGraphics/Gtk.jl/blob/c39f3b608e8c035b25a05ddaa4427010cf180c17/.travis.yml#L19

Could you also make a PR to the Gtk README? “How to have working CI” is probably a very useful topic for many.

I’d love to, but this didn’t fix the issue :confused:

Looking at https://github.com/yakir12/Associations.jl/commit/df4a6ced37b76b3810f89bb23e33f590fc0bb392, you also need to initialize (https://github.com/JuliaGraphics/Gtk.jl/blob/c39f3b608e8c035b25a05ddaa4427010cf180c17/.travis.yml#L14-L16) and use (https://github.com/JuliaGraphics/Gtk.jl/blob/c39f3b608e8c035b25a05ddaa4427010cf180c17/.travis.yml#L20) the variable.

Woohoo! It worked! Thanks! I’ll PR the docs once Gtk.jl merges my last documents PR.

This would indeed be good to have in the documentation. But please in the new documentation system :slight_smile:

my last change was in the new docs system, right?