Skip to content
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

Increase cmake minimum required [16436] #72

Merged
merged 3 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
###############################################################################
# CMake build rules for Micro CDR
###############################################################################
cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR)
Copy link

@Ryanf55 Ryanf55 Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI environment has not yet been updated to have this new version. Linux jobs are failing due to it.
http://jenkins.eprosima.com:8080/view/Micro%20XRCE/job/Micro-CDR%20Nightly%20Master%20Linux/1232/console

[Micro-CDR Nightly Master Linux] $ /home/jenkins/tools/hudson.plugins.cmake.CmakeTool/3.10.0/bin/cmake --version
cmake version 3.10.0
...
CMake Error at CMakeLists.txt:18 (cmake_minimum_required):
  CMake 3.15 or higher is required.  You are running version 3.10.0


-- Configuring incomplete, errors occurred!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake_minimum_required(VERSION 3.15)

###############################################################################
# Build options
Expand Down
2 changes: 1 addition & 1 deletion cmake/SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(UCDR_BUILD_TESTS)
GIT_REPOSITORY
https://github.com/google/googletest.git
GIT_TAG
v1.10.x
release-1.11.0
PREFIX
${PROJECT_BINARY_DIR}/googletest
INSTALL_DIR
Expand Down
8 changes: 7 additions & 1 deletion test/Alignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ class Alignment : public BasicSerialization, public ::testing::WithParamInterfac

};

INSTANTIATE_TEST_SUITE_P(Offset, Alignment, ::testing::Range(0, 17), ::testing::PrintToStringParamName());
#ifdef INSTANTIATE_TEST_SUITE_P
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_SUITE_P(x, y, z, w)
#else
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_CASE_P(x, y, z, w)
#endif // ifdef INSTANTIATE_TEST_SUITE_P

GTEST_INSTANTIATE_TEST_MACRO(Offset, Alignment, ::testing::Range(0, 17), ::testing::PrintToStringParamName());

TEST_P(Alignment, Block_8)
{
Expand Down
20 changes: 10 additions & 10 deletions test/CommonFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <ucdr/microcdr.h>
#include <cstring>

#define BUFFER_LENGTH 1024
#define BUFFER_LENGTH 1024UL

bool operator ==(
const ucdrBuffer& rhs,
Expand Down Expand Up @@ -56,7 +56,7 @@ TEST_F(CommonFunctions, ucdr_init_buffer)
EXPECT_EQ(ub.init, buffer);
EXPECT_EQ(ub.final, ub.init + BUFFER_LENGTH);
EXPECT_EQ(ub.iterator, ub.init);
EXPECT_EQ(ub.origin, 0);
EXPECT_EQ(ub.origin, 0UL);
EXPECT_EQ(ub.offset, ub.origin);
EXPECT_EQ(ub.endianness, UCDR_MACHINE_ENDIANNESS);
EXPECT_EQ(ub.last_data_size, 0);
Expand Down Expand Up @@ -145,29 +145,29 @@ TEST_F(CommonFunctions, ucdr_align)
size_t offset = 1;

ucdr_init_buffer_origin_offset(&ub, buffer, BUFFER_LENGTH, origin, offset);
EXPECT_EQ(ucdr_alignment(offset, 1), 0);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 1), 0);
EXPECT_EQ(ucdr_alignment(offset, 1), 0UL);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 1), 0UL);
ucdr_align_to(&ub, 1);
EXPECT_EQ(ub.iterator, ub.init + 1);
EXPECT_EQ(ub.offset, ub.origin + 1);

ucdr_reset_buffer_offset(&ub, offset);
EXPECT_EQ(ucdr_alignment(offset, 2), 1);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 2), 0);
EXPECT_EQ(ucdr_alignment(offset, 2), 1UL);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 2), 0UL);
ucdr_align_to(&ub, 2);
EXPECT_EQ(ub.iterator, ub.init + 1);
EXPECT_EQ(ub.offset, ub.origin + 1);

ucdr_reset_buffer_offset(&ub, offset);
EXPECT_EQ(ucdr_alignment(offset, 4), 3);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 4), 2);
EXPECT_EQ(ucdr_alignment(offset, 4), 3UL);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 4), 2UL);
ucdr_align_to(&ub, 4);
EXPECT_EQ(ub.iterator, ub.init + 3);
EXPECT_EQ(ub.offset, ub.origin + 3);

ucdr_reset_buffer_offset(&ub, offset);
EXPECT_EQ(ucdr_alignment(offset, 8), 7);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 8), 6);
EXPECT_EQ(ucdr_alignment(offset, 8), 7UL);
EXPECT_EQ(ucdr_buffer_alignment(&ub, 8), 6UL);
ucdr_align_to(&ub, 8);
EXPECT_EQ(ub.iterator, ub.init + 7);
EXPECT_EQ(ub.offset, ub.origin + 7);
Expand Down
8 changes: 4 additions & 4 deletions test/SequenceOverflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SequenceOverflow : public SequenceSerialization

