summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Guo <robertguo@me.com>2019-05-19 21:57:04 -0400
committerRobert Guo <robert.guo@10gen.com>2019-05-23 18:07:00 -0400
commit0b39364ee1e923fd3e4e66f0e0bb0e57ca0deacd (patch)
tree70780dd380f547616170305cb9822b9ca838461c
parent8a89b076d28a904c200e491698ef1169dd8a7254 (diff)
downloadmongo-0b39364ee1e923fd3e4e66f0e0bb0e57ca0deacd.tar.gz
SERVER-40924 SERVER-40923 Add Evergreen task to sanity check fuzzer can parse JavaScript tests, remove npm test call.
-rwxr-xr-xbuildscripts/evergreen_gen_fuzzer_tests.py1
-rw-r--r--buildscripts/tests/test_evergreen_gen_fuzzer_tests.py6
-rw-r--r--etc/evergreen.yml131
3 files changed, 88 insertions, 50 deletions
diff --git a/buildscripts/evergreen_gen_fuzzer_tests.py b/buildscripts/evergreen_gen_fuzzer_tests.py
index 154638ee158..f207d2c4b3d 100755
--- a/buildscripts/evergreen_gen_fuzzer_tests.py
+++ b/buildscripts/evergreen_gen_fuzzer_tests.py
@@ -113,6 +113,7 @@ def _generate_evg_tasks(options):
if options.use_multiversion:
commands.append(CommandDefinition().function("do multiversion setup"))
+ commands.append(CommandDefinition().function("setup jstestfuzz"))
commands.append(CommandDefinition().function("run jstestfuzz").vars({
"jstestfuzz_vars":
"--numGeneratedFiles {0} {1}".format(options.num_files, options.jstestfuzz_vars),
diff --git a/buildscripts/tests/test_evergreen_gen_fuzzer_tests.py b/buildscripts/tests/test_evergreen_gen_fuzzer_tests.py
index ef1c4d205c2..ddcc6f17e00 100644
--- a/buildscripts/tests/test_evergreen_gen_fuzzer_tests.py
+++ b/buildscripts/tests/test_evergreen_gen_fuzzer_tests.py
@@ -34,7 +34,9 @@ class TestGenerateEvgTasks(unittest.TestCase):
self.assertEqual(options.num_tasks, len(config["tasks"]))
- command1 = config["tasks"][0]["commands"][1]
+ self.assertEqual("setup jstestfuzz", config["tasks"][0]["commands"][1]["func"])
+
+ command1 = config["tasks"][0]["commands"][2]
self.assertIn(str(options.num_files), command1["vars"]["jstestfuzz_vars"])
self.assertIn(options.npm_command, command1["vars"]["npm_command"])
self.assertEqual("run jstestfuzz", command1["func"])
@@ -55,4 +57,4 @@ class TestGenerateEvgTasks(unittest.TestCase):
self.assertEqual("do multiversion setup", config["tasks"][0]["commands"][1]["func"])
self.assertEqual("/data/multiversion",
- config["tasks"][0]["commands"][3]["vars"]["task_path_suffix"])
+ config["tasks"][0]["commands"][4]["vars"]["task_path_suffix"])
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index 0626cbe0f94..4990f4e4e70 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -1137,6 +1137,18 @@ functions:
fi
echo "python set to $(which $python)"
+ - key: add_nodejs_to_path
+ value: |
+ # Add node and npm binaries to PATH
+ if [ "Windows_NT" = "$OS" ]; then
+ # An "npm" directory might not have been created in %APPDATA% by the Windows installer.
+ # Work around the issue by specifying a different %APPDATA% path.
+ # See: https://github.com/nodejs/node-v0.x-archive/issues/8141
+ export APPDATA=${workdir}/npm-app-data
+ export PATH="$PATH:/cygdrive/c/Program Files (x86)/nodejs" # Windows location
+ else
+ export PATH="$PATH:/opt/node/bin"
+ fi
- key: posix_workdir
value: eval 'if [ "Windows_NT" = "$OS" ]; then echo $(cygpath -u "${workdir}"); else echo ${workdir}; fi'
# For ssh disable the options GSSAPIAuthentication, CheckHostIP, StrictHostKeyChecking
@@ -1774,8 +1786,9 @@ functions:
files:
- src/generated_resmoke_config/${name}.json
- "run jstestfuzz":
+ "setup jstestfuzz":
- command: shell.exec
+ shell: bash
params:
working_dir: src
script: |
@@ -1783,38 +1796,57 @@ functions:
set -o verbose
git clone git@github.com:10gen/jstestfuzz.git
+ npm install --prefix jstestfuzz
+ npm run prepare --prefix jstestfuzz
+
+ "lint fuzzer sanity patch":
+ - command: shell.exec
+ shell: bash
+ type: test
+ params:
+ working_dir: src
+ script: |
+ set -eo pipefail
+ set -o verbose
+
+ ${add_nodejs_to_path}
- cp mongodb*/bin/mongod .
+ if [ "${is_patch}" != "true" ]; then
+ echo "Not in a patch build, skipping linting modified JS files for the fuzzer"
+ exit 0;
+ fi
+ # 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 "\.js$" patch_files.txt || true) | sed -e "s|^|$PWD/|" | xargs -P 32 -L 50 npm run --prefix jstestfuzz parse-jsfiles --
+
+ "lint fuzzer sanity all":
- command: shell.exec
+ shell: bash
+ type: test
params:
working_dir: src
script: |
- set -o errexit
+ set -eo pipefail
set -o verbose
- git clone --depth 1 git@github.com:10gen/mongo-enterprise-modules.git jstests/enterprise_tests
- git clone --depth 1 git@github.com:10gen/QA.git jstests/qa_tests
+ ${add_nodejs_to_path}
+
+ # Run parse-jsfiles on 50 files at a time with 32 processes in parallel.
+ find "$PWD/jstests" "$PWD/src/mongo/db/modules/enterprise" -name "*.js" -print | xargs -P 32 -L 50 npm run --prefix jstestfuzz parse-jsfiles --
+ "run jstestfuzz":
- command: shell.exec
params:
- working_dir: src/jstestfuzz
+ working_dir: src
script: |
set -o errexit
set -o verbose
- # Add node and npm binaries to PATH
- if [ "Windows_NT" = "$OS" ]; then
- # An "npm" directory might not have been created in %APPDATA% by the Windows installer.
- # Work around the issue by specifying a different %APPDATA% path.
- # See: https://github.com/nodejs/node-v0.x-archive/issues/8141
- export APPDATA=${workdir}/npm-app-data
- export PATH="$PATH:/cygdrive/c/Program Files (x86)/nodejs" # Windows location
- else
- export PATH="$PATH:/opt/node/bin"
- fi
+ cp mongodb*/bin/mongod
- npm install
+ git clone --depth 1 git@github.com:10gen/mongo-enterprise-modules.git jstests/enterprise_tests
+ git clone --depth 1 git@github.com:10gen/QA.git jstests/qa_tests
- command: shell.exec
type: test
@@ -1824,37 +1856,8 @@ functions:
set -o errexit
set -o verbose
- # Add node and npm binaries to PATH
- if [ "Windows_NT" = "$OS" ]; then
- # An "npm" directory might not have been created in %APPDATA% by the Windows installer.
- # Work around the issue by specifying a different %APPDATA% path.
- # See: https://github.com/nodejs/node-v0.x-archive/issues/8141
- export APPDATA=${workdir}/npm-app-data
- export PATH="$PATH:/cygdrive/c/Program Files (x86)/nodejs" # Windows location
- else
- export PATH="$PATH:/opt/node/bin"
- fi
-
- echo "jstestfuzz self-tests are starting"
- set +o errexit
- npm test > npm_test.log 2>&1
- if [ $? -ne 0 ]; then
- echo "jstestfuzz self-tests failure"
- branch=$(git symbolic-ref --short HEAD)
- commit=$(git show -s --pretty=format:"%h - %an, %ar: %s")
- echo "Git branch: $branch, commit: $commit"
- which node
- node --version
- which npm
- npm --version
- cat npm_test.log
- exit 1
- fi
- rm -f npm_test.log
- set -o errexit
- echo "jstestfuzz self-tests finished"
-
- npm run ${npm_command|jstestfuzz} -- ${jstestfuzz_vars}
+ ${add_nodejs_to_path}
+ source scripts/npm_run.sh ${npm_command|jstestfuzz} -- ${jstestfuzz_vars}
- command: archive.targz_pack
params:
@@ -5302,6 +5305,25 @@ tasks:
resmoke_args: --suites=jstestfuzz_sharded_session --storageEngine=wiredTiger
name: jstestfuzz_sharded_session
+# Check that the mutational fuzzer can parse JS files modified in a patch build.
+- name: lint_fuzzer_sanity_patch
+ commands:
+ - command: manifest.load
+ - func: "git get project"
+ - func: "set task expansion macros"
+ - func: "get modified patch files"
+ - func: "setup jstestfuzz"
+ - func: "lint fuzzer sanity patch"
+
+# Check that the mutational fuzzer can parse all JS filess.
+- name: lint_fuzzer_sanity_all
+ commands:
+ - command: manifest.load
+ - func: "git get project"
+ - func: "set task expansion macros"
+ - func: "setup jstestfuzz"
+ - func: "lint fuzzer sanity all"
+
## integration test suites ##
- <<: *task_template
@@ -8817,6 +8839,17 @@ buildvariants:
- ubuntu1604-packer
- name: .publish
+- name: tig-daily-cron
+ modules:
+ - enterprise
+ display_name: "~ TIG Daily Cron"
+ run_on:
+ - rhel62-small
+ batchtime: 1440 # 1 day
+ stepback: false
+ tasks:
+ - name: lint_fuzzer_sanity_all
+
###########################################
# Windows buildvariants #
###########################################
@@ -9828,12 +9861,14 @@ buildvariants:
requires:
- name: burn_in_tests_gen
- name: lint
+ - name: lint_fuzzer_sanity_patch
distros:
- rhel62-large
- name: compile_benchmarks
distros:
- rhel62-large
- name: lint
+ - name: lint_fuzzer_sanity_patch
- name: lint_yaml
- name: burn_in_tests_gen
distros: