Merge pull request #8601 from murgatroid99/node_electron_build

Node electron build
pull/9351/head
Michael Lumish 8 years ago committed by GitHub
commit c9a470211c
  1. 144
      binding.gyp
  2. 5
      build.yaml
  3. 2
      package.json
  4. 1
      src/node/ext/completion_queue.h
  5. 63
      src/node/ext/completion_queue_threadpool.cc
  6. 17
      src/node/ext/completion_queue_uv.cc
  7. 2
      src/node/test/surface_test.js
  8. 125
      templates/binding.gyp.template
  9. 2
      templates/package.json.template
  10. 15
      templates/tools/dockerfile/test/node_jessie_x64/Dockerfile.template
  11. 11
      tools/dockerfile/test/node_jessie_x64/Dockerfile
  12. 8
      tools/run_tests/artifacts/build_artifact_node.bat
  13. 8
      tools/run_tests/artifacts/build_artifact_node.sh
  14. 46
      tools/run_tests/helper_scripts/build_node_electron.sh
  15. 39
      tools/run_tests/helper_scripts/pre_build_node_electron.sh
  16. 45
      tools/run_tests/helper_scripts/run_node_electron.sh
  17. 34
      tools/run_tests/run_tests.py
  18. 9
      tools/run_tests/run_tests_matrix.py

