git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 7/7] wildmatch test: create & test files on disk in addition to in-memory

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 3, 2018, 19:14 UTC
Message-ID
<87d12qdaa5.fsf@evledraar.gmail.com>
In-Reply-To
<20180103144149.GE29210@dinwoodie.org>
On Wed, Jan 03 2018, Adam Dinwoodie jotted:
Show 65 quoted lines
> On Wednesday 03 January 2018 at 02:31 pm +0100, Ævar Arnfjörð Bjarmason wrote:
>>
>> On Wed, Jan 03 2018, Adam Dinwoodie jotted:
>>
>> > On Monday 25 December 2017 at 12:28 am +0000, Ævar Arnfjörð Bjarmason wrote:
>> >> There has never been any full roundtrip testing of what git-ls-files
>> >> and other functions that use wildmatch() actually do, rather we've
>> >> been satisfied with just testing the underlying C function.
>> >>
>> >> Due to git-ls-files and friends having their own codepaths before they
>> >> call wildmatch() there's sometimes differences in the behavior between
>> >> the two, and even when we test for those (as with
>> >> 9e4e8a64c2 ("pathspec: die on empty strings as pathspec", 2017-06-06))
>> >> there was no one place where you can review how these two modes
>> >> differ.
>> >>
>> >> Now there is. We now attempt to create a file called $haystack and
>> >> match $needle against it for each pair of $needle and $haystack that
>> >> we were passing to test-wildmatch.
>> >>
>> >> If we can't create the file we skip the test. This ensures that we can
>> >> run this on all platforms and not maintain some infinitely growing
>> >> whitelist of e.g. platforms that don't support certain characters in
>> >> filenames.
>> >>
>> >> As a result of doing this we can now see the cases where these two
>> >> ways of testing wildmatch differ:
>> >>
>> >>  * Creating a file called 'a[]b' and running ls-files 'a[]b' will show
>> >>    that file, but wildmatch("a[]b", "a[]b") will not match
>> >>
>> >>  * wildmatch() won't match a file called \ against \, but ls-files
>> >>    will.
>> >>
>> >>  * `git --glob-pathspecs ls-files 'foo**'` will match a file
>> >>    'foo/bba/arr', but wildmatch won't, however pathmatch will.
>> >>
>> >>    This seems like a bug to me, the two are otherwise equivalent as
>> >>    these tests show.
>> >>
>> >> This also reveals the case discussed in 9e4e8a64c2 above, where '' is
>> >> now an error as far as ls-files is concerned, but wildmatch() itself
>> >> happily accepts it.
>> >>
>> >> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> >
>> > I'm seeing this test script failing on the pu branch as a result of this
>> > commit when building on Cygwin.  Specifically, the test fails at
>> > 9d45e1ca4 ("Merge branch 'bw/oidmap-autoinit' into pu", 2017-12-28), and
>> > bisecting points the blame at 2ee0c785a ("wildmatch test: create & test
>> > files on disk in addition to in-memory", 2017-12-25).
>> >
>> > I've copied the verbose error output for the first error below, and
>> > uploaded the full output, including verbose and trace output for the
>> > unexpectedly failing tests, at [0].  (With 42 failures among 1512 tests,
>> > there's a lot of it, so I didn't want to include it in an email.)
>>
>> Does the fixup above in <878tdm8k2d.fsf@evledraar.gmail.com> work for
>> you, i.e. changing $10 in the script to ${10}?
>
> This fixes some but not all of the failures: I'm now down from 42 to 24
> failures.
>
> Updated verbose test output is at
> https://gist.github.com/me-and/04443bcb00e12436f0eacce079b56d02

Thanks lot, looking through our own commit logs I believe the rest should be fixed by this (prior art in 6fd1106aa4), it would be great if you could test it, I don't have access to a Windows machine:

    diff --git a/t/t3070-wildmatch.sh b/t/t3070-wildmatch.sh
    index f985139b6f..5838fcb77d 100755
    --- a/t/t3070-wildmatch.sh
    +++ b/t/t3070-wildmatch.sh
    @@ -23,6 +23,15 @@ create_test_file() {
            *//*)
                    return 1
                    ;;
    +       # On Windows, \ in paths is silently converted to /, which
    +       # would result in the "touch" below working, but the test
    +       # itself failing.
    +       *\\*)
    +               if ! test_have_prereq BSLASHPSPEC
    +               then
    +                       return 1
    +               fi
    +               ;;
            # When testing the difference between foo/bar and foo/bar/ we
            # can't test the latter.
            */)
