(error "Window system frame should be used")

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

(error "Window system frame should be used")

Lars Ingebrigtsen
I'm trying to write some tests for `image-size' (in conjunction with
scaling, which has no tests currently, apparently), but ert just says:

Test image-size condition:
    (error "Window system frame should be used")
   FAILED  1/1  image-size

Ran 1 tests, 0 results as expected, 1 unexpected (2017-04-20 23:29:22+0200)

So I guess in batch mode ... something frame-like has to be set up?  Or
something?  The error message is a bit unclear; I tried looking for
"window system frame" and came up short...

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Lars Ingebrigtsen
Lars Ingebrigtsen <[hidden email]> writes:

> Test image-size condition:
>     (error "Window system frame should be used")
>    FAILED  1/1  image-size

Oh, I see -- it means "(window system) frame", not "window (system
frame)".  I wondered why I had never heard of a "system frame" before.
:-)

Can I get a window-system frame when running tests, though?  I've
grepped for a couple of minutes through tests, but haven't really found
anything...

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Lars Ingebrigtsen
Hm.  Is there no way to create a headless Emacs that has window-system
frames?  It seems kinda unlikely that we don't have a way to test these
things?  Or should I just stick the tests in test/manual?

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Clément Pit-Claudel
On 2017-04-20 18:50, Lars Ingebrigtsen wrote:
> Hm.  Is there no way to create a headless Emacs that has window-system
> frames?  It seems kinda unlikely that we don't have a way to test these
> things?  Or should I just stick the tests in test/manual?

It's tricky. You can start a daemon, and use a client to connect to it and create a new frame.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Eli Zaretskii
In reply to this post by Lars Ingebrigtsen
> From: Lars Ingebrigtsen <[hidden email]>
> Date: Fri, 21 Apr 2017 00:50:34 +0200
>
> Hm.  Is there no way to create a headless Emacs that has window-system
> frames?

No.  To do that, Emacs has to use GUI APIs, which need a window-system
window (a.k.a. "frame").

> Or should I just stick the tests in test/manual?

I think that's the only practical choice, yes.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Lars Brinkhoff
In reply to this post by Lars Ingebrigtsen
Lars Ingebrigtsen wrote:
> Hm.  Is there no way to create a headless Emacs that has window-system
> frames?  It seems kinda unlikely that we don't have a way to test these
> things?

I'm wildly guessing it shouldn't be impossible to create a
stub/shim/mock window system that's available in batch mode.

If someone were interested in looking into this, how would they
reproduce your error?


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Lars Brinkhoff
Lars Brinkhoff wrote:
> Lars Ingebrigtsen wrote:
>> Is there no way to create a headless Emacs that has window-system
>> frames?  It seems kinda unlikely that we don't have a way to test
>> these things?
>
> I'm wildly guessing it shouldn't be impossible to create a
> stub/shim/mock window system that's available in batch mode.

I'm noting that "emacs -nw" can make a graphical frame, but "emacs
-batch" can not.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Eli Zaretskii
> From: Lars Brinkhoff <[hidden email]>
> Date: Fri, 21 Apr 2017 09:45:42 +0200
>
> I'm noting that "emacs -nw" can make a graphical frame, but "emacs
> -batch" can not.

"emacs -nw" can _display_ a GUI frame.  In batch sessions, we don't
display anything, because it's a non-interactive invocation.  Batch
sessions have a frame of a special type, which is neither a TTY frame
nor a GUI frame.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Lars Brinkhoff
Eli Zaretskii wrote:
>> I'm noting that "emacs -nw" can make a graphical frame, but "emacs
>> -batch" can not.
> "emacs -nw" can _display_ a GUI frame.  In batch sessions, we don't
> display anything, because it's a non-interactive invocation.  Batch
> sessions have a frame of a special type, which is neither a TTY frame
> nor a GUI frame.

It's interesting to try.  In non-interactive mode, `make-frame' crashes
with "I/O possible" (receiving a SIGIO I guess) when making a GUI frame,
and segmentation fault when making a TTY frame.

I.e.

emacs -batch -eval "(make-frame '((display . \":0\")))"
emacs -batch -eval "(make-frame '((tty-type . \"xterm\")))"


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Eli Zaretskii
> From: Lars Brinkhoff <[hidden email]>
> Date: Fri, 21 Apr 2017 10:44:04 +0200
>
> Eli Zaretskii wrote:
> > "emacs -nw" can _display_ a GUI frame.  In batch sessions, we don't
> > display anything, because it's a non-interactive invocation.  Batch
> > sessions have a frame of a special type, which is neither a TTY frame
> > nor a GUI frame.
>
> It's interesting to try.

"Interesting" as in that Chinese curse? ;-)

> In non-interactive mode, `make-frame' crashes
> with "I/O possible" (receiving a SIGIO I guess) when making a GUI frame,
> and segmentation fault when making a TTY frame.

It won't work without some non-trivial refactoring.  And even after
that, some pretty basic stuff will never work.

> emacs -batch -eval "(make-frame '((display . \":0\")))"
> emacs -batch -eval "(make-frame '((tty-type . \"xterm\")))"

The last one doesn't need to crash.  Try

  emacs -batch -eval "(make-terminal-frame '(()))"

Here, it exits with an error message.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Stefan Monnier
In reply to this post by Eli Zaretskii
>> Or should I just stick the tests in test/manual?
> I think that's the only practical choice, yes.

It's just a small matter of starting an Xvfb server ;-)


        Stefan


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Eli Zaretskii
> From: Stefan Monnier <[hidden email]>
> Date: Fri, 21 Apr 2017 09:22:08 -0400
>
> >> Or should I just stick the tests in test/manual?
> > I think that's the only practical choice, yes.
>
> It's just a small matter of starting an Xvfb server ;-)

On what OS?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (error "Window system frame should be used")

Lars Ingebrigtsen
In reply to this post by Lars Brinkhoff
Lars Brinkhoff <[hidden email]> writes:

> Lars Ingebrigtsen wrote:
>> Hm.  Is there no way to create a headless Emacs that has window-system
>> frames?  It seems kinda unlikely that we don't have a way to test these
>> things?
>
> I'm wildly guessing it shouldn't be impossible to create a
> stub/shim/mock window system that's available in batch mode.
>
> If someone were interested in looking into this, how would they
> reproduce your error?

Let's see...  I think this is a pretty minimal test case:

[larsi@stories ~]$ emacs -batch --eval "(progn (require 'svg) (image-size (svg-image (svg-create 50 50))))"
Window system frame should be used

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

Loading...