Merge branch 'rs/apply-fuzzy-match-fix'
[git] / t / perf / p7821-grep-engines-fixed.sh
1 #!/bin/sh
2
3 test_description="Comparison of git-grep's regex engines with -F
4
5 Set GIT_PERF_7821_GREP_OPTS in the environment to pass options to
6 git-grep. Make sure to include a leading space,
7 e.g. GIT_PERF_7821_GREP_OPTS=' -w'. See p7820-grep-engines.sh for more
8 options to try.
9 "
10
11 . ./perf-lib.sh
12
13 test_perf_large_repo
14 test_checkout_worktree
15
16 for pattern in 'int' 'uncommon' 'æ'
17 do
18         for engine in fixed basic extended perl
19         do
20                 if test $engine = "perl" && ! test_have_prereq PCRE
21                 then
22                         prereq="PCRE"
23                 else
24                         prereq=""
25                 fi
26                 test_perf $prereq "$engine grep$GIT_PERF_7821_GREP_OPTS $pattern" "
27                         git -c grep.patternType=$engine grep$GIT_PERF_7821_GREP_OPTS $pattern >'out.$engine' || :
28                 "
29         done
30
31         test_expect_success "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS $pattern" '
32                 test_cmp out.fixed out.basic &&
33                 test_cmp out.fixed out.extended &&
34                 if test_have_prereq PCRE
35                 then
36                         test_cmp out.fixed out.perl
37                 fi
38         '
39 done
40
41 test_done