From 661bdfaa5dee09a1bb403430b70eacfc08eae791 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 19 Sep 2017 13:25:12 -0700 Subject: [PATCH 01/12] Add forced completion queue poll to ensure that waitForReady uses current connectivity state --- .../grpc-native-core/ext/completion_queue.cc | 18 ++++++++++++++---- packages/grpc-native-core/ext/node_grpc.cc | 7 +++++++ packages/grpc-native-core/src/client.js | 5 ++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/grpc-native-core/ext/completion_queue.cc b/packages/grpc-native-core/ext/completion_queue.cc index a08febbb..0cee1a75 100644 --- a/packages/grpc-native-core/ext/completion_queue.cc +++ b/packages/grpc-native-core/ext/completion_queue.cc @@ -35,7 +35,7 @@ grpc_completion_queue *queue; uv_prepare_t prepare; int pending_batches; -void drain_completion_queue(uv_prepare_t *handle) { +static void drain_completion_queue(uv_prepare_t *handle) { Nan::HandleScope scope; grpc_event event; (void)handle; @@ -53,9 +53,9 @@ void drain_completion_queue(uv_prepare_t *handle) { CompleteTag(event.tag, error_message); grpc::node::DestroyTag(event.tag); pending_batches--; - if (pending_batches == 0) { - uv_prepare_stop(&prepare); - } + } + if (pending_batches == 0) { + uv_prepare_stop(&prepare); } } while (event.type != GRPC_QUEUE_TIMEOUT); } @@ -76,5 +76,15 @@ void CompletionQueueInit(Local exports) { pending_batches = 0; } +void CompletionQueueForcePoll() { + /* This sets the prepare object to poll on the completion queue the next time + * Node polls for IO. But it doesn't increment the number of pending batches, + * so it will immediately stop polling after that unless there is an + * intervening CompletionQueueNext call */ + if (pending_batches == 0) { + uv_prepare_start(&prepare, drain_completion_queue); + } +} + } // namespace node } // namespace grpc diff --git a/packages/grpc-native-core/ext/node_grpc.cc b/packages/grpc-native-core/ext/node_grpc.cc index 11ed0838..a0652c28 100644 --- a/packages/grpc-native-core/ext/node_grpc.cc +++ b/packages/grpc-native-core/ext/node_grpc.cc @@ -265,6 +265,10 @@ NAN_METHOD(SetLogVerbosity) { gpr_set_log_verbosity(severity); } +NAN_METHOD(ForcePoll) { + grpc::node::CompletionQueueForcePoll(); +} + void init(Local exports) { Nan::HandleScope scope; grpc_init(); @@ -306,6 +310,9 @@ void init(Local exports) { Nan::Set(exports, Nan::New("setLogVerbosity").ToLocalChecked(), Nan::GetFunction(Nan::New(SetLogVerbosity)) .ToLocalChecked()); + Nan::Set(exports, Nan::New("forcePoll").ToLocalChecked(), + Nan::GetFunction(Nan::New(ForcePoll)) + .ToLocalChecked()); } NODE_MODULE(grpc_node, init) diff --git a/packages/grpc-native-core/src/client.js b/packages/grpc-native-core/src/client.js index 4208da11..d3c39ca4 100644 --- a/packages/grpc-native-core/src/client.js +++ b/packages/grpc-native-core/src/client.js @@ -800,7 +800,10 @@ Client.prototype.waitForReady = function(deadline, callback) { self.$channel.watchConnectivityState(new_state, deadline, checkState); } }; - checkState(); + /* Force a single round of polling to ensure that the channel state is up + * to date */ + grpc.forcePoll(); + setImmediate(checkState); }; /** From 46e2418fc661eb2d58272c995d8579ec67accf69 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 19 Sep 2017 14:38:27 -0700 Subject: [PATCH 02/12] Update completion queue header to match code changes --- packages/grpc-native-core/ext/completion_queue.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/grpc-native-core/ext/completion_queue.h b/packages/grpc-native-core/ext/completion_queue.h index f91d5ea8..3a56c327 100644 --- a/packages/grpc-native-core/ext/completion_queue.h +++ b/packages/grpc-native-core/ext/completion_queue.h @@ -28,5 +28,7 @@ void CompletionQueueNext(); void CompletionQueueInit(v8::Local exports); +void CompletionQueueForcePoll(); + } // namespace node } // namespace grpc From 4177d13ada2052a90bf7419f12ffb45ed07167ec Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 19 Sep 2017 01:44:13 +0200 Subject: [PATCH 03/12] Installing nvm. --- install-nvm-windows.ps1 | 26 ++++++++++++++++++++++++++ kokoro.bat | 34 ++++++++++++++++++++++++++++++++++ test/kokoro/windows.cfg | 19 +++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 install-nvm-windows.ps1 create mode 100644 kokoro.bat create mode 100644 test/kokoro/windows.cfg diff --git a/install-nvm-windows.ps1 b/install-nvm-windows.ps1 new file mode 100644 index 00000000..709a1ec2 --- /dev/null +++ b/install-nvm-windows.ps1 @@ -0,0 +1,26 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# We're going to store nvm-windows in the .\nvm directory. +$env:NVM_HOME = (Get-Item -Path ".\" -Verbose).FullName + "\nvm" + +# Downloading and unpacking nvm-windows +Invoke-WebRequest -Uri https://github.com/coreybutler/nvm-windows/releases/download/1.1.5/nvm-noinstall.zip -OutFile nvm-noinstall.zip +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory("nvm-noinstall.zip", "nvm") + +$env:Path = $env:NVM_HOME + ";" + $env:Path +Out-File -Encoding "OEM" nvm\settings.txt +nvm root $env:NVM_HOME +"%*" | Out-File -Encoding "OEM" nvm\elevate.cmd diff --git a/kokoro.bat b/kokoro.bat new file mode 100644 index 00000000..eef4db09 --- /dev/null +++ b/kokoro.bat @@ -0,0 +1,34 @@ +@rem Copyright 2017 gRPC authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +@echo "Starting Windows test" + +SET ROOT=%~dp0 +cd /d %~dp0 + +PowerShell -Command .\install-nvm-windows.ps1 + +SET NVM_HOME=%ROOT%nvm +SET NVM_SYMLINK=%ROOT%nvm\nodejs +SET PATH=%NVM_HOME%;%NVM_SYMLINK%;%PATH% + +nvm version + +nvm install 8.5.0 +nvm use 8.5.0 +node -e console.log(process.versions) + +nvm install 6.11.3 +nvm use 6.11.3 +node -e console.log(process.versions) diff --git a/test/kokoro/windows.cfg b/test/kokoro/windows.cfg new file mode 100644 index 00000000..e4a4524b --- /dev/null +++ b/test/kokoro/windows.cfg @@ -0,0 +1,19 @@ +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for Kokoro (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc-node/kokoro.bat" +timeout_mins: 60 From 69092117deae3774c4b1b7489b56330b553e66a9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 20 Sep 2017 10:50:06 -0700 Subject: [PATCH 04/12] Disable warning in recent GCC versions that hits BoringSSL --- packages/grpc-native-core/binding.gyp | 3 +++ packages/grpc-native-core/templates/binding.gyp.template | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/grpc-native-core/binding.gyp b/packages/grpc-native-core/binding.gyp index 3e8153f5..861ac0af 100644 --- a/packages/grpc-native-core/binding.gyp +++ b/packages/grpc-native-core/binding.gyp @@ -207,6 +207,9 @@ 'target_name': 'boringssl', 'product_prefix': 'lib', 'type': 'static_library', + 'cflags': [ + '-Wimplicit-fallthrough=0' + ], 'dependencies': [ ], 'sources': [ diff --git a/packages/grpc-native-core/templates/binding.gyp.template b/packages/grpc-native-core/templates/binding.gyp.template index a74066df..19f88683 100644 --- a/packages/grpc-native-core/templates/binding.gyp.template +++ b/packages/grpc-native-core/templates/binding.gyp.template @@ -194,6 +194,9 @@ 'target_name': '${lib.name}', 'product_prefix': 'lib', 'type': 'static_library', + 'cflags': [ + '-Wimplicit-fallthrough=0' + ], 'dependencies': [ % for dep in getattr(lib, 'deps', []): '${dep}', From 6b446c31646c3dcd9216556186b1e9512741a707 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 20 Sep 2017 20:15:19 +0200 Subject: [PATCH 05/12] Splitting into run-tests.bat. --- kokoro.bat | 18 +++--------------- run-tests.bat | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 run-tests.bat diff --git a/kokoro.bat b/kokoro.bat index eef4db09..fc5fd8b2 100644 --- a/kokoro.bat +++ b/kokoro.bat @@ -14,21 +14,9 @@ @echo "Starting Windows test" -SET ROOT=%~dp0 cd /d %~dp0 -PowerShell -Command .\install-nvm-windows.ps1 +git submodule update --init +git submodule foreach --recursive git submodule update --init -SET NVM_HOME=%ROOT%nvm -SET NVM_SYMLINK=%ROOT%nvm\nodejs -SET PATH=%NVM_HOME%;%NVM_SYMLINK%;%PATH% - -nvm version - -nvm install 8.5.0 -nvm use 8.5.0 -node -e console.log(process.versions) - -nvm install 6.11.3 -nvm use 6.11.3 -node -e console.log(process.versions) +.\run-tests.bat diff --git a/run-tests.bat b/run-tests.bat new file mode 100644 index 00000000..8f6e39c5 --- /dev/null +++ b/run-tests.bat @@ -0,0 +1,38 @@ +@rem Copyright 2017 gRPC authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. + +SET ROOT=%~dp0 +cd /d %~dp0 + +PowerShell -Command .\install-nvm-windows.ps1 + +SET NVM_HOME=%ROOT%nvm +SET NVM_SYMLINK=%ROOT%nvm\nodejs +SET PATH=%NVM_HOME%;%NVM_SYMLINK%;%PATH% + +nvm version + +nvm install 8.5.0 +nvm use 8.5.0 +node -e console.log(process.versions) + +call npm install --build-from-source + +@rem delete the redundant openssl headers +for /f "delims=v" %%v in ('node --version') do ( + rmdir "%USERPROFILE%\.node-gyp\%%v\include\node\openssl" /S /Q +) + +@rem rebuild, because it probably failed the first time +call npm install --build-from-source %* From 62d71048fe26eade2e37b0f985971fc446f6626b Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 20 Sep 2017 12:39:16 -0700 Subject: [PATCH 06/12] Move dependencies around, add gulp target for document generation --- gulpfile.js | 4 ++- package.json | 14 +++-------- packages/grpc-native-core/gulpfile.js | 7 ++++++ packages/grpc-native-core/jsdoc_conf.json | 8 +----- packages/grpc-native-core/package.json | 12 +-------- .../templates/package.json.template | 15 +---------- test/gulpfile.js | 5 ++++ test/package.json | 25 +++++++++++++++++++ 8 files changed, 47 insertions(+), 43 deletions(-) create mode 100644 test/package.json diff --git a/gulpfile.js b/gulpfile.js index 2024412a..b31cc3c8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,7 @@ require('./test/gulpfile'); const root = __dirname; gulp.task('install.all', 'Install dependencies for all subdirectory packages', - ['js.core.install', 'native.core.install', 'health-check.install']); + ['js.core.install', 'native.core.install', 'health-check.install', 'internal.test.install']); gulp.task('lint', 'Emit linting errors in source and test files', ['js.core.lint', 'native.core.lint']); @@ -52,4 +52,6 @@ gulp.task('test', 'Run all tests', ['build'], () => { gulp.start('test.only'); }); +gulp.task('doc.gen', 'Generate documentation', ['native.core.doc.gen']); + gulp.task('default', ['help']); diff --git a/package.json b/package.json index f8aaf17b..8c23ea19 100644 --- a/package.json +++ b/package.json @@ -8,29 +8,23 @@ "name": "Google Inc." }, "license": "Apache-2.0", - "dependencies": { - "async": "^2.5.0", - "body-parser": "^1.18.0", - "execa": "^0.8.0", - "express": "^4.15.4", - "google-auth-library": "^0.11.0", - "lodash": "^4.17.4", - "mocha-jenkins-reporter": "^0.3.9", - "poisson-process": "^0.2.2" - }, "devDependencies": { "del": "^3.0.0", + "execa": "^0.8.0", "gulp": "^3.9.1", "gulp-help": "^1.6.1", + "gulp-jsdoc3": "^1.0.1", "gulp-jshint": "^2.0.4", "gulp-mocha": "^4.3.1", "gulp-sourcemaps": "^2.6.1", "gulp-tslint": "^8.1.1", "gulp-typescript": "^3.2.2", "gulp-util": "^3.0.8", + "jsdoc": "^3.3.2", "jshint": "^2.9.5", "merge2": "^1.1.0", "mocha": "^3.5.3", + "mocha-jenkins-reporter": "^0.3.9", "through2": "^2.0.3", "tslint": "^5.5.0", "typescript": "^2.5.1" diff --git a/packages/grpc-native-core/gulpfile.js b/packages/grpc-native-core/gulpfile.js index 7d85cf5b..bb695c9d 100644 --- a/packages/grpc-native-core/gulpfile.js +++ b/packages/grpc-native-core/gulpfile.js @@ -4,6 +4,7 @@ const help = require('gulp-help'); // gulp-help monkeypatches tasks to have an additional description parameter const gulp = help(_gulp); +const jsdoc = require('gulp-jsdoc3'); const jshint = require('gulp-jshint'); const mocha = require('gulp-mocha'); const execa = require('execa'); @@ -47,3 +48,9 @@ gulp.task('native.core.build', 'Build native package', () => { gulp.task('native.core.test', 'Run all tests', ['native.core.build'], () => { return gulp.src(`${testDir}/*.js`).pipe(mocha({reporter: 'mocha-jenkins-reporter'})); }); + +gulp.task('native.core.doc.gen', 'Generate docs', (cb) => { + var config = require('./jsdoc_conf.json'); + gulp.src([`${nativeCoreDir}/README.md`, `${nativeCoreDir}/index.js`, `${srcDir}/*.js`], {read: false}) + .pipe(jsdoc(config, cb)); +}); diff --git a/packages/grpc-native-core/jsdoc_conf.json b/packages/grpc-native-core/jsdoc_conf.json index 2d967753..92de2990 100644 --- a/packages/grpc-native-core/jsdoc_conf.json +++ b/packages/grpc-native-core/jsdoc_conf.json @@ -2,14 +2,8 @@ "tags": { "allowUnknownTags": true }, - "source": { - "include": [ "src/node/index.js", "src/node/src" ], - "includePattern": "src/node/.+\\.js(doc)?$", - "excludePattern": "(^|\\/|\\\\)_" - }, "opts": { - "package": "package.json", - "readme": "src/node/README.md" + "destination": "docs/gen/native/core" }, "plugins": ["plugins/markdown"], "templates": { diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 19828430..c01cc81e 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -19,10 +19,7 @@ "lib": "src/node/src" }, "scripts": { - "lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore", - "test": "./node_modules/.bin/mocha test && npm run-script lint", "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", - "gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library" }, @@ -37,16 +34,9 @@ "protobufjs": "^5.0.0" }, "devDependencies": { - "async": "^2.0.1", - "body-parser": "^1.15.2", "electron-mocha": "^3.1.1", - "express": "^4.14.0", - "google-auth-library": "^0.9.2", "google-protobuf": "^3.0.0", - "istanbul": "^0.4.4", - "jsdoc": "^3.3.2", - "minimist": "^1.1.0", - "poisson-process": "^0.2.1" + "istanbul": "^0.4.4" }, "engines": { "node": ">=4" diff --git a/packages/grpc-native-core/templates/package.json.template b/packages/grpc-native-core/templates/package.json.template index 45f52240..0a5cd53e 100644 --- a/packages/grpc-native-core/templates/package.json.template +++ b/packages/grpc-native-core/templates/package.json.template @@ -21,10 +21,7 @@ "lib": "src/node/src" }, "scripts": { - "lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore", - "test": "./node_modules/.bin/mocha test && npm run-script lint", "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", - "gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library" }, @@ -39,19 +36,9 @@ "protobufjs": "^5.0.0" }, "devDependencies": { - "async": "^2.0.1", - "body-parser": "^1.15.2", "electron-mocha": "^3.1.1", - "express": "^4.14.0", - "google-auth-library": "^0.9.2", "google-protobuf": "^3.0.0", - "istanbul": "^0.4.4", - "jsdoc": "^3.3.2", - "jshint": "^2.5.0", - "minimist": "^1.1.0", - "mocha": "^3.0.2", - "mocha-jenkins-reporter": "^0.2.3", - "poisson-process": "^0.2.1" + "istanbul": "^0.4.4" }, "engines": { "node": ">=4" diff --git a/test/gulpfile.js b/test/gulpfile.js index b66b6e01..64a5d059 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -15,6 +15,11 @@ gulp.task('internal.test.clean.links', 'Delete npm links', () => { return del(path.resolve(testDir, 'node_modules/grpc')); }); +gulp.task('internal.test.install', 'Install test dependencies', () => { + return execa('npm', ['install', '--build-from-source', '--unsafe-perm'], + {cwd: testDir, stdio: 'inherit'}); +}); + gulp.task('internal.test.clean.all', 'Delete all files created by tasks', ['internal.test.clean.links']); diff --git a/test/package.json b/test/package.json new file mode 100644 index 00000000..e987314c --- /dev/null +++ b/test/package.json @@ -0,0 +1,25 @@ +{ + "name": "grpc-node-test", + "version": "0.1.0", + "description": "Dummy package for the grpc-node repository tests", + "private": true, + "keywords": [], + "author": { + "name": "Google Inc." + }, + "license": "Apache-2.0", + "contributors": [ + { + "name": "Google Inc." + } + ], + "dependencies": { + "async": "^2.0.1", + "body-parser": "^1.15.2", + "express": "^4.14.0", + "google-auth-library": "^0.9.2", + "lodash": "^4.17.4", + "minimist": "^1.1.0", + "poisson-process": "^0.2.1" + } +} From a03dcfedb74fb84a4b31aab382c0408b066edf7b Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 21 Sep 2017 18:13:37 -0700 Subject: [PATCH 07/12] Added script to merge jenkins logs per node version --- merge_kokoro_logs.js | 38 ++++++++++++++++++++++++++++++++++++++ package.json | 3 ++- run-tests.sh | 12 +++++++----- test/kokoro/linux.cfg | 2 +- test/kokoro/macos.cfg | 2 +- 5 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 merge_kokoro_logs.js diff --git a/merge_kokoro_logs.js b/merge_kokoro_logs.js new file mode 100644 index 00000000..5f524f88 --- /dev/null +++ b/merge_kokoro_logs.js @@ -0,0 +1,38 @@ +const xml2js = require('xml2js'); +const fs = require('fs'); +const path = require('path'); +const util = require('util'); +const readFile = util.promisify(fs.readFile); +const writeFile = util.promisify(fs.writeFile); +const readDir = util.promisify(fs.readdir); + +const rootDir = __dirname; + +readDir(rootDir + '/reports') + .then((dirNames) => + Promise.all(dirNames.map((dirName) => + readDir(path.resolve(rootDir, 'reports', dirName)) + .then((fileNames) => + Promise.all(fileNames.map((name) => + readFile(path.resolve(rootDir, 'reports', dirName, name)) + .then((content) => { + let parser = new xml2js.Parser(); + const parseString = util.promisify(parser.parseString.bind(parser)); + return parseString(content); + }) + )) + ) + .then((objects) => { + let merged = objects[0]; + merged.testsuites.testsuite = Array.prototype.concat.apply([], objects.map((obj) => obj.testsuites.testsuite)); + let builder = new xml2js.Builder(); + let xml = builder.buildObject(merged); + let resultName = path.resolve(rootDir, 'reports', dirName, 'sponge_log.xml'); + console.log(`Writing ${resultName}`); + return writeFile(resultName, xml); + }) + )) + ) + .catch((error) => { + console.error(error); + }); diff --git a/package.json b/package.json index f8aaf17b..4caf864b 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,8 @@ "mocha": "^3.5.3", "through2": "^2.0.3", "tslint": "^5.5.0", - "typescript": "^2.5.1" + "typescript": "^2.5.1", + "xml2js": "^0.4.19" }, "contributors": [ { diff --git a/run-tests.sh b/run-tests.sh index 180517a2..bafed9bd 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -30,6 +30,7 @@ if [ ! -n "$node_versions" ] ; then fi set +ex +nvm install 8 nvm install lts/* nvm use lts/* set -ex @@ -43,7 +44,6 @@ mkdir -p reports for version in ${node_versions} do - cd $ROOT # Install and setup node for the version we want. set +ex echo "Switching to node version $version" @@ -59,12 +59,14 @@ do # Rebuild libraries and run tests. JUNIT_REPORT_PATH="reports/node$version/" JUNIT_REPORT_STACK=1 ./node_modules/.bin/gulp native.test || FAILED="true" - cd "reports/node$version" - for file in * ; do - mv $file $(echo $file | sed 's/\(.*\)\.xml/\1_sponge_log.xml/') - done done +set +ex +nvm use 8 +set -ex + +node merge_kokoro_logs.js + if [ "$FAILED" != "" ] then exit 1 diff --git a/test/kokoro/linux.cfg b/test/kokoro/linux.cfg index 99a4e8ce..c6b2c88f 100644 --- a/test/kokoro/linux.cfg +++ b/test/kokoro/linux.cfg @@ -19,6 +19,6 @@ build_file: "grpc-node/kokoro.sh" timeout_mins: 60 action { define_artifacts { - regex: "github/grpc-node/reports/**" + regex: "github/grpc-node/reports/**/sponge_log.xml" } } diff --git a/test/kokoro/macos.cfg b/test/kokoro/macos.cfg index 99a4e8ce..c6b2c88f 100644 --- a/test/kokoro/macos.cfg +++ b/test/kokoro/macos.cfg @@ -19,6 +19,6 @@ build_file: "grpc-node/kokoro.sh" timeout_mins: 60 action { define_artifacts { - regex: "github/grpc-node/reports/**" + regex: "github/grpc-node/reports/**/sponge_log.xml" } } From 777d9f84803cd05bf83405402bf1bc13d8c799e1 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 22 Sep 2017 10:50:58 -0700 Subject: [PATCH 08/12] Add license notice to several script files --- gulpfile.js | 17 +++++++++++++++++ merge_kokoro_logs.js | 17 +++++++++++++++++ packages/grpc-health-check/gulpfile.js | 17 +++++++++++++++++ packages/grpc-js-core/gulpfile.js | 17 +++++++++++++++++ packages/grpc-native-core/gulpfile.js | 17 +++++++++++++++++ setup.sh | 15 +++++++++++++++ test/gulpfile.js | 17 +++++++++++++++++ 7 files changed, 117 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 2024412a..114e70b2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,20 @@ +/* + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + const _gulp = require('gulp'); const help = require('gulp-help'); diff --git a/merge_kokoro_logs.js b/merge_kokoro_logs.js index 5f524f88..d8cc98db 100644 --- a/merge_kokoro_logs.js +++ b/merge_kokoro_logs.js @@ -1,3 +1,20 @@ +/* + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + const xml2js = require('xml2js'); const fs = require('fs'); const path = require('path'); diff --git a/packages/grpc-health-check/gulpfile.js b/packages/grpc-health-check/gulpfile.js index 7c66a9cd..6e41de5e 100644 --- a/packages/grpc-health-check/gulpfile.js +++ b/packages/grpc-health-check/gulpfile.js @@ -1,3 +1,20 @@ +/* + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + const _gulp = require('gulp'); const help = require('gulp-help'); const mocha = require('gulp-mocha'); diff --git a/packages/grpc-js-core/gulpfile.js b/packages/grpc-js-core/gulpfile.js index 5a787084..79592139 100644 --- a/packages/grpc-js-core/gulpfile.js +++ b/packages/grpc-js-core/gulpfile.js @@ -1,3 +1,20 @@ +/* + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + 'use strict'; const _gulp = require('gulp'); diff --git a/packages/grpc-native-core/gulpfile.js b/packages/grpc-native-core/gulpfile.js index 7d85cf5b..cfd5384c 100644 --- a/packages/grpc-native-core/gulpfile.js +++ b/packages/grpc-native-core/gulpfile.js @@ -1,3 +1,20 @@ +/* + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + const _gulp = require('gulp'); const help = require('gulp-help'); diff --git a/setup.sh b/setup.sh index b6ecf6d0..896def2a 100755 --- a/setup.sh +++ b/setup.sh @@ -1,3 +1,18 @@ +#!/bin/sh +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + if [ -z $NODE_H2 ]; then echo "\$NODE_H2 must point to a node binary" exit 1 diff --git a/test/gulpfile.js b/test/gulpfile.js index b66b6e01..8dcab40d 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -1,3 +1,20 @@ +/* + * Copyright 2017 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + const _gulp = require('gulp'); const help = require('gulp-help'); const mocha = require('gulp-mocha'); From 311010712f3c1d8c9d6f3537c25fe7dd3acac535 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Thu, 21 Sep 2017 13:51:20 -0700 Subject: [PATCH 09/12] Tying it all together. --- gulpfile.js | 10 +++++++++- packages/grpc-native-core/gulpfile.js | 13 +++++++++++-- packages/grpc-native-core/package.json | 1 + run-tests.bat | 22 +++++++++++++++------- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 2024412a..db75e032 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,6 +14,9 @@ const root = __dirname; gulp.task('install.all', 'Install dependencies for all subdirectory packages', ['js.core.install', 'native.core.install', 'health-check.install']); +gulp.task('install.all.windows', 'Install dependencies for all subdirectory packages for MS Windows', + ['js.core.install', 'native.core.install.windows', 'health-check.install']); + gulp.task('lint', 'Emit linting errors in source and test files', ['js.core.lint', 'native.core.lint']); @@ -30,7 +33,12 @@ gulp.task('link', 'Link local packages together after building', gulp.start('link.only'); }); -gulp.task('setup', 'One-time setup for a clean repository', ['install.all', 'link']); +gulp.task('setup', 'One-time setup for a clean repository', ['install.all'], () => { + gulp.start('link'); +}); +gulp.task('setup.windows', 'One-time setup for a clean repository for MS Windows', ['install.all.windows'], () => { + gulp.start('link'); +}); gulp.task('clean', 'Delete generated files', ['js.core.clean', 'native.core.clean']); diff --git a/packages/grpc-native-core/gulpfile.js b/packages/grpc-native-core/gulpfile.js index 7d85cf5b..07fadde8 100644 --- a/packages/grpc-native-core/gulpfile.js +++ b/packages/grpc-native-core/gulpfile.js @@ -30,7 +30,16 @@ gulp.task('native.core.install', 'Install native core dependencies', () => { {cwd: nativeCoreDir, stdio: 'inherit'}); }); -gulp.task('native.core.link.create', 'Create npm link', ['native.core.install'], () => { +gulp.task('native.core.install.windows', 'Install native core dependencies for MS Windows', () => { + return execa('npm', ['install', '--build-from-source'], + {cwd: nativeCoreDir, stdio: 'inherit'}).catch(() => +del(path.resolve(process.env.USERPROFILE, '.node-gyp', process.versions.node, 'include/node/openssl'), { force: true }).then(() => +execa('npm', ['install', '--build-from-source'], + {cwd: nativeCoreDir, stdio: 'inherit'}) + )) +}); + +gulp.task('native.core.link.create', 'Create npm link', () => { return execa('npm', ['link'], {cwd: nativeCoreDir, stdio: 'inherit'}); }); @@ -41,7 +50,7 @@ gulp.task('native.core.lint', 'Emits linting errors', () => { }); gulp.task('native.core.build', 'Build native package', () => { - return execa('node-pre-gyp', ['build'], {cwd: nativeCoreDir, stdio: 'inherit'}); + return execa('npm', ['run', 'build'], {cwd: nativeCoreDir, stdio: 'inherit'}); }); gulp.task('native.core.test', 'Run all tests', ['native.core.build'], () => { diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index 19828430..6ad9013b 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -21,6 +21,7 @@ "scripts": { "lint": "node ./node_modules/jshint/bin/jshint src test index.js --exclude-path=.jshintignore", "test": "./node_modules/.bin/mocha test && npm run-script lint", + "build": "./node_modules/.bin/node-pre-gyp build", "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", "gen_docs": "./node_modules/.bin/jsdoc -c jsdoc_conf.json", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test", diff --git a/run-tests.bat b/run-tests.bat index 8f6e39c5..207efed2 100644 --- a/run-tests.bat +++ b/run-tests.bat @@ -25,14 +25,22 @@ nvm version nvm install 8.5.0 nvm use 8.5.0 -node -e console.log(process.versions) -call npm install --build-from-source +call npm install || goto :error -@rem delete the redundant openssl headers -for /f "delims=v" %%v in ('node --version') do ( - rmdir "%USERPROFILE%\.node-gyp\%%v\include\node\openssl" /S /Q +for %%v in (4.8.4 6.11.3 7.9.0 8.5.0) do ( + nvm install %%v + nvm use %%v + node -e "console.log(process.versions)" + + call .\node_modules\.bin\gulp clean.all || goto :error + call .\node_modules\.bin\gulp setup.windows || goto :error + call .\node_modules\.bin\gulp native.test || goto :error ) -@rem rebuild, because it probably failed the first time -call npm install --build-from-source %* +if %errorlevel% neq 0 exit /b %errorlevel% + +goto :EOF + +:error +exit /b 1 From b5b1f205652b77438208c2eda85cd0c5de45b3c4 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 22 Sep 2017 22:37:15 +0200 Subject: [PATCH 10/12] Fixing Linux tests. --- run-tests.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index bafed9bd..c1a76889 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -36,7 +36,6 @@ nvm use lts/* set -ex npm install --unsafe-perm -./node_modules/.bin/gulp setup mkdir -p reports @@ -55,7 +54,7 @@ do # Install dependencies and link packages together. ./node_modules/.bin/gulp clean.all - ./node_modules/.bin/gulp link + ./node_modules/.bin/gulp setup # Rebuild libraries and run tests. JUNIT_REPORT_PATH="reports/node$version/" JUNIT_REPORT_STACK=1 ./node_modules/.bin/gulp native.test || FAILED="true" From f1fb87245d357677226dae0b792a9da6f27da49c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 25 Sep 2017 14:48:02 -0700 Subject: [PATCH 11/12] Readded an npm script --- packages/grpc-native-core/package.json | 1 + packages/grpc-native-core/templates/package.json.template | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/grpc-native-core/package.json b/packages/grpc-native-core/package.json index c01cc81e..1a6ecde0 100644 --- a/packages/grpc-native-core/package.json +++ b/packages/grpc-native-core/package.json @@ -19,6 +19,7 @@ "lib": "src/node/src" }, "scripts": { + "build": "./node_modules/.bin/node-pre-gyp build", "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library" diff --git a/packages/grpc-native-core/templates/package.json.template b/packages/grpc-native-core/templates/package.json.template index 0a5cd53e..fc188eaa 100644 --- a/packages/grpc-native-core/templates/package.json.template +++ b/packages/grpc-native-core/templates/package.json.template @@ -21,6 +21,7 @@ "lib": "src/node/src" }, "scripts": { + "build": "./node_modules/.bin/node-pre-gyp build", "electron-build": "./node_modules/.bin/node-pre-gyp configure build --runtime=electron --disturl=https://atom.io/download/atom-shell", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library" From f27449a076bf3bcf3ba5c573702193d478dc6561 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 28 Sep 2017 17:13:02 -0700 Subject: [PATCH 12/12] Add missing gulp dependency, remove unnecessary flags from one task --- gulpfile.js | 2 +- test/gulpfile.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index c808cdcf..f1a333e4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -32,7 +32,7 @@ gulp.task('install.all', 'Install dependencies for all subdirectory packages', ['js.core.install', 'native.core.install', 'health-check.install', 'internal.test.install']); gulp.task('install.all.windows', 'Install dependencies for all subdirectory packages for MS Windows', - ['js.core.install', 'native.core.install.windows', 'health-check.install']); + ['js.core.install', 'native.core.install.windows', 'health-check.install', 'internal.test.install']); gulp.task('lint', 'Emit linting errors in source and test files', ['js.core.lint', 'native.core.lint']); diff --git a/test/gulpfile.js b/test/gulpfile.js index 326df8a4..469f8d23 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -33,8 +33,7 @@ gulp.task('internal.test.clean.links', 'Delete npm links', () => { }); gulp.task('internal.test.install', 'Install test dependencies', () => { - return execa('npm', ['install', '--build-from-source', '--unsafe-perm'], - {cwd: testDir, stdio: 'inherit'}); + return execa('npm', ['install'], {cwd: testDir, stdio: 'inherit'}); }); gulp.task('internal.test.clean.all', 'Delete all files created by tasks',