Previous: Adam DinwoodieNext: Adam Dinwoodie
Message 25 of 73 in “increase wildmatch test coverage”
  1. 0/6 increase wildmatch test coverageÆvar Arnfjörð Bjarmason, Dec 23, 2017
  2. 2/6 wildmatch test: use more standard shell styleÆvar Arnfjörð Bjarmason, Dec 23, 2017
  3. 1/6 wildmatch test: indent with tabs, not spacesÆvar Arnfjörð Bjarmason, Dec 23, 2017
  4. 3/6 wildmatch test: use a paranoia pattern from nul_match()Ævar Arnfjörð Bjarmason, Dec 23, 2017
  5. 4/6 wildmatch test: remove dead fnmatch() test codeÆvar Arnfjörð Bjarmason, Dec 23, 2017
  6. 5/6 wildmatch test: perform all tests under all wildmatch() modesÆvar Arnfjörð Bjarmason, Dec 23, 2017
  7. 6/6 wildmatch test: create & test files on disk in addition to in-memoryÆvar Arnfjörð Bjarmason, Dec 23, 2017
  8. Johannes SixtDec 24, 2017
  9. Ævar Arnfjörð BjarmasonDec 24, 2017
  10. Johannes SixtDec 24, 2017
  11. 0/7 increase wildmatch test coverageÆvar Arnfjörð Bjarmason, Dec 25, 2017
  12. 1/7 wildmatch test: indent with tabs, not spacesÆvar Arnfjörð Bjarmason, Dec 25, 2017
  13. 2/7 wildmatch test: use more standard shell styleÆvar Arnfjörð Bjarmason, Dec 25, 2017
  14. 3/7 wildmatch test: don't try to vertically align our outputÆvar Arnfjörð Bjarmason, Dec 25, 2017
  15. 4/7 wildmatch test: use a paranoia pattern from nul_match()Ævar Arnfjörð Bjarmason, Dec 25, 2017
  16. 5/7 wildmatch test: remove dead fnmatch() test codeÆvar Arnfjörð Bjarmason, Dec 25, 2017
  17. 6/7 wildmatch test: perform all tests under all wildmatch() modesÆvar Arnfjörð Bjarmason, Dec 25, 2017
  18. Junio C HamanoDec 28, 2017
  19. 7/7 wildmatch test: create & test files on disk in addition to in-memoryÆvar Arnfjörð Bjarmason, Dec 25, 2017
  20. Johannes SixtDec 25, 2017
  21. Junio C HamanoDec 27, 2017
  22. Adam DinwoodieJan 3, 2018
  23. Ævar Arnfjörð BjarmasonJan 3, 2018
  24. Adam DinwoodieJan 3, 2018
  25. Ævar Arnfjörð BjarmasonJan 3, 2018
  26. Adam DinwoodieJan 4, 2018
  27. 0/7 increase wildmatch test coverageÆvar Arnfjörð Bjarmason, Jan 4, 2018
  28. 1/7 wildmatch test: indent with tabs, not spacesÆvar Arnfjörð Bjarmason, Jan 4, 2018
  29. 2/7 wildmatch test: use more standard shell styleÆvar Arnfjörð Bjarmason, Jan 4, 2018
  30. 3/7 wildmatch test: don't try to vertically align our outputÆvar Arnfjörð Bjarmason, Jan 4, 2018
  31. 4/7 wildmatch test: use a paranoia pattern from nul_match()Ævar Arnfjörð Bjarmason, Jan 4, 2018
  32. 5/7 wildmatch test: remove dead fnmatch() test codeÆvar Arnfjörð Bjarmason, Jan 4, 2018
  33. 6/7 wildmatch test: perform all tests under all wildmatch() modesÆvar Arnfjörð Bjarmason, Jan 4, 2018
  34. 7/7 wildmatch test: create & test files on disk in addition to in-memoryÆvar Arnfjörð Bjarmason, Jan 4, 2018
  35. Johannes SchindelinJan 5, 2018
  36. Ævar Arnfjörð BjarmasonJan 5, 2018
  37. Johannes SchindelinJan 5, 2018
  38. 8/7 wildmatch test: skip file creation tests on Windows properÆvar Arnfjörð Bjarmason, Jan 5, 2018
  39. Junio C HamanoJan 5, 2018
  40. Johannes SchindelinJan 6, 2018
  41. Ævar Arnfjörð BjarmasonJan 6, 2018
  42. Johannes SchindelinJan 6, 2018
  43. Johannes SchindelinJan 8, 2018
  44. Junio C HamanoJan 8, 2018
  45. Duy NguyenJan 7, 2018
  46. Johannes SchindelinJan 8, 2018
  47. Duy NguyenJan 10, 2018
  48. Adam DinwoodieJan 10, 2018
  49. Duy NguyenJan 10, 2018
  50. Johannes SchindelinJan 10, 2018
  51. Duy NguyenJan 11, 2018
  52. 00/10 increase wildmatch test coverageÆvar Arnfjörð Bjarmason, Jan 30, 2018
  53. 01/10 wildmatch test: indent with tabs, not spacesÆvar Arnfjörð Bjarmason, Jan 30, 2018
  54. 02/10 wildmatch test: use more standard shell styleÆvar Arnfjörð Bjarmason, Jan 30, 2018
  55. 03/10 wildmatch test: don't try to vertically align our outputÆvar Arnfjörð Bjarmason, Jan 30, 2018
  56. 04/10 wildmatch test: use a paranoia pattern from nul_match()Ævar Arnfjörð Bjarmason, Jan 30, 2018
  57. 06/10 wildmatch test: use test_must_fail, not ! for test-wildmatchÆvar Arnfjörð Bjarmason, Jan 30, 2018
  58. 05/10 wildmatch test: remove dead fnmatch() test codeÆvar Arnfjörð Bjarmason, Jan 30, 2018
  59. 07/10 wildmatch test: perform all tests under all wildmatch() modesÆvar Arnfjörð Bjarmason, Jan 30, 2018
  60. 09/10 test-lib: add an EXPENSIVE_ON_WINDOWS prerequisiteÆvar Arnfjörð Bjarmason, Jan 30, 2018
  61. 10/10 wildmatch test: mark test as EXPENSIVE_ON_WINDOWSÆvar Arnfjörð Bjarmason, Jan 30, 2018
  62. 08/10 wildmatch test: create & test files on disk in addition to in-memoryÆvar Arnfjörð Bjarmason, Jan 30, 2018
  63. Junio C HamanoDec 28, 2017
  64. Ævar Arnfjörð BjarmasonDec 28, 2017
  65. 0/7 increase wildmatch test coverageÆvar Arnfjörð Bjarmason, Dec 28, 2017
  66. 1/7 wildmatch test: indent with tabs, not spacesÆvar Arnfjörð Bjarmason, Dec 28, 2017
  67. 3/7 wildmatch test: don't try to vertically align our outputÆvar Arnfjörð Bjarmason, Dec 28, 2017
  68. 2/7 wildmatch test: use more standard shell styleÆvar Arnfjörð Bjarmason, Dec 28, 2017
  69. 6/7 wildmatch test: perform all tests under all wildmatch() modesÆvar Arnfjörð Bjarmason, Dec 28, 2017
  70. 4/7 wildmatch test: use a paranoia pattern from nul_match()Ævar Arnfjörð Bjarmason, Dec 28, 2017
  71. 5/7 wildmatch test: remove dead fnmatch() test codeÆvar Arnfjörð Bjarmason, Dec 28, 2017
  72. 7/7 wildmatch test: create & test files on disk in addition to in-memoryÆvar Arnfjörð Bjarmason, Dec 28, 2017
  73. Ævar Arnfjörð BjarmasonDec 29, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.