Skip to content

Commit

Permalink
Merge pull request #34 from Flow-IPC/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
kinokrt authored Dec 15, 2023
2 parents c684c4b + 1c06a39 commit 33c1e3d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 59 deletions.
109 changes: 54 additions & 55 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Flow-IPC pipeline
on:
push:
branches:
- main
- '*'
pull_request:
branches:
- main
- '*'
# To run a workflow manually, the workflow must be configured to run on the workflow_dispatch event.
workflow_dispatch:

Expand Down Expand Up @@ -35,12 +35,12 @@ jobs:
- name: Update available software list for apt-get
run: sudo apt-get update

- name: Checkout `ipc` repository and submodules (`flow`, `ipc_*`)
- name: Checkout `ipc` repository and submodules (like `flow`)
uses: actions/checkout@v4
with:
submodules: true

- name: Install Flow-IPC dependencies (inc. Graphviz) with apt-get
- name: Install Flow-IPC dependencies (like Graphviz) with apt-get
run: |
sudo apt-get install -y graphviz
Expand Down Expand Up @@ -80,15 +80,17 @@ jobs:
--profile:host conan_profile \
--build missing
- name: Generate documentation using Conan and Doxygen
- name: Generate code documentation using Conan and Doxygen
run: |
conan build .
- name: Package doc tarball [Doxygen documentation sets (full, API-only), landing page]
- name: Create documentation tarball (full, API-only, landing page)
run: |
cd $GITHUB_WORKSPACE/doc/ipc_doc
$GITHUB_WORKSPACE/tools/doc/stage_generated_docs.sh $GITHUB_WORKSPACE/build/${{ matrix.build-config.conan-profile-build-type }}
rm -rf generated # Save runner space.
# Save runner space.
rm -rf generated
- name: Upload documentation tarball
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -146,15 +148,12 @@ jobs:
install: True
build-and-test-config:
- id: debug
conan-preset: debug
conan-profile-build-type: Debug
conan-profile-jemalloc-build-type: Debug
- id: release
conan-preset: release
conan-profile-build-type: Release
conan-profile-jemalloc-build-type: Release
- id: relwithdebinfo-tsan
conan-preset: relwithdebinfo
conan-profile-build-type: RelWithDebInfo
conan-profile-jemalloc-build-type: Release
conan-profile-custom-conf: |
Expand Down Expand Up @@ -190,11 +189,9 @@ jobs:
skip-transport-tests: |
true
- id: relwithdebinfo
conan-preset: relwithdebinfo
conan-profile-build-type: RelWithDebInfo
conan-profile-jemalloc-build-type: Release
- id: minsizerel
conan-preset: minsizerel
conan-profile-build-type: MinSizeRel
conan-profile-jemalloc-build-type: Release

Expand All @@ -209,8 +206,10 @@ jobs:
build-and-test-config: { id: relwithdebinfo-tsan }

env:
setup-tests-env-vars: |
export TSAN_OPTIONS="disable_coredump=0 second_deadlock_stack=1 suppressions=${{ github.workspace }}/tsan_suppressions_${{ matrix.compiler.name }}_${{ matrix.compiler.version }}.cfg"
setup-tests-env: |
if [ "${{ matrix.build-and-test-config.id }}" = relwithdebinfo-tsan ]; then
export TSAN_OPTIONS="disable_coredump=0 second_deadlock_stack=1 suppressions=${{ github.workspace }}/tsan_suppressions_${{ matrix.compiler.name }}_${{ matrix.compiler.version }}.cfg"
fi
runs-on: ubuntu-22.04

