On Thu, Jan 11, 2018 at 3:24 AM, Johannes Schindelin
<johannes.schinde...@gmx.de> wrote:
>> 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.

Oh yeah. I did notice your remark about disk consumption but this was
a quick hack that I would not bother with it. For the record I'm
slightly bothered with many test programs too, not due to disk size
but because it increases link time (disk i/o probably also plays part
in that). This may help another thing... at the end of the mail

>> +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.

Another thing will make me move away from this style is, you can't
mark one test broken. In the end, we may have some macro that issue
one match() call per line, very similar to how t3070 does now. Then we
have more freedom in marking tests.

> 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.

Yeah, run_command() and stuff, not super hard (but then it opens up
another aspect I didn't address in this quick hack: collecting output
log of a test and only showing it when the test fails, could be
tricker to do in C than shell.

>> 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}" "$@"`?

No, test-lib.sh is required to set up $PATH properly so you can run
test programs without path. This is another sticky point. Some
integration with test-lib.sh is needed. I would like to have something
like this

-- 8< --
cat >t3071-wildmatch-c.sh <<EOF
#!/bin/sh
. ./test-lib.sh
EOF
-- 8< --

and test-lib.sh will take care of finding the right program, passing
the right test name as argument... (a single test program covering all
test groups, rather than one binary per test group, would simplify
things here). We need something though to let test-lib.sh know this is
C-based not shell to activate this mode. The "-c" suffix in the file
name is for that purpose, but maybe we will figure out something
better later. If it's too magical, this would do

-- 8< --
cat >t3071-wildmatch.sh <<EOF
#!/bin/sh

. ./test-lib.sh

exec_c_tests # new function defined in test-lib.sh
EOF
-- 8< --
-- 
Duy

Reply via email to