mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-24 08:30:56 +01:00
33 lines
992 B
Bash
33 lines
992 B
Bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
|
. "$DIR/prelude.sh"
|
|
|
|
cd src
|
|
|
|
set -eo pipefail
|
|
set -o verbose
|
|
|
|
add_nodejs_to_path
|
|
|
|
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 ".*jstests/.*\.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
|