@ -37,18 +37,68 @@
# Some of this file is built with the help of
# https://n8.io/converting-a-c-library-to-gyp/
{
'variables': {
'runtime%': 'node'
},
'target_defaults': {
'include_dirs': [
'.',
'include'
],
'defines': [
'GRPC_UV'
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
'conditions': [
['runtime=="node"', {
'defines': [
'GRPC_UV'
]
}],
['OS!="win" and runtime=="electron"', {
"defines": [
'OPENSSL_NO_THREADS'
]
}],
# This is the condition for using boringssl
['OS=="win" or runtime=="electron"', {
"include_dirs": [
"third_party/boringssl/include"
],
"defines": [
'OPENSSL_NO_ASM'
]
}, {
# Based on logic above, we know that this must be a non-Windows system
'variables': {
# The output of "node --version" is "v[version]". We use cut to
# remove the first character.
'target%': '<!(node --version | cut -c2-)'
},
# Empirically, Node only exports ALPN symbols if its major version is >0.
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The target is "[major].[minor].[patch]". We split by
# periods and take the first field to get the major version.
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)'
],
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include',
],
'conditions': [
["target_arch=='ia32'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
}],
["target_arch=='x64'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ]
}],
["target_arch=='arm'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
}]
]
}],
['OS == "win"', {
"include_dirs": [
"third_party/boringssl/include",
"third_party/zlib"
],
"defines": [
@ -58,8 +108,6 @@
'UNICODE',
'_UNICODE',
'NOMINMAX',
'OPENSSL_NO_ASM',
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
"msvs_settings": {
'VCCLCompilerTool': {
@ -72,21 +120,8 @@
}, { # OS != "win"
'variables': {
'config': '<!(echo $CONFIG)',
# The output of "node --version" is "v[version]". We use cut to
# remove the first character.
'target%': '<!(node --version | cut -c2-)'
},
# Empirically, Node only exports ALPN symbols if its major version is >0.
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The target is "[major].[minor].[patch]". We split by
# periods and take the first field to get the major version.
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)',
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib'
],
'conditions': [
@ -101,47 +136,14 @@
'-fprofile-arcs'
]
}
],
["target_arch=='ia32'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
}],
["target_arch=='x64'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ]
}],
["target_arch=='arm'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
}]
]
]
}]
]
},
'conditions': [
['OS == "win"', {
['OS=="win" or runtime=="electron"', {
'targets': [
{
# IMPORTANT WINDOWS BUILD INFORMATION
# This library does not build on Windows without modifying the Node
# development packages that node-gyp downloads in order to build.
# Due to https://github.com/nodejs/node/issues/4932, the headers for
# BoringSSL conflict with the OpenSSL headers included by default
# when including the Node headers. The remedy for this is to remove
# the OpenSSL headers, from the downloaded Node development package,
# which is typically located in `.node-gyp` in your home directory.
'target_name': 'WINDOWS_BUILD_WARNING',
'actions': [
{
'action_name': 'WINDOWS_BUILD_WARNING',
'inputs': [
'package.json'
],
'outputs': [
'ignore_this_part'
],
'action': ['echo', 'IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/']
}
]
},
# Only want to compile BoringSSL and zlib under Windows
{
'cflags': [
'-std=c99',
@ -453,6 +455,34 @@
'third_party/boringssl/ssl/tls_record.c',
]
},
]
}],
['OS == "win"', {
'targets': [
{
# IMPORTANT WINDOWS BUILD INFORMATION
# This library does not build on Windows without modifying the Node
# development packages that node-gyp downloads in order to build.
# Due to https://github.com/nodejs/node/issues/4932, the headers for
# BoringSSL conflict with the OpenSSL headers included by default
# when including the Node headers. The remedy for this is to remove
# the OpenSSL headers, from the downloaded Node development package,
# which is typically located in `.node-gyp` in your home directory.
'target_name': 'WINDOWS_BUILD_WARNING',
'actions': [
{
'action_name': 'WINDOWS_BUILD_WARNING',
'inputs': [
'package.json'
],
'outputs': [
'ignore_this_part'
],
'action': ['echo', 'IMPORTANT: Due to https://github.com/nodejs/node/issues/4932, to build this library on Windows, you must first remove <(node_root_dir)/include/node/openssl/']
}
]
},
# Only want to compile zlib under Windows
{
'cflags': [
'-std=c99',
@ -807,6 +837,11 @@
'-g'
],
"conditions": [
['OS=="win" or runtime=="electron"', {
'dependencies': [
"boringssl",
]
}],
['OS=="mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.9',
@ -818,7 +853,6 @@
}],
['OS=="win"', {
'dependencies': [
"boringssl",
"z",
]
}],
@ -835,8 +869,8 @@
"src/node/ext/call_credentials.cc",
"src/node/ext/channel.cc",
"src/node/ext/channel_credentials.cc",
"src/node/ext/completion_queue.cc",
"src/node/ext/completion_queue_async_worker.cc",
"src/node/ext/completion_queue_threadpool.cc",
"src/node/ext/completion_queue_uv.cc",
"src/node/ext/node_grpc.cc",
"src/node/ext/server.cc",
"src/node/ext/server_credentials.cc",

@ -3851,7 +3851,6 @@ node_modules:
- src/node/ext/channel.h
- src/node/ext/channel_credentials.h
- src/node/ext/completion_queue.h
- src/node/ext/completion_queue_async_worker.h
- src/node/ext/server.h
- src/node/ext/server_credentials.h
- src/node/ext/timeval.h
@ -3870,8 +3869,8 @@ node_modules:
- src/node/ext/call_credentials.cc
- src/node/ext/channel.cc
- src/node/ext/channel_credentials.cc
- src/node/ext/completion_queue.cc
- src/node/ext/completion_queue_async_worker.cc
- src/node/ext/completion_queue_threadpool.cc
- src/node/ext/completion_queue_uv.cc
- src/node/ext/node_grpc.cc
- src/node/ext/server.cc
- src/node/ext/server_credentials.cc

@ -21,6 +21,7 @@
"scripts": {
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js --exclude-path=src/node/.jshintignore",
"test": "./node_modules/.bin/mocha src/node/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 src/node/jsdoc_conf.json",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build"
@ -38,6 +39,7 @@
"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",

@ -32,6 +32,7 @@
*/
#include <v8.h>
#include <grpc/grpc.h>
namespace grpc {
namespace node {

@ -31,18 +31,63 @@
*
*/
/* I don't like using #ifndef, but I don't see a better way to do this */
#ifndef GRPC_UV
#include <node.h>
#include <nan.h>
#include "grpc/grpc.h"
#include "grpc/support/log.h"
#include "grpc/support/time.h"
#include "completion_queue_async_worker.h"
#include "completion_queue.h"
#include "call.h"
namespace grpc {
namespace node {
namespace {
/* A worker that asynchronously calls completion_queue_next, and queues onto the
node event loop a call to the function stored in the event's tag. */
class CompletionQueueAsyncWorker : public Nan::AsyncWorker {
public:
CompletionQueueAsyncWorker();
~CompletionQueueAsyncWorker();
/* Calls completion_queue_next with the provided deadline, and stores the
event if there was one or sets an error message if there was not */
void Execute();
/* Returns the completion queue attached to this class */
static grpc_completion_queue *GetQueue();
/* Convenience function to create a worker with the given arguments and queue
it to run asynchronously */
static void Next();
/* Initialize the CompletionQueueAsyncWorker class */
static void Init(v8::Local<v8::Object> exports);
protected:
/* Called when Execute has succeeded (completed without setting an error
message). Calls the saved callback with the event that came from
completion_queue_next */
void HandleOKCallback();
void HandleErrorCallback();
private:
grpc_event result;
static grpc_completion_queue *queue;
// Number of grpc_completion_queue_next calls in the thread pool
static int current_threads;
// Number of grpc_completion_queue_next calls waiting to enter the thread pool
static int waiting_next_calls;
};
const int max_queue_threads = 2;
using v8::Function;
@ -137,5 +182,21 @@ void CompletionQueueAsyncWorker::HandleErrorCallback() {
DestroyTag(result.tag);
}
} // namespace
grpc_completion_queue *GetCompletionQueue() {
return CompletionQueueAsyncWorker::GetQueue();
}
void CompletionQueueNext() {
CompletionQueueAsyncWorker::Next();
}
void CompletionQueueInit(Local<Object> exports) {
CompletionQueueAsyncWorker::Init(exports);
}
} // namespace node
} // namespace grpc
#endif /* GRPC_UV */

@ -31,6 +31,8 @@
*
*/
#ifdef GRPC_UV
#include <uv.h>
#include <node.h>
#include <v8.h>
@ -38,7 +40,6 @@
#include "call.h"
#include "completion_queue.h"
#include "completion_queue_async_worker.h"
namespace grpc {
namespace node {
@ -81,34 +82,24 @@ void drain_completion_queue(uv_prepare_t *handle) {
}
grpc_completion_queue *GetCompletionQueue() {
#ifdef GRPC_UV
return queue;
#else
return CompletionQueueAsyncWorker::GetQueue();
#endif
}
void CompletionQueueNext() {
#ifdef GRPC_UV
if (pending_batches == 0) {
GPR_ASSERT(!uv_is_active((uv_handle_t *)&prepare));
uv_prepare_start(&prepare, drain_completion_queue);
}
pending_batches++;
#else
CompletionQueueAsyncWorker::Next();
#endif
}
void CompletionQueueInit(Local<Object> exports) {
#ifdef GRPC_UV
queue = grpc_completion_queue_create(NULL);
uv_prepare_init(uv_default_loop(), &prepare);
pending_batches = 0;
#else
CompletionQueueAsyncWorker::Init(exports);
#endif
}
} // namespace node
} // namespace grpc
#endif /* GRPC_UV */

@ -183,6 +183,7 @@ describe('Server.prototype.addProtoService', function() {
assert.strictEqual(err.code, grpc.status.UNIMPLEMENTED);
done();
});
call.on('error', function(status) { /* Do nothing */ });
});
it('should respond to a bidi call with UNIMPLEMENTED', function(done) {
var call = client.divMany();
@ -193,6 +194,7 @@ describe('Server.prototype.addProtoService', function() {
assert.strictEqual(err.code, grpc.status.UNIMPLEMENTED);
done();
});
call.on('error', function(status) { /* Do nothing */ });
call.end();
});
});

@ -39,18 +39,68 @@
# Some of this file is built with the help of
# https://n8.io/converting-a-c-library-to-gyp/
{
'variables': {
'runtime%': 'node'
},
'target_defaults': {
'include_dirs': [
'.',
'include'
],
'defines': [
'GRPC_UV'
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
'conditions': [
['runtime=="node"', {
'defines': [
'GRPC_UV'
]
}],
['OS!="win" and runtime=="electron"', {
"defines": [
'OPENSSL_NO_THREADS'
]
}],
# This is the condition for using boringssl
['OS=="win" or runtime=="electron"', {
"include_dirs": [
"third_party/boringssl/include"
],
"defines": [
'OPENSSL_NO_ASM'
]
}, {
# Based on logic above, we know that this must be a non-Windows system
'variables': {
# The output of "node --version" is "v[version]". We use cut to
# remove the first character.
'target%': '<!(node --version | cut -c2-)'
},
# Empirically, Node only exports ALPN symbols if its major version is >0.
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The target is "[major].[minor].[patch]". We split by
# periods and take the first field to get the major version.
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)'
],
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include',
],
'conditions': [
["target_arch=='ia32'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
}],
["target_arch=='x64'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ]
}],
["target_arch=='arm'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
}]
]
}],
['OS == "win"', {
"include_dirs": [
"third_party/boringssl/include",
"third_party/zlib"
],
"defines": [
@ -60,8 +110,6 @@
'UNICODE',
'_UNICODE',
'NOMINMAX',
'OPENSSL_NO_ASM',
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
"msvs_settings": {
'VCCLCompilerTool': {
@ -74,21 +122,8 @@
}, { # OS != "win"
'variables': {
'config': '<!(echo $CONFIG)',
# The output of "node --version" is "v[version]". We use cut to
# remove the first character.
'target%': '<!(node --version | cut -c2-)'
},
# Empirically, Node only exports ALPN symbols if its major version is >0.
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The target is "[major].[minor].[patch]". We split by
# periods and take the first field to get the major version.
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(echo <(target) | cut -d. -f1)',
'GPR_BACKWARDS_COMPATIBILITY_MODE'
],
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib'
],
'conditions': [
@ -103,21 +138,42 @@
'-fprofile-arcs'
]
}
],
["target_arch=='ia32'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
}],
["target_arch=='x64'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ]
}],
["target_arch=='arm'", {
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
}]
]
]
}]
]
},
'conditions': [
['OS=="win" or runtime=="electron"', {
'targets': [
% for module in node_modules:
% for lib in libs:
% if lib.name in module.transitive_deps and lib.name == 'boringssl':
{
'cflags': [
'-std=c99',
'-Wall',
'-Werror'
],
'target_name': '${lib.name}',
'product_prefix': 'lib',
'type': 'static_library',
'dependencies': [
% for dep in getattr(lib, 'deps', []):
'${dep}',
% endfor
],
'sources': [
% for source in lib.src:
'${source}',
% endfor
]
},
% endif
% endfor
% endfor
]
}],
['OS == "win"', {
'targets': [
{
@ -143,10 +199,10 @@
}
]
},
# Only want to compile BoringSSL and zlib under Windows
# Only want to compile zlib under Windows
% for module in node_modules:
% for lib in libs:
% if lib.name in module.transitive_deps and lib.name in ('boringssl', 'z'):
% if lib.name in module.transitive_deps and lib.name == 'z':
{
'cflags': [
'-std=c99',
@ -223,6 +279,15 @@
'-g'
],
"conditions": [
['OS=="win" or runtime=="electron"', {
'dependencies': [
% for dep in getattr(module, 'deps', []):
% if dep == 'boringssl':
"${dep}",
% endif
% endfor
]
}],
['OS=="mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.9',
@ -235,7 +300,7 @@
['OS=="win"', {
'dependencies': [
% for dep in getattr(module, 'deps', []):
% if dep in ('boringssl', 'z'):
% if dep == 'z':
"${dep}",
% endif
% endfor

@ -23,6 +23,7 @@
"scripts": {
"lint": "node ./node_modules/jshint/bin/jshint src/node/src src/node/test src/node/interop src/node/index.js --exclude-path=src/node/.jshintignore",
"test": "./node_modules/.bin/mocha src/node/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 src/node/jsdoc_conf.json",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build"
@ -40,6 +41,7 @@
"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",

@ -28,10 +28,21 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FROM debian:jessie
<%include file="../../apt_get_basic.include"/>
# Install Electron apt dependencies
RUN apt-get update && apt-get install -y ${'\\'}
libasound2 ${'\\'}
libgconf-2-4 ${'\\'}
libgtk2.0-0 ${'\\'}
libnss3 ${'\\'}
libxss1 ${'\\'}
libxtst6 ${'\\'}
xvfb
<%include file="../../python_deps.include"/>
<%include file="../../node_deps.include"/>
<%include file="../../run_tests_addons.include"/>

@ -63,6 +63,17 @@ RUN apt-get update && apt-get install -y \
# Build profiling
RUN apt-get update && apt-get install -y time && apt-get clean
# Install Electron apt dependencies
RUN apt-get update && apt-get install -y \
libasound2 \
libgconf-2-4 \
libgtk2.0-0 \
libnss3 \
libxss1 \
libxtst6 \
xvfb
#====================
# Python dependencies

@ -29,6 +29,8 @@
set node_versions=1.1.0 2.0.0 3.0.0 4.0.0 5.0.0 6.0.0 7.0.0
set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0
set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm
del /f /q BUILD || rmdir build /s /q
@ -47,6 +49,12 @@ for %%v in (%node_versions%) do (
xcopy /Y /I /S build\stage\* artifacts\ || goto :error
)
for %%v in (%electron_versions%) do (
cmd /V /C "set "HOME=%HOMEDRIVE%%HOMEPATH%\electron-gyp" && call .\node_modules\.bin\node-pre-gyp.cmd configure rebuild package testpackage --runtime=electron --target=%%v --target_arch=%1 --disturl=https://atom.io/download/electron" || goto :error
xcopy /Y /I /S build\stage\* artifacts\ || goto :error
)
if %errorlevel% neq 0 exit /b %errorlevel%
goto :EOF

@ -44,8 +44,16 @@ npm update
node_versions=( 1.1.0 2.0.0 3.0.0 4.0.0 5.0.0 6.0.0 7.0.0 )
electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 )
for version in ${node_versions[@]}
do
./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --target=$version --target_arch=$NODE_TARGET_ARCH
cp -r build/stage/* artifacts/
done
for version in ${electron_versions[@]}
do
HOME=~/.electron-gyp ./node_modules/.bin/node-pre-gyp configure rebuild package testpackage --runtime=electron --target=$version --target_arch=$NODE_TARGET_ARCH --disturl=https://atom.io/download/electron
cp -r build/stage/* artifacts/
done

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ELECTRON_VERSION=$1
source ~/.nvm/nvm.sh
nvm use 6
set -ex
# change to grpc repo root
cd $(dirname $0)/../..
export npm_config_target=$ELECTRON_VERSION
export npm_config_disturl=https://atom.io/download/atom-shell
export npm_config_runtime=electron
export npm_config_build_from_source=true
mkdir -p ~/.electron-gyp
HOME=~/.electron-gyp npm install --unsafe-perm

@ -0,0 +1,39 @@
#!/bin/bash
# Copyright 2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ELECTRON_VERSION=$1
nvm install 6
set -ex
npm install xvfb-maybe
npm install electron@$ELECTRON_VERSION

@ -0,0 +1,45 @@
#!/bin/bash
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
source ~/.nvm/nvm.sh
nvm use 6
set -ex
# change to grpc repo root
cd $(dirname $0)/../..
test_directory='src/node/test'
timeout=8000
JUNIT_REPORT_PATH=src/node/report.xml JUNIT_REPORT_STACK=1 \
./node_modules/.bin/xvfb-maybe \
./node_modules/.bin/electron-mocha --timeout $timeout \
--reporter mocha-jenkins-reporter $test_directory

@ -371,27 +371,43 @@ class NodeLanguage(object):
def configure(self, config, args):
self.config = config
self.args = args
# Note: electron ABI only depends on major and minor version, so that's all
# we should specify in the compiler argument
_check_compiler(self.args.compiler, ['default', 'node0.12',
'node4', 'node5', 'node6',
'node7'])
'node7', 'electron1.3'])
if self.args.compiler == 'default':
self.runtime = 'node'
self.node_version = '4'
else:
# Take off the word "node"
self.node_version = self.args.compiler[4:]
if self.args.compiler.startswith('electron'):
self.runtime = 'electron'
self.node_version = self.args.compiler[8:]
else:
self.runtime = 'node'
# Take off the word "node"
self.node_version = self.args.compiler[4:]
def test_specs(self):
if self.platform == 'windows':
return [self.config.job_spec(['tools\\run_tests\\helper_scripts\\run_node.bat'])]
else:
return [self.config.job_spec(['tools/run_tests/helper_scripts/run_node.sh', self.node_version],
run_script = 'run_node'
if self.runtime == 'electron':
run_script += '_electron'
return [self.config.job_spec(['tools/run_tests/helper_scripts/{}.sh'.format(run_script),
self.node_version],
None,
environ=_FORCE_ENVIRON_FOR_WRAPPERS)]
def pre_build_steps(self):
if self.platform == 'windows':
return [['tools\\run_tests\\helper_scripts\\pre_build_node.bat']]
else:
return [['tools/run_tests/helper_scripts/pre_build_node.sh', self.node_version]]
build_script = 'pre_build_node'
if self.runtime == 'electron':
build_script += '_electron'
return [['tools/run_tests/helper_scripts/{}.sh'.format(build_script), self.node_version]]
def make_targets(self):
return []
@ -403,7 +419,12 @@ class NodeLanguage(object):
if self.platform == 'windows':
return [['tools\\run_tests\\helper_scripts\\build_node.bat']]
else:
return [['tools/run_tests/helper_scripts/build_node.sh', self.node_version]]
build_script = 'build_node'
if self.runtime == 'electron':
build_script += '_electron'
# building for electron requires a patch version
self.node_version += '.0'
return [['tools/run_tests/helper_scripts/{}.sh'.format(build_script), self.node_version]]
def post_tests_steps(self):
return []
@ -1076,6 +1097,7 @@ argp.add_argument('--compiler',
'vs2010', 'vs2013', 'vs2015',
'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3',
'node0.12', 'node4', 'node5', 'node6', 'node7',
'electron1.3',
'coreclr'],
default='default',
help='Selects compiler to use. Allowed values depend on the platform and language.')

@ -231,6 +231,15 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS)
labels=['portability'],
extra_args=extra_args,
inner_jobs=inner_jobs)
test_jobs += _generate_jobs(languages=['node'],
configs=['dbg'],
platforms=['linux'],
arch='default',
compiler='electron1.3',
labels=['portability'],
extra_args=extra_args,
inner_jobs=inner_jobs)
return test_jobs

Loading…
Cancel
Save