3 test_description="Comparison of git-grep's regex engines
 
   5 Set GIT_PERF_7820_GREP_OPTS in the environment to pass options to
 
   6 git-grep. Make sure to include a leading space,
 
   7 e.g. GIT_PERF_7820_GREP_OPTS=' -i'. Some options to try:
 
  16 If GIT_PERF_GREP_THREADS is set to a list of threads (e.g. '1 4 8'
 
  17 etc.) we will test the patterns under those numbers of threads.
 
  23 test_checkout_worktree
 
  25 if test -n "$GIT_PERF_GREP_THREADS"
 
  27         test_set_prereq PERF_GREP_ENGINES_THREADS
 
  34         '\(e.t[^ ]*\|v.ry\) rare' \
 
  35         'm\(ú\|u\)lt.b\(æ\|y\)te'
 
  37         for engine in basic extended perl
 
  39                 if test $engine != "basic"
 
  41                         # Poor man's basic -> extended converter.
 
  42                         pattern=$(echo "$pattern" | sed 's/\\//g')
 
  44                 if test $engine = "perl" && ! test_have_prereq PCRE
 
  50                 if ! test_have_prereq PERF_GREP_ENGINES_THREADS
 
  52                         test_perf $prereq "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern'" "
 
  53                                 git -c grep.patternType=$engine grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine' || :
 
  56                         for threads in $GIT_PERF_GREP_THREADS
 
  58                                 test_perf PTHREADS,$prereq "$engine grep$GIT_PERF_7820_GREP_OPTS '$pattern' with $threads threads" "
 
  59                                         git -c grep.patternType=$engine -c grep.threads=$threads grep$GIT_PERF_7820_GREP_OPTS -- '$pattern' >'out.$engine.$threads' || :
 
  65         if ! test_have_prereq PERF_GREP_ENGINES_THREADS
 
  67                 test_expect_success "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern'" '
 
  68                         test_cmp out.basic out.extended &&
 
  69                         if test_have_prereq PCRE
 
  71                                 test_cmp out.basic out.perl
 
  75                 for threads in $GIT_PERF_GREP_THREADS
 
  77                         test_expect_success PTHREADS "assert that all engines found the same for$GIT_PERF_7820_GREP_OPTS '$pattern' under threading" "
 
  78                                 test_cmp out.basic.$threads out.extended.$threads &&
 
  79                                 if test_have_prereq PCRE
 
  81                                         test_cmp out.basic.$threads out.perl.$threads