Hi Duy, On Wed, 10 Jan 2018, Duy Nguyen wrote: > On Mon, Jan 08, 2018 at 01:25:04PM +0100, Johannes Schindelin wrote: > > I agree that it would make a ton of sense to use a proper, portable test > > framework written in pure, portable C. > > > > However, this ship has long sailed, hasn't it? > > If you meant converting the whole test suite, oh yeah that's not gonna > happen. But it's still possible to have some tests written in C. True. > I played a bit with this. The assumption is if it's agreed that we can > get something bare bone (but functional) in then we could start having > more and more C-based unit tests in future and also improve the C > framework to be on par with shell one on the side. We can also start with something small that does not contend to replace the entire test suite, and evolve from there as we have time. Your initial patch looks very good, I will give it a cursory review (only cursory because we are technically in a feature-freeze...) > diff --git a/Makefile b/Makefile > index 2a81ae22e9..567387b558 100644 > --- a/Makefile > +++ b/Makefile > @@ -644,6 +644,7 @@ X = > > PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS)) > > +TEST_PROGRAMS_NEED_X += test-3071-wildmatch I guess I can always work on unifying those gazillion of test executables into a single one later. For testing purposes, I have to bundle them (BusyBox-based MinGit is supposed to be stand-alone, yet I want to test it to verify that it works even if it ships only a subset of Git for Windows), and they dominate the payload of any prerelease, as you can see e.g. here: https://github.com/git-for-windows/git/releases/tag/v2.16.0-rc1.windows.1 > diff --git a/t/helper/test-3071-wildmatch.c b/t/helper/test-3071-wildmatch.c > new file mode 100644 > index 0000000000..24a657202d > --- /dev/null > +++ b/t/helper/test-3071-wildmatch.c > @@ -0,0 +1,273 @@ > +#include "cache.h" > +#include "test-lib.h" > + > +struct match_input { > + int expect_true; > + const char *text; > + const char *pattern; > +}; > + > +static struct match_input match_tests[] = { > + /* Basic wildmatch features */ > + { 1, "foo", "foo" }, > + { 0, "foo", "bar" }, > + { 1, "", "" }, These patterns share the "magic-ness" of Ævar's test cases... although your version is certainly more concise. BTW IIRC Ævar explicitly said that he needs to use `ls-files` in order to test the interaction with the index, so that would probably take a little bit more work. > diff --git a/t/t3071-wildmatch.sh b/t/t3071-wildmatch.sh > new file mode 100755 > index 0000000000..6e83b4d684 > --- /dev/null > +++ b/t/t3071-wildmatch.sh > @@ -0,0 +1,3 @@ > +#!/bin/sh > + > +exec helper/test-3071-wildmatch t3071-wildmatch "$@" Should it not be `exec test-3071-wildmatch "${0%.sh}" "$@"`? > diff --git a/test-lib.c b/test-lib.c > new file mode 100644 > index 0000000000..8e8b7cd6df > --- /dev/null > +++ b/test-lib.c > @@ -0,0 +1,97 @@ > [...] Lots of good stuff in there. Definitely a good start. Ciao, Dscho