1#!/bin/sh 2 3test_description="Comparison of git-grep's regex engines with -F 4 5Set GIT_PERF_7821_GREP_OPTS in the environment to pass options to 6git-grep. Make sure to include a leading space, 7e.g. GIT_PERF_7821_GREP_OPTS=' -w'. See p7820-grep-engines.sh for more 8options to try. 9 10If GIT_PERF_7821_THREADS is set to a list of threads (e.g. '1 4 8' 11etc.) we will test the patterns under those numbers of threads. 12" 13 14. ./perf-lib.sh 15 16test_perf_large_repo 17test_checkout_worktree 18 19iftest -n"$GIT_PERF_GREP_THREADS" 20then 21 test_set_prereq PERF_GREP_ENGINES_THREADS 22fi 23 24for pattern in'int''uncommon''æ' 25do 26for engine in fixed basic extended perl 27do 28iftest$engine="perl"&& ! test_have_prereq PCRE 29then 30 prereq="PCRE" 31else 32 prereq="" 33fi 34if! test_have_prereq PERF_GREP_ENGINES_THREADS 35then 36 test_perf $prereq"$enginegrep$GIT_PERF_7821_GREP_OPTS$pattern"" 37 git -c grep.patternType=$enginegrep$GIT_PERF_7821_GREP_OPTS$pattern>'out.$engine' || : 38 " 39else 40for threads in$GIT_PERF_GREP_THREADS 41do 42 test_perf PTHREADS,$prereq"$enginegrep$GIT_PERF_7821_GREP_OPTS$patternwith$threadsthreads"" 43 git -c grep.patternType=$engine-c grep.threads=$threadsgrep$GIT_PERF_7821_GREP_OPTS$pattern>'out.$engine.$threads' || : 44 " 45done 46fi 47done 48 49if! test_have_prereq PERF_GREP_ENGINES_THREADS 50then 51 test_expect_success "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS$pattern"' 52 test_cmp out.fixed out.basic && 53 test_cmp out.fixed out.extended && 54 if test_have_prereq PCRE 55 then 56 test_cmp out.fixed out.perl 57 fi 58 ' 59else 60for threads in$GIT_PERF_GREP_THREADS 61do 62 test_expect_success PTHREADS "assert that all engines found the same for$GIT_PERF_7821_GREP_OPTS$patternunder threading"" 63 test_cmp out.fixed.$threadsout.basic.$threads&& 64 test_cmp out.fixed.$threadsout.extended.$threads&& 65 if test_have_prereq PCRE 66 then 67 test_cmp out.fixed.$threadsout.perl.$threads 68 fi 69 " 70done 71fi 72done 73 74test_done