git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: git discussion list <git@vger.kernel.org>
Subject: [ANNOUNCE] git-test: run automated tests against a range of Git commits
Date: Fri, 6 Jan 2017 16:52:16 +0100	[thread overview]
Message-ID: <1341c01a-aca7-699c-c53a-28d048614bfe@alum.mit.edu> (raw)

I just released ⁠⁠⁠⁠`git test⁠⁠⁠⁠`, a script for running automated
tests across a range of Git commits and keeping track of the results in
git notes:

    https://github.com/mhagger/git-test

This is a script that I've been using in one form or another for years
and I find it really handy [1].

`git-test` is meant for people who want *all* of their commits (not just
the branch tip) to pass their automated tests.

Tl;dr: How to use `git test`

1.  Define the test you want to run. The string can be any shell
    command:

        git test add "make -j8 && make -j16 test"

2.  Create a separate linked worktree in which to run your tests:

        git worktree add --detach ../test HEAD

3.  Create a terminal window and `cd` to the directory containing
    the testing worktree, and run the test against all of the commits
    on your branch:

        cd ../test
        git test range master..mybranch

    If any of the commits are broken, `git tree` will display the
    error then stop with that commit checked out.

4.  As you work, whenever you want to test new commits, go to the
    testing terminal window and run the same command again:

        git test range master..mybranch

    `git test` is smart enough to remember which commits (actually,
    trees) have already been tested and only run the test against
    commits that have been changed or added. And since the tests are
    run in a different worktree, you can continue working in your
    main working directory while the tests run.

It is also possible to define more than one test suite in a given
repository, retry tests, etc. Type `git test help` or read the `README`
file [2] for more information.

`git test` stores the test results in git notes (under
`refs/notes/test/<name>`), linked to the commit's tree SHA-1. This means
that test results remain valid even across some kinds of commit
rewriting, like changes to commit metadata or squashing adjacent
commits, and a subset of results even remains valid if a commit is split
or if some commits earlier in a patch series are reordered.

I don't plan to turn this into a gigantic project or anything, but I
find this script really useful so I wanted to put it out in the world.
Feedback and/or pull requests welcome!

Michael

[1] The name sucks, I know :-/
[2] https://github.com/mhagger/git-test/blob/master/README.md


             reply	other threads:[~2017-01-06 15:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 15:52 Michael Haggerty [this message]
2017-01-07  7:18 ` [ANNOUNCE] git-test: run automated tests against a range of Git commits Jeff King
2017-01-08  9:52   ` Michael Haggerty
2017-01-10  9:35     ` Jeff King
2017-01-12  5:02       ` Michael Haggerty

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=1341c01a-aca7-699c-c53a-28d048614bfe@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    /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).