Skip to content

Commit

Permalink
Merge pull request eclipse-iceoryx#559 from ApexAI/iox-#521-improve-c…
Browse files Browse the repository at this point in the history
…odecov

Iox eclipse-iceoryx#521 improve codecov
  • Loading branch information
dkroenke committed Feb 26, 2021
2 parents 37f8242 + 9f117f9 commit 6c79f0c
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 115 deletions.
24 changes: 15 additions & 9 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# codecov yaml
comment: yes # do not comment PR with the result
layout: "reach, diff, flags, files"
behavior: default
require_changes: yes # only post the comment if coverage changes
require_base: no
require_head: yes

coverage:
range: 50..90
range: 70..100

status:
project: # settings affecting project coverage
project:
default:
enabled: yes
target: auto # auto % coverage target
threshold: 100% # we allow here 100% change to unblock PRs (will be set later)

# do not run coverage on patch nor changes
target: 70%
threshold: 2% # allow coverage to drop maximum by a defined value
patch:
default:
enabled: yes
target: auto # auto % coverage target
threshold: 100% # we allow here 100% change to unblock PRs (will be set later)
changes: no
target: 70%
threshold: 2%
changes: yes

parsers:
gcov:
Expand All @@ -26,3 +29,6 @@ parsers:
loop: yes
method: yes
macro: yes

fixes:
- "/home/runner/work/iceoryx/iceoryx/::"
9 changes: 4 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Pre-Review Checklist for the PR Author

1. [ ] Code follows the coding style of [CONTRIBUTING.md][contributing]
1. [ ] Tests follow the [best practice for testing][testing]
1. [ ] Branch follows the naming format (`iox-#123-this-is-a-branch`)
1. [ ] Commits messages are according to this [guideline][commit-guidelines]
- [ ] Commit messages have the issue ID (`iox-#123 commit text`)
Expand All @@ -15,6 +17,8 @@

[commit-guidelines]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[eca]: http://www.eclipse.org/legal/ECA.php
[contributing]: https://github.com/eclipse-iceoryx/iceoryx/blob/master/CONTRIBUTING.md#coding-style
[testing]: https://github.com/eclipse-iceoryx/iceoryx/blob/master/doc/website/advanced/best-practice-for-testing.md

## Notes for Reviewer
<!-- Items in addition to the checklist below that the reviewer should look for -->
Expand All @@ -32,11 +36,6 @@

1. [ ] All open points are addressed and tracked via issues

## Post-review Checklist for the Eclipse Committer

1. [ ] All checkboxes in the PR checklist are checked or crossed out
1. [ ] Merge

## References

- Closes **TBD**
16 changes: 5 additions & 11 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ on:
jobs:
# This job builds & runs iceoryx tests in ubuntu-18.04
iceoryx-ubuntu:
# The type of runner that the job will run on
runs-on: ubuntu-18.04

# Steps represent a sequence of tasks that will be executed as part of the job
Expand All @@ -36,21 +35,17 @@ jobs:

- name: Build sources
run: |
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-strict build-all out-of-tree build-shared
sudo $GITHUB_WORKSPACE/tools/add_test_users.sh
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-strict build-all out-of-tree build-shared test-add-user
- name: Build debian package
run: |
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh package
- name: Run timeless tests
- name: Run all tests
run: |
cd $GITHUB_WORKSPACE/build
make all_tests
- name: Run timing tests
run: |
cd $GITHUB_WORKSPACE/build
make timing_tests
tools/run_tests.sh all
- name: Build RouDi examples without TOML support
run: |
Expand Down Expand Up @@ -87,7 +82,7 @@ jobs:
run: |
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-strict build-all out-of-tree
- name: Run tests
- name: Run tests, excluding timing_tests
run: |
cd $GITHUB_WORKSPACE/build
make all_tests
Expand All @@ -106,7 +101,6 @@ jobs:
- name : Checkout
uses: actions/checkout@v2


- name: Build sources
run: |
cmake -Bbuild -Hiceoryx_meta -DBUILD_TEST=ON -DINTROSPECTION=OFF -DBINDING_C=ON -DEXAMPLES=ON && cmake --build build
25 changes: 12 additions & 13 deletions .github/workflows/coverage_doc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow builds & runs test cases in iceoryx
# This workflow run the coverage scan and generate the doxygen documentation in iceoryx

name: Test Coverage + Doxygen Documentation

Expand All @@ -11,7 +11,6 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This job builds & runs iceoryx tests in ubuntu-18.04
iceoryx-coverage-doxygen-ubuntu:
runs-on: ubuntu-20.04

