git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Lars Schneider <larsxschneider@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, sschuberth@gmail.com,
	ramsay@ramsayjones.plus.com, sunshine@sunshineco.com,
	hvoigt@hvoigt.net, sbeller@google.com,
	Johannes.Schindelin@gmx.de, gitster@pobox.com
Subject: Re: [PATCH v4 0/3] config: add '--sources' option to print the source of a config value
Date: Tue, 16 Feb 2016 10:40:34 +0100	[thread overview]
Message-ID: <186152EC-C19A-464E-A81B-B614E56AF1DE@gmail.com> (raw)
In-Reply-To: <20160215180552.GC26443@sigill.intra.peff.net>


On 15 Feb 2016, at 19:05, Jeff King <peff@peff.net> wrote:

> On Mon, Feb 15, 2016 at 11:17:43AM +0100, larsxschneider@gmail.com wrote:
> 
>> I like the idea of a "test set up block" within a test script. In order
>> to clean up nicely before any subsequent tests I would like to propose
>> a "tear down" block. Would that work as a compromise in our "test cases
>> depend on earlier test cases" discussion?
> 
> I don't have any real problem with what you've written in the final
> patch, but I also don't think it's accomplishing much (and is more lines
> of code, and more running processes).
> 
> If you want to run test N without having run all of 1..N-1, what you
> really want is some known, reliable state when that test starts. But the
> tests before it do not necessarily know what that state is.  The best
> they can do is roughly restore the original state before they ran. But:
> 
>  1. What does the state consist of? Which files (and their contents)
>     are important to the test?
> 
>     In your tear-down you get rid of $INCLUDE_DIR, and you zero-out the
>     config files. But you leave expect, output, output.raw, and the
>     oddly named $CUSTOM_CONFIG_FILE. Nor do you clean up the
>     environment variables.
Good argument - I can't disagree.

> 
>     To be clear, I think it's perfectly fine to leave those. But you
>     are still making assumptions about what the next test relies on.
> 
>  2. We may create a clean slate, but that is probably not what the next
>     test wants. It will want to do its own setup. I.e., it will
>     probably not want a blank .git/config, and will create it itself,
>     just as you did in your setup step.
> 
> So rather than tearing down, I think we are better off trying to make
> tests themselves (or blocks of them) set up their own assumptions. E.g.,
> by overwriting files rather than appending to them. By using unique
> filenames, commit messages, etc for their tests. That's less of a big
> deal here, but in many tests that create commits, "test_commit foo"
> would fail a second time, because there are no changes to "foo". Doing
> "test_commit subdir/check-diff-in-subdir" is less likely to clash
> without another test.
> 
> Sometimes we _are_ better off with a teardown step, because subsequent
> tests would not reasonably think to clear some state we've set (e.g., in
> non-config tests, if we set some random config variable, we use
> test_config to tear it down afterwards rather than have each test clean
> out all of the config). So there's definitely a subjective judgement
> call on what is "reasonable" there. But I find it unlikely that your
> tear-down will help anybody in this case. Further tests will not care
> about $INCLUDE_DIR unless they reference it, and any further tests would
> set up their own .git/config, etc.

OK, I will remove the block in the next roll. Thanks for explaining
your thoughts on this.

- Lars

      reply	other threads:[~2016-02-16  9:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 10:17 [PATCH v4 0/3] config: add '--sources' option to print the source of a config value larsxschneider
2016-02-15 10:17 ` [PATCH v4 1/3] t: do not hide Git's exit code in tests larsxschneider
2016-02-15 17:41   ` Jeff King
2016-02-16  9:36     ` Lars Schneider
2016-02-15 10:17 ` [PATCH v4 2/3] config: add 'type' to config_source struct that identifies config type larsxschneider
2016-02-15 17:42   ` Jeff King
2016-02-16 22:07     ` Ramsay Jones
2016-02-15 21:30   ` Ramsay Jones
2016-02-17 13:12   ` Johannes Schindelin
2016-02-18  8:46     ` Lars Schneider
2016-02-15 10:17 ` [PATCH v4 3/3] config: add '--show-origin' option to print the origin of a config value larsxschneider
2016-02-15 18:06   ` Jeff King
2016-02-15 20:58   ` Eric Sunshine
2016-02-15 21:03     ` Jeff King
2016-02-17  8:32     ` Lars Schneider
2016-02-17 16:39       ` Junio C Hamano
2016-02-15 21:36   ` Ramsay Jones
2016-02-15 21:40     ` Jeff King
2016-02-15 22:39       ` Ramsay Jones
2016-02-16  9:51         ` Lars Schneider
2016-02-16 16:46           ` Ramsay Jones
2016-02-16 17:38             ` Jeff King
2016-02-16 22:14               ` Ramsay Jones
2016-02-16 22:17                 ` Jeff King
2016-02-15 21:41     ` Junio C Hamano
2016-02-16  9:48       ` Lars Schneider
2016-02-15 22:18   ` Junio C Hamano
2016-02-15 22:59     ` Jeff King
2016-02-15 23:56       ` Junio C Hamano
2016-02-16  9:52         ` Lars Schneider
2016-02-15 18:05 ` [PATCH v4 0/3] config: add '--sources' option to print the source " Jeff King
2016-02-16  9:40   ` Lars Schneider [this message]

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=186152EC-C19A-464E-A81B-B614E56AF1DE@gmail.com \
    --to=larsxschneider@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    --cc=peff@peff.net \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=sbeller@google.com \
    --cc=sschuberth@gmail.com \
    --cc=sunshine@sunshineco.com \
    /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).