Skip to content
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
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,36 @@ cd build/Debug
cmake --build . -- -j
```

### With Conan for QNX

Before building **up-cpp** we need to build all dependencies from **up-conan-recipes**:

Please follow instruction for QNX build in file [up-conan-recipes/README.md](https://github.com/eclipse-uprotocol/up-conan-recipes/blob/main/README.md)

Pre-requisite:

* Build and install all **QNX build** dependencies from up-conan-recipes
- https://github.com/eclipse-uprotocol/up-conan-recipes

```bash
# setup path to up-conan-recipes
export QNX_CONAN_ROOT=<path_to_up-conan-recipes>

# Install conan toolchain for QNX target
#
# <profile-name>: nto-7.1-aarch64-le, nto-7.1-x86_64, nto-8.0-aarch64-le, nto-8.0-x86_64
# <version-number>: 1.0.0-rc0, 1.0.0, 1.0.1-rc1, 1.0.1
#
conan install -pr:h=$QNX_CONAN_ROOT/tools/profiles/<profile-name> --version=<version-number> --build=missing .

cmake --preset conan-release

cmake --build build/Release -- -j

# all tests you can find under build/Release/bin/
# copy test binaries to your QNX target
```

### Generate UT Coverage

To get code coverage, perform the steps above, but replace `cmake --preset...` with
Expand Down
32 changes: 32 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, cmake_layout, CMakeDeps

class upCoreApiRecipe(ConanFile):
name = "up-cpp"

# Optional metadata
license = "Apache-2.0"
author = "Contributors to the Eclipse Foundation <uprotocol-dev@eclipse.org>"
url = "https://github.com/eclipse-uprotocol/up-cpp"
description = "This library provides a C++ uProtocol API for the development of uEntities"
topics = ("automotive", "iot", "uprotocol", "messaging")

# Binary configuration
settings = "os", "compiler", "build_type", "arch"

def requirements(self):
self.requires("protobuf/3.21.12")
self.requires("spdlog/1.13.0")
self.requires("up-core-api/[~1.6, include_prerelease]")
self.test_requires("gtest/1.14.0")

def layout(self):
cmake_layout(self)

def generate(self):
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
#all warnings have to be fixed
tc.cache_variables["CMAKE_CXX_FLAGS_INIT"] = "-Wno-error=unused-but-set-variable -Wno-error=pedantic -Wno-error=conversion"
tc.generate()
14 changes: 0 additions & 14 deletions conanfile.txt

This file was deleted.

13 changes: 11 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,19 @@ function(add_coverage_test Name)
PRIVATE
GTest::gtest_main
GTest::gmock
pthread
)
target_include_directories(${Name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
gtest_discover_tests(${Name} XML_OUTPUT_DIR results)
if(CMAKE_SYSTEM_NAME MATCHES "QNX")
# QNX provides pthread inside libc and does not need to link pthread lib.
#
# For QNX we are using cross compilation.
# Thus, we can't call gtest_discover_tests()
# Instead, we call old gtest_add_tests()
gtest_add_tests(TARGET ${Name} SOURCES ${ARGN})
else()
target_link_libraries(${Name} PRIVATE pthread)
gtest_discover_tests(${Name} XML_OUTPUT_DIR results)
endif()
endfunction()

# NOTE: This is temporarily just a call to add_coverage_test. When coverage
Expand Down
2 changes: 1 addition & 1 deletion test/coverage/utils/CallbackConnectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ TEST_F(CallbackTest, ReturnValuesAreMoved) { // NOLINT
auto result = callable();
EXPECT_TRUE(result);
EXPECT_EQ(original_string_location, (*result).data());
EXPECT_EQ(EXPECTED_CAPACITY, (*result).capacity());
EXPECT_LE(EXPECTED_CAPACITY, (*result).capacity());
// Just to be safe, check our assumptions about copies vs moves. The
// a_copy variable should hold a copy of the original string, this time
// with a different pointer and capacity.
Expand Down
2 changes: 1 addition & 1 deletion test/coverage/utils/CyclicQueueTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class TestFixture : public testing::Test {
};

// TODO(unknown)
TEST_F(TestFixture, SomeTestName) {} // NOLINT
TEST_F(TestFixture, SomeTestName2) {} // NOLINT

} // namespace
2 changes: 1 addition & 1 deletion test/coverage/utils/IpAddressTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class TestFixture : public testing::Test {
};

// TODO(unknown)
TEST_F(TestFixture, SomeTestName) {} // NOLINT
TEST_F(TestFixture, SomeTestName1) {} // NOLINT

} // namespace
2 changes: 1 addition & 1 deletion test/coverage/utils/ThreadPoolTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class TestFixture : public testing::Test {
};

// TODO(unknown)
TEST_F(TestFixture, SomeTestName) {} // NOLINT
TEST_F(TestFixture, SomeTestName3) {} // NOLINT

} // namespace
2 changes: 1 addition & 1 deletion test/coverage/utils/base64Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class TestFixture : public testing::Test {
};

// TODO(unknown)
TEST_F(TestFixture, SomeTestName) {} // NOLINT
TEST_F(TestFixture, SomeTestName0) {} // NOLINT

} // namespace
Loading