Re: [PATCH spice-gtk] build: Make usb-acl-helper test work under Meson

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> On 09/03/2018 01:34 PM, Frediano Ziglio wrote:
> > Meson waits for pipes (stdout and stderr) to be not readable but
> > our mocking helper does not close these handles causing Meson
> > to give some problems.
> > 
> 
> Can you elaborate on the "some problems"? Also this patch looks more
> like a workaround from our side for a real bug in meson?
> 

Where autoconf succeed Meson give:



Traceback (most recent call last):
  File "/usr/bin/meson", line 29, in <module>
    sys.exit(mesonmain.main())
  File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 379, in main
    return run(sys.argv[1:], launcher)
  File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 278, in run
    return mtest.run(remaining_args)
  File "/usr/lib/python3.6/site-packages/mesonbuild/mtest.py", line 760, in run
    return th.doit()
  File "/usr/lib/python3.6/site-packages/mesonbuild/mtest.py", line 511, in doit
    self.run_tests(tests)
  File "/usr/lib/python3.6/site-packages/mesonbuild/mtest.py", line 669, in run_tests
    self.drain_futures(futures)
  File "/usr/lib/python3.6/site-packages/mesonbuild/mtest.py", line 685, in drain_futures
    self.process_test_result(result.result())
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/lib64/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/mesonbuild/mtest.py", line 258, in run
    return self._run_cmd(wrap + cmd + self.test.cmd_args + self.options.test_args)
  File "/usr/lib/python3.6/site-packages/mesonbuild/mtest.py", line 356, in _run_cmd
    (stdo, stde) = p.communicate()
  File "/usr/lib64/python3.6/subprocess.py", line 843, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib64/python3.6/subprocess.py", line 1505, in _communicate
    selector.register(self.stdout, selectors.EVENT_READ)
  File "/usr/lib64/python3.6/selectors.py", line 351, in register
    key = super().register(fileobj, events, data)
  File "/usr/lib64/python3.6/selectors.py", line 237, in register
    key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
  File "/usr/lib64/python3.6/selectors.py", line 224, in _fileobj_lookup
    return _fileobj_to_fd(fileobj)
  File "/usr/lib64/python3.6/selectors.py", line 39, in _fileobj_to_fd
    "{!r}".format(fileobj)) from None
ValueError: Invalid file object: <_io.BufferedReader name=14>



without any logs on its log files.

I didn't investigate much but I think Meson is trying to use
a closed file.

The helper is supposed to be SUID so trying to kill it from
spice-client-lib code would be a no-op.

In the real (no mock) helper is specified that writing to
standard error is the wanted behaviour so using /dev/null
(or similar) would be a regression in spice-client-lib.

Maybe should be

"Meson waits for pipes (stdout and stderr) to be not readable but
our mocking helper does not close these handles causing Meson
to exit with a stack trace."

Note that the fact that the helper is not closing the handles
is a wanted behaviour.

> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> > ---
> >  tests/usb-acl-helper.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/tests/usb-acl-helper.c b/tests/usb-acl-helper.c
> > index 06f8036..310bdaf 100644
> > --- a/tests/usb-acl-helper.c
> > +++ b/tests/usb-acl-helper.c
> > @@ -15,6 +15,7 @@
> >     License along with this library; if not, see
> >     <http://www.gnu.org/licenses/>.
> >  */
> >  
> > +#include <stdio.h>
> >  #include <glib.h>
> >  #include "usb-acl-helper.h"
> >  
> > @@ -198,6 +199,13 @@ static void test_acl_helper_no_response(Fixture
> > *fixture, gconstpointer user_dat
> >  
> >  int main(int argc, char* argv[])
> >  {
> > +    /* Meson wait for stderr to be not readable so make sure the

Typo: wait -> waits

> > +     * helper does not keep the pipe open (this happens with current
> > +     * mock helper) */
> > +    if (freopen("usb-acl-helper-error.log", "w", stderr) == NULL) {
> > +        return 1;
> > +    }
> > +
> >      g_test_init(&argc, &argv, NULL);
> >  
> >      g_test_add("/usb-acl-helper/success", Fixture, NULL,
> > 
> 

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]