threads / announce / 31042

[ANNOUNCE] Sharness - Test library derived from Git

Subject: [ANNOUNCE] Sharness - Test library derived from Git

## tl;dr

5 messages between Jul 17, 2012 and Jul 20, 2012.

replies: 4people: 4as markdown or json

Mathias Lafeldt· Jul 17, 2012, 08:06 UTC · lore
Hi,

I've been wanting to announce Sharness [1] on this list for quite some time now, but never managed to do so. With the release of version 0.2.4, I think it's about time to change that.

Sharness is a shell-based test harness library. It was derived from the Git project and is basically a generalized and stripped-down version of t/test-lib.sh (I basically removed all things specific to Git). So when you know how to write tests for Git, it should be very familiar.

I've been using Sharness to test my command-line applications [2] for over a year now. It's especially useful when you're doing continuous integration with a service like Travis CI [3].

Development of Sharness takes place at GitHub [4]. If you're interested, there might be some things I could contribute back to Git, e.g. the API documentation [5] I wrote in TomDoc format.

Looking forward to your feedback.

[1] http://mlafeldt.github.com/sharness [2] https://github.com/mlafeldt/sharness#projects-using-sharness [3] http://travis-ci.org/ [4] https://github.com/mlafeldt/sharness [5] https://github.com/mlafeldt/sharness/blob/master/API.md

-Mathias
Ævar Arnfjörð Bjarmason· Jul 17, 2012, 18:31 UTC · re: Mathias Lafeldt · lore

Re: [ANNOUNCE] Sharness - Test library derived from Git

On Tue, Jul 17, 2012 at 10:06 AM, Mathias Lafeldt <mathias.lafeldt@gmail.com> wrote:

Show 9 quoted lines
> I've been wanting to announce Sharness [1] on this list for quite some
> time now, but never managed to do so. With the release of version
> 0.2.4, I think it's about time to change that.
>
> Sharness is a shell-based test harness library. It was derived from
> the Git project and is basically a generalized and stripped-down
> version of t/test-lib.sh (I basically removed all things specific to
> Git). So when you know how to write tests for Git, it should be very
> familiar.
Nice, I thought about doing something like this myself but never had the time.

Perhaps to avoid duplication we could move to this and keep Git-specific function in some other file.

Do you think that would be sensible, and would you be willing to submit patches for that?

Mathias Lafeldt· Jul 20, 2012, 10:18 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: [ANNOUNCE] Sharness - Test library derived from Git

On Tue, Jul 17, 2012 at 8:31 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

> Nice, I thought about doing something like this myself but never had the time.

Thanks. Took quite some time to take out the Git-specific functionality. And there's still a lot of room for improvement.

> Perhaps to avoid duplication we could move to this and keep
> Git-specific function in some other file.

That would be fantastic! From a technical point of view, it would make a lot of sense to join forces here.

How do you think would Sharness fit into the Git project? Is adding it as an external dependency an option?

Let's share some ideas before getting to it.
> Do you think that would be sensible, and would you be willing to
> submit patches for that?

While I haven't touched the names of the test functions, I renamed most of the global shell variables, e.g. GIT_TEST_OPTS to TEST_OPTS and TEST_DIRECTORY to SHARNESS_TEST_DIRECTORY. That might be a (minor) problem.

As for the patches: absolutely. I'd really love to give something back to Git.
-Mathias
Matthieu Moy· Jul 20, 2012, 11:45 UTC · re: Mathias Lafeldt · lore

Re: [ANNOUNCE] Sharness - Test library derived from Git

Mathias Lafeldt <mathias.lafeldt@gmail.com> writes:
Show 8 quoted lines
> On Tue, Jul 17, 2012 at 8:31 PM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>
>> Perhaps to avoid duplication we could move to this and keep
>> Git-specific function in some other file.
>
> That would be fantastic! From a technical point of view, it would make
> a lot of sense to join forces here.

Seems to be a reasonable goal, yes. The test harness in Git keeps improving, and Sharness is likely to improve also, it would be a pity to have them diverge and not benefit from each other.

> How do you think would Sharness fit into the Git project? Is adding it
> as an external dependency an option?

It would be nice if the code sharing did not result in extra pain for users and testers, so "external dependency" in the sense "not included in git.git and ask the user to install it" is IMHO a bad idea. Increasing the effort needed to run the testsuite means more people will give up before running it :-(.

OTOH, having it leave in a subdirectory (e.g. $git/t/Sharness/), and synchronize with stg like subtree merge would be nice for the user. We already have something similar for gitk and git-gui, except that the synchronization is normally one way (subprojects merged into Git, but merging back changes that were made in git.git in these subprojects is more painful).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
dag@cray.com· Jul 20, 2012, 21:11 UTC · re: Matthieu Moy · lore

Re: [ANNOUNCE] Sharness - Test library derived from Git

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 6 quoted lines
> OTOH, having it leave in a subdirectory (e.g. $git/t/Sharness/), and
> synchronize with stg like subtree merge would be nice for the user. We
> already have something similar for gitk and git-gui, except that the
> synchronization is normally one way (subprojects merged into Git, but
> merging back changes that were made in git.git in these subprojects is
> more painful).
Not really.  contrib/git-subtree can really help with this.
                           -Dave

← back to recent threads