<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/lib-git-daemon.sh, branch v2.20.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.20.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.20.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-11-27T00:53:58Z</updated>
<entry>
<title>t/lib-git-daemon: fix signal checking</title>
<updated>2018-11-27T00:53:58Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2018-11-26T20:03:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4c2eb06419e95554b3530c618b55c5cdc687f621'/>
<id>urn:sha1:4c2eb06419e95554b3530c618b55c5cdc687f621</id>
<content type='text'>
Test scripts checking 'git daemon' stop the daemon with a TERM signal,
and the 'stop_git_daemon' helper checks the daemon's exit status to
make sure that it indeed died because of that signal.

This check is bogus since 03c39b3458 (t/lib-git-daemon: use
test_match_signal, 2016-06-24), for two reasons:

  - Right after killing 'git daemon', 'stop_git_daemon' saves its exit
    status in a variable, but since 03c39b3458 the condition checking
    the exit status looks at '$?', which at this point is not the exit
    status of 'git daemon', but that of the variable assignment, i.e.
    it's always 0.

  - The unexpected exit status should abort the whole test script with
    'error', but it doesn't, because 03c39b3458 forgot to negate
    'test_match_signal's exit status in the condition.

This patch fixes both issues.

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/lib-git-daemon: add network-protocol helpers</title>
<updated>2018-01-25T21:50:17Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-01-25T00:58:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4414a150025765bdf83df81026270b0acbb8b376'/>
<id>urn:sha1:4414a150025765bdf83df81026270b0acbb8b376</id>
<content type='text'>
All of our git-protocol tests rely on invoking the client
and having it make a request of a server. That gives a nice
real-world test of how the two behave together, but it
doesn't leave any room for testing how a server might react
to _other_ clients.

Let's add a few test helper functions which can be used to
manually conduct a git-protocol conversation with a remote
git-daemon:

  1. To connect to a remote git-daemon, we need something
     like "netcat". But not everybody will have netcat. And
     even if they do, the behavior with respect to
     half-duplex shutdowns is not portable (openbsd netcat
     has "-N", with others you must rely on "-q 1", which is
     racy).

     Here we provide a "fake_nc" that is capable of doing
     a client-side netcat, with sane half-duplex semantics.
     It relies on perl's IO::Socket::INET. That's been in
     the base distribution since 5.6.0, so it's probably
     available everywhere. But just to be on the safe side,
     we'll add a prereq.

  2. To help tests speak and read pktline, this patch adds
     packetize() and depacketize() functions.

I've put fake_nc() into lib-git-daemon.sh, since that's
really the only server where we'd need to use a network
socket.  Whereas the pktline helpers may be of more general
use, so I've added them to test-lib-functions.sh. Programs
like upload-pack speak pktline, but can talk directly over
stdio without a network socket.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/lib-git-daemon: record daemon log</title>
<updated>2018-01-25T21:50:03Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-01-25T19:16:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=314a73d6585bf9caecac3243f7de2d7330e1ff9f'/>
<id>urn:sha1:314a73d6585bf9caecac3243f7de2d7330e1ff9f</id>
<content type='text'>
When we start git-daemon for our tests, we send its stderr
log stream to a named pipe. We synchronously read the first
line to make sure that the daemon started, and then dump the
rest to descriptor 4. This is handy for debugging test
output with "--verbose", but the tests themselves can't
access the log data.

Let's dump the log into a file, as well, so that future
tests can check the log. There are a few subtleties worth
calling out here:

  - we'll continue to send output to descriptor 4 for
    viewing/debugging, which would imply swapping out "cat"
    for "tee". But we want to ensure that there's no
    buffering, and "tee" doesn't have a standard way to
    ask for that. So we'll use a shell loop around "read"
    and "printf" instead. That ensures that after a request
    has been served, the matching log entries will have made
    it to the file.

  - the existing first-line shell loop used read/echo. We'll
    switch to consistently using "read -r" and "printf" to
    relay data as faithfully as possible.

  - we open the logfile for append, rather than just output.
    That makes it OK for tests to truncate the logfile
    without restarting the daemon (the OS will atomically
    seek to the end of the file when outputting each line).
    That allows tests to look at the log without worrying
    about pollution from earlier tests.

Helped-by: Lucas Werkmeister &lt;mail@lucaswerkmeister.de&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/interop: add test of old clients against modern git-daemon</title>
<updated>2017-03-10T22:30:25Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-02-25T09:37:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bd4d9d993c1202615178f86a947a5c63e706860f'/>
<id>urn:sha1:bd4d9d993c1202615178f86a947a5c63e706860f</id>
<content type='text'>
This test just checks that old clients can clone and fetch
from a newer git-daemon. The opposite should also be true,
but it's hard to test ancient versions of git-daemon because
they lack basic options like "--listen".

