git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] t/Makefile: add a rule to re-run previously-failed tests
Date: Tue, 30 Aug 2016 04:43:57 -0400	[thread overview]
Message-ID: <20160830084357.rdmt2ehngrz6rqaq@sigill.intra.peff.net> (raw)
In-Reply-To: <0dfa96b17edfe84ba19c7e57fe0b017c77943e0c.1472478285.git.johannes.schindelin@gmx.de>

On Mon, Aug 29, 2016 at 03:46:05PM +0200, Johannes Schindelin wrote:

> Note that we need to be careful to inspect only the *newest* entries in
> test-results/: this directory contains files of the form
> tNNNN-<name>-<pid>.counts and is only removed wholesale when running the
> *entire* test suite, not when running individual tests. We ensure that
> with a little sed magic on `ls -t`'s output that simply skips lines
> when the file name was seen earlier.

Hmm, interesting. Your approach seems reasonable, but I have to wonder
if writing the pid in the first place is sane.

I started to write up my reasoning in this email, but realized it was
rapidly becoming the content of a commit message. So here is that
commit.

-- >8 --
Subject: [PATCH] test-lib: drop PID from test-results/*.count

Each test run generates a "count" file in t/test-results
that stores the number of successful, failed, etc tests.
If you run "t1234-foo.sh", that file is named as
"t/test-results/t1234-foo-$$.count"

The addition of the PID there is serving no purpose, and
makes analysis of the count files harder.

The presence of the PID dates back to 2d84e9f (Modify
test-lib.sh to output stats to t/test-results/*,
2008-06-08), but no reasoning is given there. Looking at the
current code, we can see that other files we write to
test-results (like *.exit and *.out) do _not_ have the PID
included. So the presence of the PID does not meaningfully
allow one to store the results from multiple runs anyway.

Moreover, anybody wishing to read the *.count files to
aggregate results has to deal with the presence of multiple
files for a given test (and figure out which one is the most
recent based on their timestamps!). The only consumer of
these files is the aggregate.sh script, which arguably gets
this wrong. If a test is run multiple times, its counts will
appear multiple times in the total (I say arguably only
because the desired semantics aren't documented anywhere,
but I have trouble seeing how this behavior could be
useful).

So let's just drop the PID, which fixes aggregate.sh, and
will make new features based around the count files easier
to write.

Note that since the count-file may already exist (when
re-running a test), we also switch the "cat" from appending
to truncating. The use of append here was pointless in the
first place, as we expected to always write to a unique file.

Signed-off-by: Jeff King <peff@peff.net>
---
The presence of the append, combined with the way aggregate.sh is
written makes me wonder if the intent was to store multiple run results
for each test in a single file (and aggregate would just report the last
one). Which _still_ makes the use of the PID wrong. But again, I don't
see much use for it.

 t/test-lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index d731d66..eada492 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -687,9 +687,9 @@ test_done () {
 		test_results_dir="$TEST_OUTPUT_DIRECTORY/test-results"
 		mkdir -p "$test_results_dir"
 		base=${0##*/}
-		test_results_path="$test_results_dir/${base%.sh}-$$.counts"
+		test_results_path="$test_results_dir/${base%.sh}.counts"
 
-		cat >>"$test_results_path" <<-EOF
+		cat >"$test_results_path" <<-EOF
 		total $test_count
 		success $test_success
 		fixed $test_fixed
-- 
2.10.0.rc2.123.ga991f9e


  reply	other threads:[~2016-08-30  8:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29  7:02 [PATCH] t/Makefile: add a rule to re-run previously-failed tests Johannes Schindelin
2016-06-29 17:18 ` Junio C Hamano
2016-07-01 13:57   ` Johannes Schindelin
2016-06-30  6:37 ` Jeff King
2016-07-01 14:00   ` Johannes Schindelin
2016-08-29 13:46 ` [PATCH v2] " Johannes Schindelin
2016-08-30  8:43   ` Jeff King [this message]
2016-08-30 19:15     ` Junio C Hamano
2016-08-31 10:36       ` Johannes Schindelin
2016-09-01  3:59         ` Sverre Rabbelier
2016-09-01  8:27           ` Johannes Schindelin
2016-09-01 16:57             ` Sverre Rabbelier
2016-09-01 22:52               ` Junio C Hamano
2016-09-02  7:35                 ` Johannes Schindelin
2016-09-08 20:34                   ` Junio C Hamano
2016-08-30 20:48   ` Ævar Arnfjörð Bjarmason
2016-08-30 20:51     ` Jeff King
2016-08-30 20:58       ` Ævar Arnfjörð Bjarmason
2016-08-31 10:29         ` Johannes Schindelin
2016-08-31 13:42           ` Ævar Arnfjörð Bjarmason
2016-08-31 15:05             ` Johannes Schindelin
2016-09-02 10:25               ` Ævar Arnfjörð Bjarmason
2016-09-02 12:08                 ` Johannes Schindelin
2016-09-02 16:36                   ` Matthieu Moy
2016-09-04  7:55                     ` Johannes Schindelin
2016-09-04  9:19                       ` Matthieu Moy
2017-01-27 14:17   ` [PATCH v3] " Johannes Schindelin
2017-01-27 17:07     ` Jeff King
2017-01-27 17:21       ` Johannes Schindelin
2017-01-27 17:21     ` [PATCH v4] " Johannes Schindelin
2017-01-27 18:53       ` Junio C Hamano
2017-01-30 15:35         ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160830084357.rdmt2ehngrz6rqaq@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).