Skip to content

Commit

Permalink
MINIFICPP-2048 ARM64 support part 1
Browse files Browse the repository at this point in the history
includes:
- MINIFICPP-2049 update crc32c
- MINIFICPP-2050 AWS tests compilation fix for ARM
- MINIFICPP-2051 updated ossp-uuid config.guess
- MINIFICPP-2052 unsigned/signed char fixes

Signed-off-by: Ferenc Gerlits <fgerlits@gmail.com>
This closes #1517
  • Loading branch information
martinzink authored and fgerlits committed Mar 8, 2023
1 parent 7ad624d commit 06d5467
Show file tree
Hide file tree
Showing 14 changed files with 5,577 additions and 39 deletions.
13 changes: 7 additions & 6 deletions cmake/BundledOSSPUUID.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
function(use_bundled_osspuuid SOURCE_DIR BINARY_DIR)
message("Using bundled ossp-uuid")

# Define patch step
# if already applied, reverse application should succeed
set(PC ${Bash_EXECUTABLE} -c "set -x && (\"${Patch_EXECUTABLE}\" -p1 -N -i \"${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-mac-fix.patch\" &&\
\"${Patch_EXECUTABLE}\" -p1 -N -i \"${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-no-prog.patch\") ||\
(\"${Patch_EXECUTABLE}\" -p1 -R --dry-run -i \"${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-mac-fix.patch\" &&\
\"${Patch_EXECUTABLE}\" -p1 -R --dry-run -i \"${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-no-prog.patch\")")
set(PATCH_FILE1 "${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-mac-fix.patch")
set(PATCH_FILE2 "${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-no-prog.patch")
set(PATCH_FILE3 "${SOURCE_DIR}/thirdparty/ossp-uuid/ossp-uuid-update-config-guess.patch")
set(PC ${Bash_EXECUTABLE} -c "set -x &&\
(\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE1}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE1}\") &&\
(\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE2}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE2}\") &&\
(\"${Patch_EXECUTABLE}\" -p1 -R -s -f --dry-run -i \"${PATCH_FILE3}\" || \"${Patch_EXECUTABLE}\" -p1 -N -i \"${PATCH_FILE3}\") ")