Expand Down Expand Up @@ -318,50 +317,50 @@ jobs:
- name: Install targets with Makefile
run: |
VERBOSE=1 make install \
--directory $GITHUB_WORKSPACE/build/${{ matrix.build-and-test-config.conan-profile-build-type }} \
--directory ${{ github.workspace }}/build/${{ matrix.build-and-test-config.conan-profile-build-type }} \
DESTDIR=${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}
- name: Run link test [`ipc_core` - Flow-IPC Core]
if: |
(!cancelled())
!cancelled()
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
cd ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin
./ipc_core_link_test.exec
- name: Run link test [`ipc_transport_structured` - Flow-IPC Structured Transport]
if: |
(!cancelled())
!cancelled()
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
cd ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin
./ipc_transport_structured_link_test.exec
- name: Run link test [`ipc_session` - Flow-IPC Sessions]
if: |
(!cancelled())
!cancelled()
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
cd ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin
./ipc_session_link_test_srv.exec &
sleep 1
./ipc_session_link_test_cli.exec
- name: Run link test [`ipc_shm` - Flow-IPC Shared Memory]
if: |
(!cancelled())
!cancelled()
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
cd ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin
./ipc_shm_link_test_srv.exec &
sleep 1
./ipc_shm_link_test_cli.exec
- name: Run link test [`ipc_shm_arena_lend` - Flow-IPC SHM-jemalloc]
if: |
(!cancelled())
!cancelled()
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
cd ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin
./ipc_shm_arena_lend_link_test_srv.exec &
sleep 1
Expand All @@ -371,9 +370,9 @@ jobs:
# like the ones below.
- name: Run unit tests
if: |
(!cancelled())
!cancelled()
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
echo $TSAN_OPTIONS
cd ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin
./libipc_unit_test.exec ${{ matrix.build-and-test-config.unit-tests-params }}
Expand All @@ -391,9 +390,9 @@ jobs:
# This follows the instructions in bin/transport_test/README.txt.
- name: Prepare run script for [transport_test - Scripted mode] variations below
if: |
(!cancelled()) && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
cat <<'EOF' > ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_sc.sh
# Script created by pipeline during job.
echo "Log level: [$1]."
Expand All @@ -419,21 +418,21 @@ jobs:
- name: Run integration test [transport_test - Scripted mode]
id: transport_test_scripted
if: |
(!cancelled()) && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_sc.sh \
info
info
- name: Re-run with increased logging, on failure only
if: |
(!cancelled()) && (steps.transport_test_scripted.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && (steps.transport_test_scripted.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_sc.sh \
data
data
# The following [Exercise mode] tests follow the instructions in bin/transport_test/README.txt.
# Note that the creation of ~/bin/ex_..._run and placement of executables there, plus
Expand All @@ -442,7 +441,7 @@ jobs:

- name: Prepare IPC-session safety-friendly run-time environment for [transport_test - Exercise mode]
if: |
(!cancelled()) && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && !matrix.build-and-test-config.skip-transport-tests
run: |
rm -rf $GITHUB_WORKSPACE/build/${{ matrix.build-and-test-config.conan-profile-build-type }}
mkdir -p ~/bin/ex_srv_run ~/bin/ex_cli_run
Expand All @@ -453,7 +452,7 @@ jobs:
- name: Prepare run script for [transport_test - Exercise mode] variations below
if: |
(!cancelled()) && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && !matrix.build-and-test-config.skip-transport-tests
run: |
cat <<'EOF' > ${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_ex.sh
# Script created by pipeline during job.
Expand Down Expand Up @@ -482,59 +481,59 @@ jobs:
- name: Run integration test [transport_test - Exercise mode - Heap sub-mode]
id: transport_test_ex_heap
if: |
(!cancelled()) && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_ex.sh \
info heap
info heap
- name: Re-run with increased logging, on failure only
if: |
(!cancelled()) && (steps.transport_test_ex_heap.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && (steps.transport_test_ex_heap.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_ex.sh \
data heap_log_level_data
data heap_log_level_data
- name: Run integration test [transport_test - Exercise mode - SHM-classic sub-mode]
id: transport_test_ex_shm_c
if: |
(!cancelled()) && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_ex.sh \
info shm_classic -shm-c
info shm_classic -shm-c
- name: Re-run with increased logging, on failure only
if: |
(!cancelled()) && (steps.transport_test_ex_shm_c.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && (steps.transport_test_ex_shm_c.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_ex.sh \
data shm_classic_log_level_data -shm-c
data shm_classic_log_level_data -shm-c
- name: Run integration test [transport_test - Exercise mode - SHM-jemalloc sub-mode]
id: transport_test_ex_shm_j
if: |
(!cancelled()) && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_ex.sh \
info shm_jemalloc -shm-j
info shm_jemalloc -shm-j
- name: Re-run with increased logging, on failure only
if: |
(!cancelled()) && (steps.transport_test_ex_shm_j.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
!cancelled() && (steps.transport_test_ex_shm_j.outcome == 'failure') && !matrix.build-and-test-config.skip-transport-tests
run: |
${{ env.setup-tests-env-vars }}
${{ env.setup-tests-env }}
/usr/bin/bash -e \
${{ github.workspace }}/install/${{ matrix.build-and-test-config.conan-profile-build-type }}/usr/local/bin/run_transport_test_ex.sh \
data shm_jemalloc_log_level_data -shm-j
data shm_jemalloc_log_level_data -shm-j
- name: Upload logs for [transport_test - All modes]
if: |
Expand Down
8 changes: 4 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def generate(self):
deps.generate()

toolchain = CMakeToolchain(self)
toolchain.variables["CMAKE_VERBOSE_MAKEFILE"] = True
if self.options.build:
toolchain.variables["CFG_ENABLE_TEST_SUITE"] = "ON"
toolchain.variables["JEMALLOC_PREFIX"] = self.options["jemalloc"].prefix
Expand All @@ -40,11 +39,12 @@ def generate(self):
def build(self):
cmake = CMake(self)
cmake.configure()

# Cannot use cmake.build(...) because not possible to pass make arguments like --keep-going.
if self.options.build:
cmake.build()
self.run("cmake --build . -- --keep-going VERBOSE=1")
if self.options.doc:
cmake.build(target="ipc_doc_public")
cmake.build(target="ipc_doc_full")
self.run("cmake --build . -- ipc_doc_public ipc_doc_full --keep-going VERBOSE=1")

def requirements(self):
if self.options.build:
Expand Down
1 change: 1 addition & 0 deletions tsan_suppressions_clang_13.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Objec
race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Test_client::open_app_channel
race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Test_client_manager::~Test_client_manager
race:ipc::session::shm::arena_lend::jemalloc::test::Test_shm_session_server::start
race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Test_client::start_app_channel
race:ipc::session::shm::arena_lend::Shm_session_data::register_borrower_collection
race:ipc::session::shm::arena_lend::test::*::get_random_collection
race:ipc::shm::arena_lend::Borrower_shm_pool_collection::open_shm_pool
Expand Down
1 change: 1 addition & 0 deletions tsan_suppressions_clang_16.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Objec
race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Object_event_listener::~Object_event_listener
race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Test_client::open_app_channel
race:ipc::session::shm::arena_lend::jemalloc::test::(anonymous namespace)::Test_client_manager::~Test_client_manager
race:ipc::session::shm::arena_lend::jemalloc::test::Test_shm_session_server::execute_allocation_performance_tests
race:ipc::session::shm::arena_lend::Shm_session_data::register_borrower_collection
race:ipc::shm::arena_lend::Borrower_shm_pool_collection::open_shm_pool
race:ipc::util::sync_io::Timer_event_emitter::Timer_event_emitter

0 comments on commit 33c1e3d

Please sign in to comment.