summaryrefslogtreecommitdiff
path: root/evergreen/lint_fuzzer_sanity_patch.sh
diff options
context:
space:
mode:
authorSiran Wang <siran.wang@mongodb.com>2021-05-21 02:43:34 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-26 14:59:37 +0000
commit2af7ba48290bc0cbeecde0540282dbc7a8d4daab (patch)
treedc380e133cbf96c49171136d49337a67eaf9371d /evergreen/lint_fuzzer_sanity_patch.sh
parent56143e2127e63e5f949986f4e845dd0ff18a6b92 (diff)
downloadmongo-2af7ba48290bc0cbeecde0540282dbc7a8d4daab.tar.gz
SERVER-56911 improve lint_fuzzer_sanity_patch to check generated tests
Diffstat (limited to 'evergreen/lint_fuzzer_sanity_patch.sh')
-rw-r--r--evergreen/lint_fuzzer_sanity_patch.sh25
1 files changed, 22 insertions, 3 deletions
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