diff options
author | Siran Wang <siran.wang@mongodb.com> | 2021-05-21 02:43:34 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-26 14:59:37 +0000 |
commit | 2af7ba48290bc0cbeecde0540282dbc7a8d4daab (patch) | |
tree | dc380e133cbf96c49171136d49337a67eaf9371d /evergreen | |
parent | 56143e2127e63e5f949986f4e845dd0ff18a6b92 (diff) | |
download | mongo-2af7ba48290bc0cbeecde0540282dbc7a8d4daab.tar.gz |
SERVER-56911 improve lint_fuzzer_sanity_patch to check generated tests
Diffstat (limited to 'evergreen')
-rwxr-xr-x | evergreen/functions/added_and_modified_patch_files_get.sh | 2 | ||||
-rw-r--r-- | evergreen/lint_fuzzer_sanity_patch.sh | 25 |
2 files changed, 23 insertions, 4 deletions
diff --git a/evergreen/functions/added_and_modified_patch_files_get.sh b/evergreen/functions/added_and_modified_patch_files_get.sh index 9b230f3b081..3e07fbf695d 100755 --- a/evergreen/functions/added_and_modified_patch_files_get.sh +++ b/evergreen/functions/added_and_modified_patch_files_get.sh @@ -6,7 +6,7 @@ cd src set -o verbose set -o errexit -git diff HEAD --name-only --line-prefix="${workdir}/src/" --diff-filter=d >>modified_and_created_patch_files.txt +git diff --name-only origin/${branch_name}... --line-prefix="${workdir}/src/" --diff-filter=d >>modified_and_created_patch_files.txt if [ -d src/mongo/db/modules/enterprise ]; then pushd src/mongo/db/modules/enterprise git diff HEAD --name-only --line-prefix="${workdir}/src/src/mongo/db/modules/enterprise/" --diff-filter=d >>~1/modified_and_created_patch_files.txt diff --git a/evergreen/lint_fuzzer_sanity_patch.sh b/evergreen/lint_fuzzer_sanity_patch.sh index 3d3fdb94acd..d6b769d095d 100644 --- a/evergreen/lint_fuzzer_sanity_patch.sh +++ b/evergreen/lint_fuzzer_sanity_patch.sh @@ -8,6 +8,25 @@ set -o verbose add_nodejs_to_path -# Run parse-jsfiles on 50 files at a time with 32 processes in parallel. -# Grep returns 1 if it fails to find a match. -(grep -v "\.tpl\.js$" modified_and_created_patch_files.txt | grep "\.js$" || true) | xargs -P 32 -L 50 npm run --prefix jstestfuzz parse-jsfiles -- +mkdir -p jstestfuzzinput jstestfuzzoutput + +indir="$(pwd)/jstestfuzzinput" +outdir="$(pwd)/jstestfuzzoutput" + +# Grep all the js files from modified_and_created_patch_files.txt and put them into $indir. +(grep -v "\.tpl\.js$" modified_and_created_patch_files.txt | grep "\.js$" | xargs -I {} cp {} $indir || true) + +# Count the number of files in $indir. +if [[ "$(ls -A $indir)" ]]; then + num_files=$(ls -A $indir | wc -l) + + # Only fetch 50 files to generate jsfuzz testing files. + if [[ $num_files -gt 50 ]]; then + num_files=50 + fi + + npm run --prefix jstestfuzz jstestfuzz -- --jsTestsDir $indir --out $outdir --numSourceFiles $num_files --numGeneratedFiles 50 + + # Run parse-jsfiles on 50 files at a time with 32 processes in parallel. + ls -1 -d $outdir/* | xargs -P 32 -L 50 npm run --prefix jstestfuzz parse-jsfiles -- +fi |