[Top][All Lists]

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

Re: master 8dcb19f 4/4: Add a unit test testing interaction between thre

From: Philipp Stephani
Subject: Re: master 8dcb19f 4/4: Add a unit test testing interaction between threads and processes.
Date: Sun, 24 Jan 2021 14:22:57 +0100

Am So., 24. Jan. 2021 um 06:26 Uhr schrieb Eli Zaretskii <eliz@gnu.org>:
> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Sat, 23 Jan 2021 21:33:29 +0100
> > Cc: Philipp Stephani <phst@google.com>, Emacs developers 
> > <emacs-devel@gnu.org>
> >
> > > Can you describe the idea of the test,
> >
> > This test essentially implements your request to verify the
> > interactions between the self-pipe for SIGCHLD and threads. Seems it
> > discovered some issues on Windows instead! The test works fine on
> > GNU/Linux and macOS.
> Thanks, but this doesn't really answer my question.  I think I
> understand what the code does, but I don't know what was the intent in
> writing it.

Right now we don't have that many good tests that test the interaction
between threads and processes, so the intention of this test is to
improve coverage in this area.

>  There are some things the code does whose rationale I
> don't understand.  For example, why the call to set-process-thread:
> what's the purpose?

The test wouldn't work without it, because it calls
accept-process-output from a thread different from the thread in which
the process was created.

>  Or why no-conversion in make-process?

Unit tests should typically test only one aspect, or a small number of
related aspects of the system under test. The goal of this test is not
to test the encoding procedures, so I turn off encoding here.

>  More
> generally, what is the basic idea of the test and the expectation
> from each thread.

I don't understand this question. The idea is to have a test that
calls accept-process-output from multiple threads to increase coverage
in this area.

> > > and in particular why did you
> > > expect the threads to start running?  IOW, which part of this test is
> > > supposed to force the main thread to yield so that one of the other
> > > threads starts running?
> >
> > thread-join should yield.
> Isn't that too late?  The processes have exited already, so what does
> that test?

Again, I don't understand this question. Each unit test is a runnable
example: by writing it, we document some aspect about how Emacs Lisp
should behave, and by running it, we can find bugs (mismatches between
the intended and the actual behavior) and regressions.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]