# Define byproducts
set(BYPRODUCTS "lib/libuuid.a"
Expand Down
4 changes: 2 additions & 2 deletions cmake/Crc32c.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ set(CRC32C_BUILD_BENCHMARKS OFF CACHE INTERNAL crc32-benchmarks-off)
set(CRC32C_INSTALL ON CACHE INTERNAL crc32-install-on)
FetchContent_Declare(
crc32c
URL https://github.com/google/crc32c/archive/refs/tags/1.1.1.tar.gz
URL_HASH SHA256=a6533f45b1670b5d59b38a514d82b09c6fb70cc1050467220216335e873074e8
URL https://github.com/google/crc32c/archive/refs/tags/1.1.2.tar.gz
URL_HASH SHA256=ac07840513072b7fcebda6e821068aa04889018f24e10e46181068fb214d7e56
)
FetchContent_MakeAvailable(crc32c)
add_library(Crc32c::crc32c ALIAS crc32c)
1 change: 1 addition & 0 deletions cmake/JsonSchemaValidator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ FetchContent_Declare(json-schema-validator

FetchContent_MakeAvailable(json-schema-validator)

target_compile_options(nlohmann_json_schema_validator PRIVATE -fsigned-char)
if (NOT WIN32)
target_compile_options(nlohmann_json_schema_validator PRIVATE -Wno-error)
endif()
2 changes: 1 addition & 1 deletion extensions/aws/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ if(WIN32)
target_compile_definitions(minifi-aws INTERFACE "AWS_S3_API=__declspec(dllimport)")
endif()

register_extension(minifi-aws "AWS EXTENSIONS" AWS-EXTENSIONS "This enables AWS support" "${TEST_DIR}/aws-tests")
register_extension(minifi-aws "AWS EXTENSIONS" AWS-EXTENSIONS "This enables AWS support" "extensions/aws/tests")

register_extension_linter(minifi-aws-extensions-linter)
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <cstdlib>
#include <memory>

#include "../TestBase.h"
#include "../Catch.h"
#include "TestBase.h"
#include "Catch.h"
#include "controllerservices/AWSCredentialsService.h"
#include "../Utils.h"
#include "Utils.h"
#include "core/controller/ControllerServiceNode.h"

class AWSCredentialsServiceTestAccessor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#

file(GLOB AWS_INTEGRATION_TESTS "*.cpp")
include(BundledAwsSdkCpp)

SET(AWS_TEST_COUNT 0)
FOREACH(testfile ${AWS_INTEGRATION_TESTS})
Expand All @@ -28,11 +29,13 @@ FOREACH(testfile ${AWS_INTEGRATION_TESTS})
target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/aws/s3")
target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/aws/processors")
target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/expression-language")
target_include_directories(${testfilename} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/libminifi/test")
createTests("${testfilename}")
target_link_libraries(${testfilename} ${CATCH_MAIN_LIB})
target_link_libraries(${testfilename} minifi-aws)
target_link_libraries(${testfilename} minifi-standard-processors)
target_link_libraries(${testfilename} minifi-expression-language-extensions)
target_link_libraries(${testfilename} ${LIBAWS_LIBRARIES})
MATH(EXPR AWS_TEST_COUNT "${AWS_TEST_COUNT}+1")
add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR})
ENDFOREACH()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include <string>

#include "core/Processor.h"
#include "../TestBase.h"
#include "../Catch.h"
#include "TestBase.h"
#include "Catch.h"
#include "processors/GetFile.h"
#include "processors/LogAttribute.h"
#include "processors/UpdateAttribute.h"
Expand Down
45 changes: 20 additions & 25 deletions libminifi/test/unit/StringUtilsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <list>
#include <optional>
#include <random>
Expand All @@ -33,6 +32,9 @@
using org::apache::nifi::minifi::utils::StringUtils;
using utils::as_string;


// NOLINTBEGIN(readability-container-size-empty)

TEST_CASE("StringUtils::chomp works correctly", "[StringUtils][chomp]") {
using pair_of = std::pair<std::string, std::string>;
CHECK(StringUtils::chomp("foobar") == pair_of{"foobar", ""});
Expand Down Expand Up @@ -388,30 +390,22 @@ TEST_CASE("TestStringUtils::testBase64Decode", "[test base64 decode]") {
REQUIRE("oooooo" == StringUtils::from_base64("b29vb29v", as_string));
REQUIRE("\xfb\xff\xbf" == StringUtils::from_base64("-_-_", as_string));
REQUIRE("\xfb\xff\xbf" == StringUtils::from_base64("+/+/", as_string));
REQUIRE(std::string({ 0, 16, -125, 16,
81, -121, 32, -110,
-117, 48, -45, -113,
65, 20, -109, 81,
85, -105, 97, -106,
-101, 113, -41, -97,
-126, 24, -93, -110,
89, -89, -94, -102,
-85, -78, -37, -81,
-61, 28, -77, -45,
93, -73, -29, -98,
-69, -13, -33, -65}) == StringUtils::from_base64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", as_string));
REQUIRE(std::string({ 0, 16, -125, 16,
81, -121, 32, -110,
-117, 48, -45, -113,
65, 20, -109, 81,
85, -105, 97, -106,
-101, 113, -41, -97,
-126, 24, -93, -110,
89, -89, -94, -102,
-85, -78, -37, -81,
-61, 28, -77, -45,
93, -73, -29, -98,
-69, -13, -33, -65}) == StringUtils::from_base64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", as_string));
std::string expected = {
'\x00', '\x10', '\x83', '\x10',
'\x51', '\x87', '\x20', '\x92',
'\x8b', '\x30', '\xd3', '\x8f',
'\x41', '\x14', '\x93', '\x51',
'\x55', '\x97', '\x61', '\x96',
'\x9b', '\x71', '\xd7', '\x9f',
'\x82', '\x18', '\xa3', '\x92',
'\x59', '\xa7', '\xa2', '\x9a',
'\xab', '\xb2', '\xdb', '\xaf',
'\xc3', '\x1c', '\xb3', '\xd3',
'\x5d', '\xb7', '\xe3', '\x9e',
'\xbb', '\xf3', '\xdf', '\xbf'};

REQUIRE(expected == StringUtils::from_base64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", as_string));
REQUIRE(expected == StringUtils::from_base64("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", as_string));

REQUIRE("foobarbuzz" == StringUtils::from_base64("Zm9vYmFyYnV6eg==", as_string));
REQUIRE("foobarbuzz"== StringUtils::from_base64("\r\nZm9vYmFyYnV6eg==", as_string));
Expand Down Expand Up @@ -542,3 +536,4 @@ TEST_CASE("StringUtils::matchesSequence works correctly", "[matchesSequence]") {
REQUIRE(StringUtils::matchesSequence("xxxabcxxxabcxxxdefxxx", {"abc", "abc", "def"}));
REQUIRE(!StringUtils::matchesSequence("xxxabcxxxdefxxx", {"abc", "abc", "def"}));
}
// NOLINTEND(readability-container-size-empty)

0 comments on commit 06d5467

Please sign in to comment.