Expand All @@ -31,26 +30,25 @@ jobs:
- name : Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Build, test and generate gcov report
run: |
mkdir $GITHUB_WORKSPACE/lcov_results
mkdir $GITHUB_WORKSPACE/lcov_results/unittest
# add flag to include coverage
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-strict debug build-all out-of-tree -c unit
sudo $GITHUB_WORKSPACE/tools/add_test_users.sh
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-strict build-all test-add-user -c unit
cp -rf $GITHUB_WORKSPACE/build/lcov/ $GITHUB_WORKSPACE/lcov_results/unittest/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./build/lcov/iceoryx_filter.info
file: ./lcov_results/unittest/lcov/iceoryx_lcov_result_unit.info
name: iceoryx

- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: lcov-report
path: |
./build/lcov/*
!./build/lcov/*.info
retention-days: 90
flags: unittests
fail_ci_if_error: true

- name: Generate doxygen documentation
run: |
Expand All @@ -64,3 +62,4 @@ jobs:
path: |
./build/doc/*.pdf
retention-days: 30

8 changes: 4 additions & 4 deletions .github/workflows/sanitize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:

- name: Build
run: |
# build tests , dont run them
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-strict build-all sanitize clang
sudo $GITHUB_WORKSPACE/tools/add_test_users.sh
$GITHUB_WORKSPACE/tools/iceoryx_build_test.sh build-strict build-all sanitize clang test-add-user
- name: Run tests
run: |
cd $GITHUB_WORKSPACE/build
../tools/run_all_tests.sh
tools/run_tests.sh all
# This job builds & runs iceoryx tests (with sanitizer) in macos-10.15
clang-sanitize-macos:
Expand Down Expand Up @@ -72,4 +72,4 @@ jobs:
- name: Run tests
run: |
cd $GITHUB_WORKSPACE/build
../tools/run_all_tests.sh asan-only
tools/run_tests.sh asan-only
7 changes: 4 additions & 3 deletions doc/website/advanced/installation-guide-for-contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Now lets execute the all tests:
cd iceoryx/build
make all_tests
```
Some of the tests are timing critical and needs a stable environment. We call them timing tests and have them in a separate target available:
Some of the tests are timing critical and needs a stable environment. We call them timing tests and have them in a separate targets available:
```
make timing_tests
make timing_module_tests
make timing_integration_tests
```
In iceoryx we distinguish between different testlevels. The most important are: Moduletests and Integrationtests.
Moduletests are basically Unit-tests where the focus is on class level with black-box testing.
Expand Down Expand Up @@ -59,7 +60,7 @@ Then you need to compile the iceoryx with the sanitizer flags:
After that we can run the tests with enabled sanitizer options:
```bash
cd build
../tools/run_all_tests.sh
../tools/run_tests.sh
```
When the tests are running without errors then it is fine, else an error report is shown with a stacktrace to find the place where the leak occurs. If the leak comes from an external dependency or shall be handled later then it is possible to set a function on a suppression list.
This should be only rarely used and only in coordination with an iceoryx maintainer.
Expand Down
4 changes: 3 additions & 1 deletion iceoryx_meta/build_options.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 by Apex.AI Inc. All rights reserved.
# Copyright (c) 2020 - 2021 by Apex.AI Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
Expand Down Expand Up @@ -31,6 +31,7 @@ option(BINDING_C "Builds the C language bindings" ON)
option(SANITIZE "Build with sanitizers" OFF)
option(CLANG_TIDY "Execute Clang-Tidy" OFF)
option(ROUDI_ENVIRONMENT "Build RouDi Environment for testing, is enabled when building tests" OFF)
option(TEST_WITH_ADDITIONAL_USER "Build Test with additional user accounts for testing access control" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # "Create compile_commands.json file"

if(BUILD_ALL)
Expand Down Expand Up @@ -77,4 +78,5 @@ message(" CLANG_TIDY...........................: " ${CLANG_TIDY})
message(" ROUDI_ENVIRONMENT....................: " ${ROUDI_ENVIRONMENT})
message(" CMAKE_EXPORT_COMPILE_COMMANDS........: " ${CMAKE_EXPORT_COMPILE_COMMANDS})
message(" ONE_TO_MANY_ONLY ....................: " ${ONE_TO_MANY_ONLY})
message(" TEST_WITH_ADDITIONAL_USER ...........: " ${TEST_WITH_ADDITIONAL_USER})
message(" BUILD_DOC............................: " ${BUILD_DOC})
17 changes: 12 additions & 5 deletions iceoryx_meta/tests.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 by Apex.AI Inc. All rights reserved.
# Copyright (c) 2020 - 2021 by Apex.AI Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -62,15 +62,22 @@ if (BUILD_TEST)

### create test target with Timing tests
foreach(cmp IN ITEMS ${COMPONENTS})
list(APPEND TIMINGTEST_CMD COMMAND ./${cmp}/test/${cmp}_moduletests --gtest_filter=*.TimingTest_* --gtest_output=xml:${CMAKE_BINARY_DIR}/testresults/${cmp}_ModuleTestResults.xml)
list(APPEND TIMING_MODULETEST_CMD COMMAND ./${cmp}/test/${cmp}_moduletests --gtest_filter=*.TimingTest_* --gtest_output=xml:${CMAKE_BINARY_DIR}/testresults/${cmp}_TimingModuleTestResults.xml)
if(NOT (cmp STREQUAL "dds_gateway" OR cmp STREQUAL "binding_c"))
list(APPEND TIMINGTEST_CMD COMMAND ./${cmp}/test/${cmp}_integrationtests --gtest_filter=*.TimingTest_* --gtest_output=xml:${CMAKE_BINARY_DIR}/testresults/${cmp}_IntegrationTestResults.xml)
list(APPEND TIMING_INTEGRATIONTEST_CMD COMMAND ./${cmp}/test/${cmp}_integrationtests --gtest_filter=*.TimingTest_* --gtest_output=xml:${CMAKE_BINARY_DIR}/testresults/${cmp}_TimingIntegrationTestResults.xml)
endif()
endforeach()

add_custom_target( timing_tests
${TIMINGTEST_CMD}
add_custom_target( timing_module_tests
${TIMING_MODULETEST_CMD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)

add_custom_target( timing_integration_tests
${TIMING_INTEGRATIONTEST_CMD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)

endif()
13 changes: 7 additions & 6 deletions iceoryx_posh/test/moduletests/test_mepoo_segment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class MePooSegment_test : public Test
createVerificator(name, memorySizeInBytes, accessMode, ownerShip, baseAddressHint, permissions);
}
filehandle = creat("/tmp/roudi_segment_test", S_IRWXU);
m_isInitialized = true;
}

~SharedMemoryObject_MOCK()
Expand Down Expand Up @@ -134,7 +135,7 @@ class MePooSegment_test : public Test

MePooConfig mepooConfig = setupMepooConfig();
MePooSegment<SharedMemoryObject_MOCK, MemoryManager> sut{
mepooConfig, &m_managementAllocator, {"roudi_test1"}, {"roudi_test2"}};
mepooConfig, &m_managementAllocator, {"iox_roudi_test1"}, {"iox_roudi_test2"}};
};
MePooSegment_test::SharedMemoryObject_MOCK::createFct MePooSegment_test::SharedMemoryObject_MOCK::createVerificator;

Expand All @@ -151,12 +152,12 @@ TEST_F(MePooSegment_test, ADD_TEST_WITH_ADDITIONAL_USER(SharedMemoryCreationPara
const iox::posix::OwnerShip f_ownerShip,
const void*,
const mode_t) {
EXPECT_THAT(std::string(f_name), Eq(std::string("/roudi_test2")));
EXPECT_THAT(std::string(f_name), Eq(std::string("/iox_roudi_test2")));
EXPECT_THAT(f_accessMode, Eq(iox::posix::AccessMode::READ_WRITE));
EXPECT_THAT(f_ownerShip, Eq(iox::posix::OwnerShip::MINE));
};
MePooSegment<SharedMemoryObject_MOCK, MemoryManager> sut2{
mepooConfig, &m_managementAllocator, {"roudi_test1"}, {"roudi_test2"}};
mepooConfig, &m_managementAllocator, {"iox_roudi_test1"}, {"iox_roudi_test2"}};
MePooSegment_test::SharedMemoryObject_MOCK::createVerificator =
MePooSegment_test::SharedMemoryObject_MOCK::createFct();
}
Expand All @@ -173,7 +174,7 @@ TEST_F(MePooSegment_test, ADD_TEST_WITH_ADDITIONAL_USER(GetSharedMemoryObject))
memorySizeInBytes = f_memorySizeInBytes;
};
MePooSegment<SharedMemoryObject_MOCK, MemoryManager> sut2{
mepooConfig, &m_managementAllocator, {"roudi_test1"}, {"roudi_test2"}};
mepooConfig, &m_managementAllocator, {"iox_roudi_test1"}, {"iox_roudi_test2"}};
MePooSegment_test::SharedMemoryObject_MOCK::createVerificator =
MePooSegment_test::SharedMemoryObject_MOCK::createFct();

Expand All @@ -182,12 +183,12 @@ TEST_F(MePooSegment_test, ADD_TEST_WITH_ADDITIONAL_USER(GetSharedMemoryObject))

TEST_F(MePooSegment_test, ADD_TEST_WITH_ADDITIONAL_USER(GetReaderGroup))
{
EXPECT_THAT(sut.getReaderGroup(), Eq(iox::posix::PosixGroup("roudi_test1")));
EXPECT_THAT(sut.getReaderGroup(), Eq(iox::posix::PosixGroup("iox_roudi_test1")));
}

TEST_F(MePooSegment_test, ADD_TEST_WITH_ADDITIONAL_USER(GetWriterGroup))
{
EXPECT_THAT(sut.getWriterGroup(), Eq(iox::posix::PosixGroup("roudi_test2")));
EXPECT_THAT(sut.getWriterGroup(), Eq(iox::posix::PosixGroup("iox_roudi_test2")));
}

TEST_F(MePooSegment_test, ADD_TEST_WITH_ADDITIONAL_USER(GetMemoryManager))
Expand Down
12 changes: 6 additions & 6 deletions iceoryx_posh/test/moduletests/test_mepoo_segment_management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class SegmentManager_test : public Test
SegmentConfig getSegmentConfig()
{
SegmentConfig config;
segmentConfig.m_sharedMemorySegments.push_back({"roudi_test1", "roudi_test2", mepooConfig});
segmentConfig.m_sharedMemorySegments.push_back({"roudi_test2", "roudi_test3", mepooConfig});
segmentConfig.m_sharedMemorySegments.push_back({"iox_roudi_test1", "iox_roudi_test2", mepooConfig});
segmentConfig.m_sharedMemorySegments.push_back({"iox_roudi_test2", "iox_roudi_test3", mepooConfig});
return config;
}

Expand All @@ -94,14 +94,14 @@ class SegmentManager_test : public Test

TEST_F(SegmentManager_test, ADD_TEST_WITH_ADDITIONAL_USER(getSegmentMappingsForReadUser))
{
auto mapping = sut.getSegmentMappings({"roudi_test1"});
auto mapping = sut.getSegmentMappings({"iox_roudi_test1"});
ASSERT_THAT(mapping.size(), Eq(1u));
EXPECT_THAT(mapping[0].m_isWritable, Eq(false));
}

TEST_F(SegmentManager_test, ADD_TEST_WITH_ADDITIONAL_USER(getSegmentMappingsForWriteUser))
{
auto mapping = sut.getSegmentMappings({"roudi_test2"});
auto mapping = sut.getSegmentMappings({"iox_roudi_test2"});
ASSERT_THAT(mapping.size(), Eq(2u));
EXPECT_THAT(mapping[0].m_isWritable == mapping[1].m_isWritable, Eq(false));
}
Expand All @@ -120,7 +120,7 @@ TEST_F(SegmentManager_test, ADD_TEST_WITH_ADDITIONAL_USER(getSegmentMappingsEmpt

TEST_F(SegmentManager_test, ADD_TEST_WITH_ADDITIONAL_USER(getMemoryManagerForUserWithWriteUser))
{
auto memoryManager = sut.getSegmentInformationForUser({"roudi_test2"}).m_memoryManager;
auto memoryManager = sut.getSegmentInformationForUser({"iox_roudi_test2"}).m_memoryManager;
ASSERT_THAT(memoryManager, Ne(nullptr));
ASSERT_THAT(memoryManager->getNumberOfMemPools(), Eq(2u));

Expand All @@ -132,7 +132,7 @@ TEST_F(SegmentManager_test, ADD_TEST_WITH_ADDITIONAL_USER(getMemoryManagerForUse

TEST_F(SegmentManager_test, ADD_TEST_WITH_ADDITIONAL_USER(getMemoryManagerForUserFailWithReadOnlyUser))
{
EXPECT_THAT(sut.getSegmentInformationForUser({"roudi_test1"}).m_memoryManager, Eq(nullptr));
EXPECT_THAT(sut.getSegmentInformationForUser({"iox_roudi_test1"}).m_memoryManager, Eq(nullptr));
}

TEST_F(SegmentManager_test, ADD_TEST_WITH_ADDITIONAL_USER(getMemoryManagerForUserFailWithNonExistingUser))
Expand Down
Loading

0 comments on commit 6c79f0c

Please sign in to comment.