Add ability to run Node tests on Linux

It uses the Android ExternalCommitHelper implementation.

The Dockerfile requires that you have a static library build of core for Linux with PIC enabled.
This commit is contained in:
Scott Kyle 2016-04-21 17:45:17 -07:00
parent ab05c5f732
commit 12517a0d1e
7 changed files with 124 additions and 6 deletions

26
.dockerignore Normal file
View File

@ -0,0 +1,26 @@
**/*.orig
**/build/
**/node_modules/
core*
.git/
android/
docs/
examples/
react-native/
vendor/
src/android/
src/ios/
src/object-store/**/*.ninja
src/object-store/**/.ninja*
src/object-store/**/cmake_install.cmake
src/object-store/**/CMakeFiles/
src/object-store/**/Makefile
src/object-store/src/librealm-object-store.*
src/object-store/tests/tests
tests/ios/
tests/react-test-app/

34
Dockerfile Normal file
View File

@ -0,0 +1,34 @@
FROM node:6
# Make debugging quicker.
RUN apt-get update && apt-get install -y gdb vim
# Add non-root user.
RUN useradd -ms /bin/bash user
# Make our workspace directory and work from there.
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Get the node_modules setup before anything else.
COPY package.json .
RUN npm install
# Copy only what we need to build.
ADD realm-core-linux-0.100.3.tar.gz core/
COPY src/ src/
# Build the Debug version of the module.
RUN src/node/build-node.sh Debug
# Copy everything else needed to run tests.
COPY lib/ lib/
COPY scripts/ scripts/
COPY tests/ tests/
# Switch to the non-root user.
RUN chown -R user .
USER user
# Default to running the Node tests
CMD ["node", "tests"]

View File

@ -51,7 +51,9 @@ if [[ $1 = "--version" ]]; then
exit 0
fi
if [ ! -e core ]; then
if [ "$(uname)" != 'Darwin' ]; then
echo "Skipped downloading core on a non-Apple platform."
elif [ ! -e core ]; then
download_core
elif [ -d core -a -d ../realm-core -a ! -L core ]; then
# Allow newer versions than expected for local builds as testing

View File

