1. 21 5月, 2017 11 次提交
    • Æ
      grep: add tests for grep pattern types being passed to submodules · 5ee6f1a2
      Ævar Arnfjörð Bjarmason 提交于
      Add testing for grep pattern types being correctly passed to
      submodules. The pattern "(.|.)[\d]" matches differently under
      fixed (not at all), and then matches different lines under
      basic/extended & perl regular expressions, so this change asserts that
      the pattern type is passed along correctly.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5ee6f1a2
    • Æ
      grep: amend submodule recursion test for regex engine testing · 5d52a30e
      Ævar Arnfjörð Bjarmason 提交于
      Amend the submodule recursion test to prepare it for subsequent tests
      of whether it passes along the grep.patternType to the submodule
      greps.
      
      This is the result of searching & replacing:
      
          foobar -> (1|2)d(3|4)
          foo    -> (1|2)
          bar    -> (3|4)
      
      Currently there's no tests for whether e.g. -P or -E is correctly
      passed along, tests for that will be added in a follow-up change, but
      first add content to the tests which will match differently under
      different regex engines.
      
      Reuse the pattern established in an earlier commit of mine in this
      series ("log: add exhaustive tests for pattern style options &
      config", 2017-04-07). The pattern "(.|.)[\d]" will match this content
      differently under fixed/basic/extended & perl.
      
      This test code was originally added in commit 0281e487 ("grep:
      optionally recurse into submodules", 2016-12-16).
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5d52a30e
    • Æ
      grep: add tests for --threads=N and grep.threads · c5813658
      Ævar Arnfjörð Bjarmason 提交于
      Add tests for --threads=N being supplied on the command-line, or when
      grep.threads=N being supplied in the configuration.
      
      When the threading support was made run-time configurable in commit
      89f09dd3 ("grep: add --threads=<num> option and grep.threads
      configuration", 2015-12-15) no tests were added for it.
      
      In developing a change to the grep code I was able to make
      '--threads=1 <pat>` segfault, while the test suite still passed. This
      change fixes that blind spot in the tests.
      
      In addition to asserting that asking for N threads shouldn't segfault,
      test that the grep output given any N is the same.
      
      The choice to test only 1..10 as opposed to 1..8 or 1..16 or whatever
      is arbitrary. Testing 1..1024 works locally for me (but gets
      noticeably slower as more threads are spawned). Given the structure of
      the code there's no reason to test an arbitrary number of threads,
      only 0, 1 and >=2 are special modes of operation.
      
      A later patch introduces a PTHREADS test prerequisite which is true
      under NO_PTHREADS=UnfortunatelyYes, but even under NO_PTHREADS it's
      fine to test --threads=N, we'll just ignore it and not use
      threading. So these tests also make sense under that mode to assert
      that --threads=N without pthreads still returns expected results.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c5813658
    • Æ
      grep: change non-ASCII -i test to stop using --debug · e01b4dab
      Ævar Arnfjörð Bjarmason 提交于
      Change a non-ASCII case-insensitive test case to stop using --debug,
      and instead simply test for the expected results.
      
      The test coverage remains the same with this change, but the test
      won't break due to internal refactoring.
      
      This test was added in commit 793dc676 ("grep/icase: avoid kwsset
      when -F is specified", 2016-06-25). It was asserting that the regex
      must be compiled with compile_fixed_regexp(), instead test for the
      expected results, allowing the underlying implementation to change.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e01b4dab
    • Æ
      grep: add a test for backreferences in PCRE patterns · 4aeb720d
      Ævar Arnfjörð Bjarmason 提交于
      Add a test for backreferences such as (.)\1 in PCRE patterns. This
      test ensures that the PCRE_NO_AUTO_CAPTURE option isn't turned
      on. Before this change turning it on would break these sort of
      patterns, but wouldn't break any tests.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4aeb720d
    • Æ
      grep: add a test asserting that --perl-regexp dies when !PCRE · 9001c192
      Ævar Arnfjörð Bjarmason 提交于
      Add a test asserting that when --perl-regexp (and -P for grep) is
      given to git-grep & git-log that we die with an error.
      
      In developing the PCRE v2 series I introduced a regression where -P
      would (through control-flow fall-through) become synonymous with basic
      POSIX matching. I.e. 'git grep -P '[\d]' would match "d" instead of
      digits.
      
      The entire test suite would still pass with this serious regression,
      since everything that tested for --perl-regexp would be guarded by the
      PCRE prerequisite, fix that blind-spot by adding tests under !PCRE
      asserting that git must die when given --perl-regexp or -P.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9001c192
    • Æ
      log: make --regexp-ignore-case work with --perl-regexp · 9e3cbc59
      Ævar Arnfjörð Bjarmason 提交于
      Make the --regexp-ignore-case option work with --perl-regexp. This
      never worked, and there was no test for this. Fix the bug and add a
      test.
      
      When PCRE support was added in commit 63e7e9d8 ("git-grep: Learn
      PCRE", 2011-05-09) compile_pcre_regexp() would only check
      opt->ignore_case, but when the --perl-regexp option was added in
      commit 727b6fc3 ("log --grep: accept --basic-regexp and
      --perl-regexp", 2012-10-03) the code didn't set the opt->ignore_case.
      
      Change the test suite to test for -i and --invert-regexp with
      basic/extended/perl patterns in addition to fixed, which was the only
      patternType that was tested for before in combination with those
      options.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9e3cbc59
    • Æ
      log: add exhaustive tests for pattern style options & config · 9df46763
      Ævar Arnfjörð Bjarmason 提交于
      Add exhaustive tests for how the different grep.patternType options &
      the corresponding command-line options affect git-log.
      
      Before this change it was possible to patch revision.c so that the
      --basic-regexp option was synonymous with --extended-regexp, and
      --perl-regexp wasn't recognized at all, and still have 100% of the
      test suite pass.
      
      This was because the first test being modified here, added in commit
      34a4ae55 ("log --grep: use the same helper to set -E/-F options as
      "git grep"", 2012-10-03), didn't actually check whether we'd enabled
      extended regular expressions as distinct from re-toggling non-fixed
      string support.
      
      Fix that by changing the pattern to a pattern that'll only match if
      --extended-regexp option is provided, but won't match under the
      default --basic-regexp option.
      
      Other potential regressions were possible since there were no tests
      for the rest of the combinations of grep.patternType configuration
      toggles & corresponding git-log command-line options. Add exhaustive
      tests for those.
      
      The patterns being passed to fixed/basic/extended/PCRE are carefully
      crafted to return the wrong thing if the grep engine were to pick any
      other matching method than the one it's told to use.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9df46763
    • Æ
      test-lib: rename the LIBPCRE prerequisite to PCRE · 3eb585c1
      Ævar Arnfjörð Bjarmason 提交于
      Rename the LIBPCRE prerequisite to PCRE. This is for preparation for
      libpcre2 support, where having just "LIBPCRE" would be confusing as it
      implies v1 of the library.
      
      None of these tests are incompatible between versions 1 & 2 of
      libpcre, it's less confusing to give them a more general name to make
      it clear that they work on both library versions.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3eb585c1
    • Æ
      grep & rev-list doc: stop promising libpcre for --perl-regexp · d048cb13
      Ævar Arnfjörð Bjarmason 提交于
      Stop promising in our grep & rev-list options documentation that we're
      always going to be using libpcre when given the --perl-regexp option.
      
      Instead talk about using "Perl-compatible regular expressions" and
      using these types of patterns using "a compile-time dependency".
      
      Saying "libpcre" means that we're talking about libpcre.so, which is
      always going to be v1. This change is part of an ongoing saga to add
      support for libpcre2, which comes with PCRE v2.
      
      In the future we might use some completely unrelated library to
      provide perl-compatible regular expression support. By wording the
      documentation differently and not promising any specific version of
      PCRE or even PCRE at all we have more wiggle room to change the
      implementation.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d048cb13
    • Æ
      Makefile & configure: reword inaccurate comment about PCRE · 072473e6
      Ævar Arnfjörð Bjarmason 提交于
      Reword an outdated & inaccurate comment which suggests that only
      git-grep can use PCRE.
      
      This comment was added back when PCRE support was initially added in
      commit 63e7e9d8 ("git-grep: Learn PCRE", 2011-05-09), and was true
      at the time.
      
      It hasn't been telling the full truth since git-log learned to use
      PCRE with --grep in commit 727b6fc3 ("log --grep: accept
      --basic-regexp and --perl-regexp", 2012-10-03), and more importantly
      is likely to get more inaccurate over time as more use is made of PCRE
      in other areas.
      
      Reword it to be more future-proof, and to more clearly explain that
      this enables user-initiated runtime behavior.
      
      Copy/pasting this so much in configure.ac is lame, these Makefile-like
      flags aren't even used by autoconf, just the corresponding
      --with[out]-* options. But copy/pasting the comments that make sense
      for the Makefile to configure.ac where they make less sense is the
      pattern everything else follows in that file. I'm not going to war
      against that as part of this change, just following the existing
      pattern.
      Signed-off-by: NÆvar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      072473e6
  2. 09 5月, 2017 12 次提交
  3. 06 5月, 2017 3 次提交
  4. 05 5月, 2017 14 次提交