-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add windows tests #595
Add windows tests #595
Conversation
@@ -130,6 +143,8 @@ endif() | |||
include(CheckCXXCompilerFlag) | |||
if (WIN32) | |||
add_definitions(-DWIN32_LEAN_AND_MEAN) | |||
add_definitions(-D_CRT_SECURE_NO_WARNINGS) | |||
add_compile_options("/W1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W3 is likely more appropriate
@@ -188,12 +204,12 @@ if (NOT OPENSSL_OFF) | |||
|
|||
else() | |||
include(LibreSSL) | |||
use_libre_ssl(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) | |||
use_libre_ssl("${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to address some odd issues on windows. Same as one below
CMakeLists.txt
Outdated
-DCURL_DISABLE_CRYPTO_AUTH=ON | ||
-DCMAKE_USE_LIBSSH2=OFF | ||
"-DCMAKE_DEBUG_POSTFIX=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odd spacing.
CMakeLists.txt
Outdated
@@ -437,21 +406,16 @@ if(BOOTSTRAP) | |||
return() | |||
endif() | |||
|
|||
message("-------- BOOTSTRAP BEGIN --------") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed at all.
@@ -414,21 +398,6 @@ include_directories(thirdparty/yaml-cpp-yaml-cpp-20171024/include) | |||
include_directories(thirdparty/rapidjson-1.1.0/include) | |||
|
|||
## Expression language extensions | |||
option(DISABLE_EXPRESSION_LANGUAGE "Disables the scripting extensions." OFF) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed because of changes to how we now build EL
cmake/LibreSSL.cmake
Outdated
URL "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.8.3.tar.gz" | ||
### default is openbsd.org -- cloudflare is a reliable mirror | ||
#URL "https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.8.3.tar.gz" | ||
URL "https://cloudflare.cdn.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.8.3.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
during the time of this PR the original OpenBSD link failed.
appveyor.yml
Outdated
|
||
environment: | ||
MSVC_DEFAULT_OPTIONS: ON | ||
APPVEYOR_SAVE_CACHE_ON_ERROR: true | ||
GENERATOR: Ninja |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switching to win_build script
@@ -2,14 +2,14 @@ | |||
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file. | |||
"configurations": [ | |||
{ | |||
"name": "x64-RelWithDebInfo", | |||
"generator": "Ninja", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be an option through the build script.
@@ -620,15 +620,15 @@ target_link_libraries(${ROCKSDB_STATIC_LIB} | |||
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}) | |||
|
|||
if(WIN32) | |||
add_library(${ROCKSDB_IMPORT_LIB} SHARED ${SOURCES}) | |||
# add_library(${ROCKSDB_IMPORT_LIB} SHARED ${SOURCES}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove these commented lines
option(DISABLE_CIVET "Disables CivetWeb components." OFF) | ||
if (NOT DISABLE_CIVET) | ||
createExtension(CIVETWEB CIVETWEB "This enables ListenHTTP" "extensions/civetweb" "${TEST_DIR}/civetweb-tests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test moved to standard processors. civetweb is an extension that really isn't an extension at all because it's required for every other extension. Could be part of core, but it could be disabled if we were willing to disable curl support.
@@ -130,6 +132,7 @@ FOREACH(testfile ${UNIT_TESTS}) | |||
ENDFOREACH() | |||
message("-- Finished building ${UNIT_TEST_COUNT} unit test file(s)...") | |||
|
|||
if(NOT WIN32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving this for a subsequent PR.
@@ -70,19 +70,6 @@ include_directories(${COAP_INCLUDE_DIRS}) | |||
target_link_libraries (nanofi-coap-c ${COAP_LIBRARIES}) | |||
target_link_libraries (nanofi-coap-c ${HTTP-CURL}) | |||
target_link_libraries (minifi-coap nanofi-coap-c ${COAP_LIBRARIES}) | |||
if (WIN32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the cruft that has been copy/pasted. Should consider stubbing out some of this into modular cmake in the future.
namespace expressions { | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need a comment as to why this exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gut reaction is: why is this necessary for this PR? This needs to be explained that linking was problematic given the expression language extension was required in some form. This meant that on Windows, where linking is different, we couldn't enable tests without ensuring the pared down EL existed everywhere. To avoid this, a paradigm I've avoided for quite some time was put into place: hot loading the process context through another artifact.
|
||
virtual std::unique_ptr<ObjectFactory> assign(const std::string &class_name) override { | ||
if (utils::StringUtils::equalsIgnoreCase(class_name, "ProcessContextBuilder")) { | ||
std::cout << "oh boi" << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha!
virtual std::unique_ptr<ObjectFactory> assign(const std::string &class_name) override { | ||
if (utils::StringUtils::equalsIgnoreCase(class_name, "ProcessContextBuilder")) { | ||
std::cout << "oh boi" << std::endl; | ||
return std::unique_ptr<ObjectFactory>(new core::DefautObjectFactory<core::expressions::ExpressionContextBuilder>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case we are using a managed ProcessContextBuilder to support instantiating a different object to construct an EL context.
} | ||
auto name = property.getName(); | ||
if (expressions_.find(name) == expressions_.end()) { | ||
std::string expression_str; | ||
getProperty(name, expression_str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extension does not appear to be linted.
public: | ||
|
||
/** | ||
std::forward of argument list did not work on all platforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment doesn't have much context about its reasoning.
#include <Value.h> | ||
#include <core/FlowFile.h> | ||
#include <core/VariableRegistry.h> | ||
#include "../../common/Value.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this relative path was added by way of the IDE's auto rename. should fix.
@@ -187,13 +195,13 @@ TEST_CASE("GetFile PutFile dynamic attribute", "[expressionLanguageTestGetFilePu | |||
auto repo = std::make_shared<TestRepository>(); | |||
|
|||
std::string in_dir("/tmp/gt.XXXXXX"); | |||
REQUIRE(testController.createTempDirectory(&in_dir[0]) != nullptr); | |||
REQUIRE(!testController.createTempDirectory(&in_dir[0]).empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't serve a great deal of purpose. we should be using the temp dirs not just throwing them away.
@@ -121,7 +121,6 @@ int main(int argc, char **argv) { | |||
|
|||
configuration->set("c2.rest.url", "http://localhost:8727/update"); | |||
configuration->set("c2.agent.heartbeat.period", "1000"); | |||
mkdir("content_repository", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
content repo isn't needed for this test and will be auto-created if need be.
@@ -63,7 +63,7 @@ class Responder : public CivetHandler { | |||
std::string response; | |||
int blockSize = 1024 * sizeof(char), readBytes; | |||
|
|||
char buffer[blockSize]; | |||
char buffer[1024]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows pointed this out. No point in keeping blockSize around.
@@ -52,50 +52,44 @@ namespace minifi { | |||
namespace processors { | |||
|
|||
core::Property GetFile::BatchSize( | |||
core::PropertyBuilder::createProperty("Batch Size")->withDescription("The maximum number of files to pull in each iteration")->withDefaultValue<uint32_t>(10) | |||
->build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artifact of fixing linter errors with eclipse. this is easily avoided by ignoring white space in the review.
@@ -163,11 +157,13 @@ void GetFile::onTrigger(core::ProcessContext *context, core::ProcessSession *ses | |||
if (request_.pollInterval == 0 || (getTimeMillis() - last_listing_time_) > request_.pollInterval) { | |||
std::string directory; | |||
const std::shared_ptr<core::FlowFile> flow_file; | |||
if (!context->getProperty(Directory, directory, flow_file)) { | |||
if (context->getProperty(Directory, directory, flow_file)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appeared to be a logical error found via windows tests.
@@ -0,0 +1,2 @@ | |||
one,two,three |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think our gitignore needs a little work for the windows side...
@@ -67,7 +67,7 @@ TEST_CASE("Test usage of ExtractText", "[extracttextTest]") { | |||
|
|||
char dir[] = "/tmp/gt.XXXXXX"; | |||
|
|||
REQUIRE(testController.createTempDirectory(dir) != nullptr); | |||
REQUIRE(!testController.createTempDirectory(dir).empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again I don't know the purpose of this. This test probably fails currently.
|
||
## Building via the build script | ||
|
||
The preferred way of building the project is via the win_build_vs.bat script found in our root source folder. You must supply a single command, the build directory. Typically you create a directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are additional options. Should add explanations.
@phrocker will scope it out. |
@phrocker had a few stumbles verifying but seems like my VS environment and path was a little messed up in conjunction with not reading the README updates. Following the approaches outlined in the README got me consistent builds using both the profiles in the VS functionality as well as the build script. My WIX installation was good to get MSIs. Overall, build looked good and process was certainly cleaner than the last time I had gone through the process. |
Oh, and to further clarify, I just scoped out the Release w/ & w/o JNI configurations |
@@ -472,7 +472,11 @@ build_cmake_command(){ | |||
if [ $? == 0 ]; then | |||
echo "Using libcurl-openssl..." | |||
else | |||
CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DUSE_CURL_NSS=true .." | |||
if [ "${USE_SHARED_LIBS}" = "${TRUE}" ]; then | |||
CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DUSE_CURL_NSS=true .." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be removed.
623d2c7
to
c1ff70e
Compare
MINIFICPP-883: change appveyor to use winbuild MINIFICPP-833: remove Win64 req MINIFICPP-883: Minor update to move to new image MINIFICPP-796: Enable tests MINIFICPP-796: Update path creator MINIFICPP-796: Minor update MINIFICPP-796: more adjustments MINIFICPP-796: Updates to tests and cmake MINIFICPP-769: Fix inclusion of minifi MINIFICPP-796: remove nanofi MINIFICPP-796: Remove test MINIFICPP-796: Updates Update SecureSocketGetTCPTest.cpp Update appveyor.yml Update appveyor.yml Update appveyor.yml Update CMakeLists.txt com
fix linter errors yet another update update get file and its test update fix logic with test skipping
c1ff70e
to
4ab790d
Compare
@apiri @arpadboda was that comment a +1? I added some code to fix some bugs in tests. Some windows tests fail but I think we can address those later. |
052fc8c
to
223d176
Compare
223d176
to
c58b654
Compare
@apiri thanks. pushed another fix for a unit test and to remove cout statements. will wait for a +1 to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @phrocker,
I performed the build from a semi-clean Windows environment and things look good. I'm sure there will be more work to be done and things to uncover but seems like a great foundation to work from and we can call this initial effort complete. I'll leave it to your preference as to how you wish to merge all these commits in there :)
Still a WIP..
To enable tests on windows I needed to either resolve many dependency issues with linkages or take a more appropriate step, which was make EL a true extension and create a way the process context dynamically. Still have yet to go through and cleanup. Would like to get most tests passing, but there are some tests which still fail in a way that make me suspect of underlying windows code.
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically master)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.