Note that we have to make a slight tweak to the
lib-git-daemon helper from the regular tests, so that it
starts the daemon with our correct git.a version.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/lib-git-daemon: use test_match_signal</title>
<updated>2016-07-06T14:44:25Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-06-24T19:45:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=03c39b34589897824385c884cd9c5707ba93a238'/>
<id>urn:sha1:03c39b34589897824385c884cd9c5707ba93a238</id>
<content type='text'>
When git-daemon exits, we expect it to be with the SIGTERM
we just sent it. If we see anything else, we'll complain.
But our check against exit code "143" is not portable. For
example:

  $ ksh93 t5570-git-daemon.sh
  [...]
  error: git daemon exited with status: 271

We can fix this by using test_match_signal.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tests: turn off git-daemon tests if FIFOs are not available</title>
<updated>2016-01-28T21:35:54Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2016-01-27T16:19:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a390d7e8f96fbc40e8eaf5180e3e1422f5d7ddc2'/>
<id>urn:sha1:a390d7e8f96fbc40e8eaf5180e3e1422f5d7ddc2</id>
<content type='text'>
The Git daemon tests create a FIFO first thing and will hang if said
FIFO is not available.

This is a problem with Git for Windows, where `mkfifo` is an MSYS2
program that leverages MSYS2's POSIX emulation layer, but
`git-daemon.exe` is a MINGW program that has not the first clue about
that POSIX emulation layer and therefore blinks twice when it sees
MSYS2's emulated FIFOs and then just stares into space.

This lets t5570-git-daemon.sh and t5811-proto-disable-git.sh pass.

Signed-off-by: Stepan Kasal &lt;kasal@ucw.cz&gt;
Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/run-network-tests-by-default'</title>
<updated>2014-03-05T23:06:45Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-03-05T23:06:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ee3a81e69cde27add025e206cd9dd2937c80f230'/>
<id>urn:sha1:ee3a81e69cde27add025e206cd9dd2937c80f230</id>
<content type='text'>
Teach "make test" to run networking tests when possible by default.

* jk/run-network-tests-by-default:
  tests: turn on network daemon tests by default
</content>
</entry>
<entry>
<title>tests: turn on network daemon tests by default</title>
<updated>2014-02-14T16:13:51Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-02-10T21:29:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=83d842dc8ce4380aa365485b4d9845762f80c6db'/>
<id>urn:sha1:83d842dc8ce4380aa365485b4d9845762f80c6db</id>
<content type='text'>
We do not run the httpd nor git-daemon tests by default, as
they are rather heavyweight and require network access
(albeit over localhost). However, it would be nice if more
pepole ran them, for two reasons:

  1. We would get more test coverage on more systems.

  2. The point of the test suite is to find regressions. It
     is very easy to change some of the underlying code and
     break the httpd code without realizing you are even
     affecting it. Running the httpd tests helps find these
     problems sooner (ideally before the patches even hit
     the list).

We still want to leave an "out", though, for people who really do
not want to run them. For that reason, the GIT_TEST_HTTPD and
GIT_TEST_GIT_DAEMON variables are now tri-state booleans
(true/false/auto), so you can say GIT_TEST_HTTPD=false to turn the
tests back off.  To support those who want a stable single way to
disable these tests across versions of Git before and after this
change, an empty string explicitly set to these variables is also
taken as "false", so the behaviour changes only for those who:

  a. did not express any preference by leaving these variables
     unset.  They did not test these features before, but now they
     do; or

  b. did express that they want to test these features by setting
     GIT_TEST_FEATURE=false (or any equivalent other ways to tell
     "false" to Git, e.g. "0"), which has been a valid but funny way
     to say that they do want to test the feature only because we
     used to interpret any non-empty string to mean "yes please
     test".  They no longer test that feature.

In addition, we are forgiving of common setup failures (e.g., you do
not have apache installed, or have an old version) when the
tri-state is "auto" (or unset), but report an error when it is
"true". This makes "auto" a sane default, as we should not cause
failures on setups where the tests cannot run. But it allows people
who use "true" to catch regressions in their system (e.g., they
uninstalled apache, but were expecting their automated test runs to
test git-httpd, and would want to be notified).

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tests: auto-set git-daemon port</title>
<updated>2014-02-10T19:19:39Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-02-10T19:16:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c44132fcf383cf668d3764c6b7ad28ff034ee981'/>
<id>urn:sha1:c44132fcf383cf668d3764c6b7ad28ff034ee981</id>
<content type='text'>
A recent commit taught lib-httpd to always start apache on
the same port as the numbered tests. Let's do the same for
the git-daemon tests.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>test: replace shebangs with descriptions in shell libraries</title>
<updated>2013-11-26T22:23:52Z</updated>
<author>
<name>Jonathan Nieder</name>
<email>jrnieder@gmail.com</email>
</author>
<published>2013-11-25T21:03:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c74c72034f061d1d9d5b8b1fba20ce0138d423b4'/>
<id>urn:sha1:c74c72034f061d1d9d5b8b1fba20ce0138d423b4</id>
<content type='text'>
A #! line in these files is misleading, since these scriptlets are
meant to be sourced with '.' (using whatever shell sources them)
instead of run directly using the interpreter named on the #! line.

Removing the #! line shouldn't hurt syntax highlighting since
these files have filenames ending with '.sh'.  For documentation,
add a brief description of how the files are meant to be used in
place of the shebang line.

Signed-off-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