@ -50,6 +50,9 @@
F620F0581CB766DA0082977B /* node_init.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F620F0571CB766DA0082977B /* node_init.cpp */; };
F620F0751CB9F60C0082977B /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F620F0741CB9F60C0082977B /* CoreFoundation.framework */; };
F63117F01CEB0D5F00ECB2DE /* weak_realm_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F63117EE1CEB0D5900ECB2DE /* weak_realm_notifier.cpp */; };
F63118471CEBA7B700ECB2DE /* external_commit_helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F63118431CEBA7B700ECB2DE /* external_commit_helper.cpp */; };
F63118481CEBA7B700ECB2DE /* weak_realm_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F63118451CEBA7B700ECB2DE /* weak_realm_notifier.cpp */; };
F631184D1CEBA7D800ECB2DE /* external_commit_helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F631184A1CEBA7D800ECB2DE /* external_commit_helper.cpp */; };
F63FF2C61C12469E00B3B8E0 /* jsc_init.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048011C0428DF00ABDED4 /* jsc_init.cpp */; };
F63FF2C91C12469E00B3B8E0 /* js_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 029048071C0428DF00ABDED4 /* js_realm.cpp */; };
F63FF2CD1C12469E00B3B8E0 /* rpc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0290480F1C0428DF00ABDED4 /* rpc.cpp */; };
@ -197,6 +200,13 @@
F62BF8FB1CAC71780022BCDC /* libRealmNode.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libRealmNode.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
F63117EE1CEB0D5900ECB2DE /* weak_realm_notifier.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = weak_realm_notifier.cpp; sourceTree = "<group>"; };
F63117EF1CEB0D5900ECB2DE /* weak_realm_notifier.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = weak_realm_notifier.hpp; sourceTree = "<group>"; };
F63118431CEBA7B700ECB2DE /* external_commit_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = external_commit_helper.cpp; sourceTree = "<group>"; };
F63118441CEBA7B700ECB2DE /* external_commit_helper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = external_commit_helper.hpp; sourceTree = "<group>"; };
F63118451CEBA7B700ECB2DE /* weak_realm_notifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = weak_realm_notifier.cpp; sourceTree = "<group>"; };
F63118461CEBA7B700ECB2DE /* weak_realm_notifier.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = weak_realm_notifier.hpp; sourceTree = "<group>"; };
F631184A1CEBA7D800ECB2DE /* external_commit_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = external_commit_helper.cpp; sourceTree = "<group>"; };
F631184B1CEBA7D800ECB2DE /* external_commit_helper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = external_commit_helper.hpp; sourceTree = "<group>"; };
F631184C1CEBA7D800ECB2DE /* weak_realm_notifier.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = weak_realm_notifier.hpp; sourceTree = "<group>"; };
F63FF2B11C1241E500B3B8E0 /* libRealmJS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRealmJS.a; sourceTree = BUILT_PRODUCTS_DIR; };
F63FF2F01C16405C00B3B8E0 /* libGCDWebServers.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libGCDWebServers.a; sourceTree = BUILT_PRODUCTS_DIR; };
F63FF2FD1C1642BB00B3B8E0 /* GCDWebServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCDWebServer.h; sourceTree = "<group>"; };
@ -442,7 +452,9 @@
F63117EA1CEB0BFA00ECB2DE /* impl */ = {
isa = PBXGroup;
children = (
F63118421CEBA7A100ECB2DE /* android */,
F63117EB1CEB0C1B00ECB2DE /* apple */,
F63118491CEBA7BD00ECB2DE /* generic */,
F63117ED1CEB0CC600ECB2DE /* node */,
02414B991CE6AAEF00A8669F /* collection_change_builder.cpp */,
02414B9A1CE6AAEF00A8669F /* collection_change_builder.hpp */,
@ -496,6 +508,27 @@
path = node;
sourceTree = "<group>";
};
F63118421CEBA7A100ECB2DE /* android */ = {
isa = PBXGroup;
children = (
F63118431CEBA7B700ECB2DE /* external_commit_helper.cpp */,
F63118441CEBA7B700ECB2DE /* external_commit_helper.hpp */,
F63118451CEBA7B700ECB2DE /* weak_realm_notifier.cpp */,
F63118461CEBA7B700ECB2DE /* weak_realm_notifier.hpp */,
);
path = android;
sourceTree = "<group>";
};
F63118491CEBA7BD00ECB2DE /* generic */ = {
isa = PBXGroup;
children = (
F631184A1CEBA7D800ECB2DE /* external_commit_helper.cpp */,
F631184B1CEBA7D800ECB2DE /* external_commit_helper.hpp */,
F631184C1CEBA7D800ECB2DE /* weak_realm_notifier.hpp */,
);
path = generic;
sourceTree = "<group>";
};
F63FF2FB1C1642BB00B3B8E0 /* GCDWebServer */ = {
isa = PBXGroup;
children = (
@ -846,6 +879,7 @@
F63FF31C1C1642BB00B3B8E0 /* GCDWebServerConnection.m in Sources */,
F63FF3201C1642BB00B3B8E0 /* GCDWebServerDataRequest.m in Sources */,
F63FF3221C1642BB00B3B8E0 /* GCDWebServerMultiPartFormRequest.m in Sources */,
F631184D1CEBA7D800ECB2DE /* external_commit_helper.cpp in Sources */,
F63FF3211C1642BB00B3B8E0 /* GCDWebServerFileRequest.m in Sources */,
F63FF31F1C1642BB00B3B8E0 /* GCDWebServerResponse.m in Sources */,
F63FF3261C1642BB00B3B8E0 /* GCDWebServerFileResponse.m in Sources */,
@ -853,7 +887,9 @@
F63FF3241C1642BB00B3B8E0 /* GCDWebServerDataResponse.m in Sources */,
F63FF31B1C1642BB00B3B8E0 /* GCDWebServer.m in Sources */,
F63FF31D1C1642BB00B3B8E0 /* GCDWebServerFunctions.m in Sources */,
F63118481CEBA7B700ECB2DE /* weak_realm_notifier.cpp in Sources */,
F63FF3251C1642BB00B3B8E0 /* GCDWebServerErrorResponse.m in Sources */,
F63118471CEBA7B700ECB2DE /* external_commit_helper.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -20,7 +20,6 @@
"../object-store/src/impl/realm_coordinator.cpp",
"../object-store/src/impl/results_notifier.cpp",
"../object-store/src/impl/transact_log_handler.cpp",
"../object-store/src/impl/apple/external_commit_helper.cpp",
"../object-store/src/impl/node/weak_realm_notifier.cpp",
"../object-store/src/parser/parser.cpp",
"../object-store/src/parser/query_builder.cpp",
@ -44,15 +43,36 @@
"REALM_HAVE_CONFIG",
"REALM_PLATFORM_NODE=1"
],
"cflags_cc": ["-fexceptions", "-frtti", "-std=c++14"],
"cflags_cc": [
"-fexceptions",
"-frtti",
"-std=c++14",
"-Wno-missing-field-initializers",
"-Wno-return-type"
],
"libraries": ["-lrealm"],
"xcode_settings": {
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
"CLANG_CXX_LIBRARY": "libc++",
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"GCC_ENABLE_CPP_RTTI": "YES",
"MACOSX_DEPLOYMENT_TARGET": "10.8",
"OTHER_CPLUSPLUSFLAGS": ["-fexceptions", "-frtti"],
"OTHER_LDFLAGS": ["-framework", "Foundation"]
},
"conditions": [
[
"OS=='linux'", {
"sources": [
"../object-store/src/impl/android/external_commit_helper.cpp",
]
}
],
["OS=='mac'", {
"sources": [
"../object-store/src/impl/apple/external_commit_helper.cpp"
]
}]
],
"configurations": {
"Debug": {
"defines": ["DEBUG=1"]

View File

@ -23,7 +23,7 @@
#if REALM_PLATFORM_APPLE
#include "impl/apple/external_commit_helper.hpp"
#elif REALM_ANDROID
#elif REALM_ANDROID || REALM_PLATFORM_NODE
#include "impl/android/external_commit_helper.hpp"
#else
#include "impl/generic/external_commit_helper.hpp"

View File

@ -444,7 +444,7 @@ public:
LinkViewObserver(_impl::TransactionChangeInfo& info)
: m_info(info) { }
void mark_dirty(size_t row, __unused size_t col)
void mark_dirty(size_t row, size_t)
{
if (auto change = get_change())
change->modify(row);