TEST_F(SequenceOverflow, Block1)
{
uint8_t input[SEQUENCE_SIZE_OVERFLOW];
uint8_t input[SEQUENCE_SIZE_OVERFLOW] = {0};
uint8_t output[ARRAY_CAPACITY] = {0};

EXPECT_TRUE(ucdr_serialize_sequence_uint8_t(&writer, input, SEQUENCE_SIZE_OVERFLOW));
Expand All @@ -48,7 +48,7 @@ TEST_F(SequenceOverflow, Block1)

TEST_F(SequenceOverflow, Block2)
{
uint16_t input[SEQUENCE_SIZE_OVERFLOW];
uint16_t input[SEQUENCE_SIZE_OVERFLOW] = {0};
uint16_t output[ARRAY_CAPACITY] = {0};

EXPECT_TRUE(ucdr_serialize_sequence_uint16_t(&writer, input, SEQUENCE_SIZE_OVERFLOW));
Expand All @@ -57,7 +57,7 @@ TEST_F(SequenceOverflow, Block2)

TEST_F(SequenceOverflow, Block4)
{
uint32_t input[SEQUENCE_SIZE_OVERFLOW];
uint32_t input[SEQUENCE_SIZE_OVERFLOW] = {0};
uint32_t output[ARRAY_CAPACITY] = {0};

EXPECT_TRUE(ucdr_serialize_sequence_uint32_t(&writer, input, SEQUENCE_SIZE_OVERFLOW));
Expand All @@ -66,7 +66,7 @@ TEST_F(SequenceOverflow, Block4)

TEST_F(SequenceOverflow, Block8)
{
uint64_t input[SEQUENCE_SIZE_OVERFLOW];
uint64_t input[SEQUENCE_SIZE_OVERFLOW] = {0};
uint64_t output[ARRAY_CAPACITY] = {0};

EXPECT_TRUE(ucdr_serialize_sequence_uint64_t(&writer, input, SEQUENCE_SIZE_OVERFLOW));
Expand Down
8 changes: 7 additions & 1 deletion test/endianness/ArrayEndianness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,11 @@ TEST_P(ArrayEndianness, Double)
EXPECT_TRUE(0 == std::memcmp(input, output, ARRAY_SIZE * sizeof(input[0])));
}

INSTANTIATE_TEST_SUITE_P(ucdrEndianness, ArrayEndianness,
#ifdef INSTANTIATE_TEST_SUITE_P
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z) INSTANTIATE_TEST_SUITE_P(x, y, z)
#else
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z) INSTANTIATE_TEST_CASE_P(x, y, z)
#endif // ifdef INSTANTIATE_TEST_SUITE_P

GTEST_INSTANTIATE_TEST_MACRO(ucdrEndianness, ArrayEndianness,
::testing::Values(UCDR_LITTLE_ENDIANNESS, UCDR_BIG_ENDIANNESS));
8 changes: 7 additions & 1 deletion test/endianness/BasicEndianness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,11 @@ TEST_P(BasicEndianness, Double)
EXPECT_EQ(input, output);
}

INSTANTIATE_TEST_SUITE_P(ucdrEndianness, BasicEndianness,
#ifdef INSTANTIATE_TEST_SUITE_P
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z) INSTANTIATE_TEST_SUITE_P(x, y, z)
#else
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z) INSTANTIATE_TEST_CASE_P(x, y, z)
#endif // ifdef INSTANTIATE_TEST_SUITE_P
//
GTEST_INSTANTIATE_TEST_MACRO(ucdrEndianness, BasicEndianness,
::testing::Values(UCDR_LITTLE_ENDIANNESS, UCDR_BIG_ENDIANNESS));
8 changes: 7 additions & 1 deletion test/endianness/SequenceEndianness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,11 @@ TEST_P(SequenceEndianness, Double)
EXPECT_TRUE(0 == std::memcmp(input, output, SEQUENCE_SIZE * sizeof(input[0])));
}

INSTANTIATE_TEST_SUITE_P(ucdrEndianness, SequenceEndianness,
#ifdef INSTANTIATE_TEST_SUITE_P
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z) INSTANTIATE_TEST_SUITE_P(x, y, z)
#else
#define GTEST_INSTANTIATE_TEST_MACRO(x, y, z) INSTANTIATE_TEST_CASE_P(x, y, z)
#endif // ifdef INSTANTIATE_TEST_SUITE_P
//
GTEST_INSTANTIATE_TEST_MACRO(ucdrEndianness, SequenceEndianness,
::testing::Values(UCDR_LITTLE_ENDIANNESS, UCDR_BIG_ENDIANNESS));