Skip to content

Commit

Permalink
Release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Sep 28, 2024
2 parents b5c2b4f + 1f13078 commit 6990c08
Show file tree
Hide file tree
Showing 10 changed files with 617 additions and 253 deletions.
166 changes: 156 additions & 10 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Github Actions Build
on: [push]

env:
COMMS_TAG: v5.2.5
CC_MQTT5_TAG: v2.8
COMMS_TAG: v5.2.7
CC_MQTT5_TAG: v2.9

jobs:
build_gcc_ubuntu_22_04:
Expand All @@ -15,9 +15,80 @@ jobs:
type: [Debug, Release, MinSizeRel]
cpp: [17, 20]
cc_ver: [9, 10, 11, 12]
sanitize: [ON, OFF]
exclude:
- type: Debug
sanitize: OFF
- cc_ver: 12
cpp: 20
cpp: 20

steps:
- uses: actions/checkout@v4

- name: Prepare Install
run: sudo apt-get update --fix-missing

- name: Install Packages
run: sudo apt install libboost-all-dev mosquitto gcc-${{matrix.cc_ver}} g++-${{matrix.cc_ver}}

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Prepare externals
shell: bash
run: $GITHUB_WORKSPACE/script/prepare_externals.sh
env:
BUILD_DIR: ${{runner.workspace}}/build
CC: gcc-${{matrix.cc_ver}}
CXX: g++-${{matrix.cc_ver}}
EXTERNALS_DIR: ${{runner.workspace}}/externals
COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install
COMMON_BUILD_TYPE: ${{matrix.type}}
COMMON_CXX_STANDARD: ${{matrix.cpp}}
COMMS_TAG: ${{env.COMMS_TAG}}
CC_MQTT5_TAG: ${{env.CC_MQTT5_TAG}}

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DCC_MQTT5_WITH_DEFAULT_SANITIZERS=${{matrix.sanitize}} \
-DCC_MQTT5_BUILD_UNIT_TESTS=ON -DCC_MQTT5_BUILD_INTEGRATION_TESTS=ON \
-DCC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES="$GITHUB_WORKSPACE/client/lib/script/BareMetalTestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos0TestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos1TestConfig.cmake" \
-DCC_MQTT5_CLIENT_AFL_FUZZ=ON
env:
CC: gcc-${{matrix.cc_ver}}
CXX: g++-${{matrix.cc_ver}}

- name: Build Target
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config ${{matrix.type}} --target install
env:
VERBOSE: 1

- name: Testing
working-directory: ${{runner.workspace}}/build
shell: bash
run: ctest -V

build_gcc_ubuntu_24_04:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
type: [Debug, Release, MinSizeRel]
cc_ver: [13, 14]
cpp: [17, 20, 23]
sanitize: [ON, OFF]
exclude:
- type: Debug
sanitize: OFF
- cc_ver: 13
cpp: 23

steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -50,7 +121,7 @@ jobs:
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DCC_MQTT5_WITH_DEFAULT_SANITIZERS=ON \
-DCC_MQTT5_WITH_DEFAULT_SANITIZERS=${{matrix.sanitize}} \
-DCC_MQTT5_BUILD_UNIT_TESTS=ON -DCC_MQTT5_BUILD_INTEGRATION_TESTS=ON \
-DCC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES="$GITHUB_WORKSPACE/client/lib/script/BareMetalTestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos0TestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos1TestConfig.cmake" \
-DCC_MQTT5_CLIENT_AFL_FUZZ=ON
Expand Down Expand Up @@ -79,14 +150,84 @@ jobs:
type: [Debug, Release, MinSizeRel]
cc_ver: [12, 13, 14, 15]
cpp: [17, 20]
sanitize: [ON, OFF]
exclude:
- type: Debug
sanitize: OFF
- cc_ver: 12
cpp: 20
- cc_ver: 13
cpp: 20
- cc_ver: 14
cpp: 20

steps:
- uses: actions/checkout@v4

- name: Prepare Install
run: sudo apt-get update --fix-missing

- name: Install Packages
run: sudo apt install libboost-all-dev mosquitto clang-${{matrix.cc_ver}}

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Prepare externals
shell: bash
run: $GITHUB_WORKSPACE/script/prepare_externals.sh
env:
BUILD_DIR: ${{runner.workspace}}/build
CC: clang-${{matrix.cc_ver}}
CXX: clang++-${{matrix.cc_ver}}
EXTERNALS_DIR: ${{runner.workspace}}/externals
COMMON_INSTALL_DIR: ${{runner.workspace}}/build/install
COMMON_BUILD_TYPE: ${{matrix.type}}
COMMON_CXX_STANDARD: ${{matrix.cpp}}
COMMS_TAG: ${{env.COMMS_TAG}}
CC_MQTT5_TAG: ${{env.CC_MQTT5_TAG}}

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DCC_MQTT5_WITH_DEFAULT_SANITIZERS=${{matrix.sanitize}} \
-DCC_MQTT5_BUILD_UNIT_TESTS=ON -DCC_MQTT5_BUILD_INTEGRATION_TESTS=ON \
-DCC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES="$GITHUB_WORKSPACE/client/lib/script/BareMetalTestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos0TestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos1TestConfig.cmake" \
-DCC_MQTT5_CLIENT_AFL_FUZZ=ON
env:
CC: clang-${{matrix.cc_ver}}
CXX: clang++-${{matrix.cc_ver}}

- name: Build Target
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config ${{matrix.type}} --target install
env:
VERBOSE: 1
- name: Testing
working-directory: ${{runner.workspace}}/build
shell: bash
run: ctest -V

build_clang_ubuntu_24_04:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
type: [Debug, Release, MinSizeRel]
cc_ver: [16, 17, 18]
cpp: [17, 20, 23]
sanitize: [ON, OFF]
exclude:
- type: Debug
sanitize: OFF
- cc_ver: 16
cpp: 23
- cc_ver: 17
cpp: 23

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -120,7 +261,7 @@ jobs:
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DCC_MQTT5_WITH_DEFAULT_SANITIZERS=ON \
-DCC_MQTT5_WITH_DEFAULT_SANITIZERS=${{matrix.sanitize}} \
-DCC_MQTT5_BUILD_UNIT_TESTS=ON -DCC_MQTT5_BUILD_INTEGRATION_TESTS=ON \
-DCC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES="$GITHUB_WORKSPACE/client/lib/script/BareMetalTestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos0TestConfig.cmake;$GITHUB_WORKSPACE/client/lib/script/Qos1TestConfig.cmake" \
-DCC_MQTT5_CLIENT_AFL_FUZZ=ON
Expand Down Expand Up @@ -155,9 +296,10 @@ jobs:
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Install Boost
if: matrix.arch == 'x64'
shell: cmd
run: |
choco install boost-msvc-14.2
choco install boost-msvc-14.2 --version=1.85.0
- name: Prepare externals
shell: cmd
Expand All @@ -178,10 +320,13 @@ jobs:
working-directory: ${{runner.workspace}}/build
run: |
cmake %GITHUB_WORKSPACE% -A ${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install ^
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DBoost_USE_STATIC_LIBS=ON ^
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} ^
-DCMAKE_POLICY_DEFAULT_CMP0167=OLD -DBoost_USE_STATIC_LIBS=ON ^
-DCC_MQTT5_BUILD_UNIT_TESTS=ON ^
-DCC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES="%GITHUB_WORKSPACE%/client/lib/script/BareMetalTestConfig.cmake;%GITHUB_WORKSPACE%/client/lib/script/Qos0TestConfig.cmake;%GITHUB_WORKSPACE%/client/lib/script/Qos1TestConfig.cmake" ^
-DCC_MQTT5_CLIENT_AFL_FUZZ=ON
-DCC_MQTT5_CLIENT_APPS=${{env.HAS_BOOST}} -DCC_MQTT5_CLIENT_AFL_FUZZ=${{env.HAS_BOOST}}
env:
HAS_BOOST: "${{ matrix.arch == 'x64' && 'ON' || 'OFF' }}"

- name: Build Target
working-directory: ${{runner.workspace}}/build
Expand Down Expand Up @@ -213,7 +358,7 @@ jobs:
if: matrix.arch == 'x64'
shell: cmd
run: |
choco install boost-msvc-14.3
choco install boost-msvc-14.3 --version=1.85.0
- name: Prepare externals
shell: cmd
Expand All @@ -234,7 +379,8 @@ jobs:
working-directory: ${{runner.workspace}}/build
run: |
cmake %GITHUB_WORKSPACE% -A ${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install ^
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DBoost_USE_STATIC_LIBS=ON ^
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} ^
-DCMAKE_POLICY_DEFAULT_CMP0167=OLD -DBoost_USE_STATIC_LIBS=ON ^
-DCC_MQTT5_BUILD_UNIT_TESTS=ON ^
-DCC_MQTT5_CUSTOM_CLIENT_CONFIG_FILES="%GITHUB_WORKSPACE%/client/lib/script/BareMetalTestConfig.cmake;%GITHUB_WORKSPACE%/client/lib/script/Qos0TestConfig.cmake;%GITHUB_WORKSPACE%/client/lib/script/Qos1TestConfig.cmake" ^
-DCC_MQTT5_CLIENT_APPS=${{env.HAS_BOOST}} -DCC_MQTT5_CLIENT_AFL_FUZZ=${{env.HAS_BOOST}}
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "The C++ standard to use")

cmake_policy(SET CMP0079 NEW)

if (("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.30") AND
(NOT DEFINED CMAKE_POLICY_DEFAULT_CMP0167))
# Find boost cmake configuration from the boost installation
cmake_policy(SET CMP0167 NEW)
endif ()

set (CC_MQTT5_EXTERNALS_DIR "${PROJECT_SOURCE_DIR}/externals")

# Dependencies
Expand Down
2 changes: 2 additions & 0 deletions client/afl_fuzz/AflFuzz.cpp.templ
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public:
auto dataLen = static_cast<std::size_t>(len);
bool hasPrevData = false;
if (!m_inData.empty()) {
m_inData.reserve(m_inData.size() + dataLen);
m_inData.insert(m_inData.end(), dataPtr, dataPtr + dataLen);
static const auto MaxLen = std::numeric_limits<unsigned>::max();

Expand Down Expand Up @@ -590,6 +591,7 @@ private:
m_generator->setDataReportCb(
[this](const std::uint8_t* buf, std::size_t bufLen)
{
m_inData.reserve(m_inData.size() + bufLen);
m_inData.insert(m_inData.end(), buf, buf + bufLen);
infoLog() << "Appended " << bufLen << " bytes to buffer, totaling " << m_inData.size() << " bytes\n";
});
Expand Down
2 changes: 2 additions & 0 deletions client/app/common/TcpSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void TcpSession::doRead()
auto buf = &m_inData[0];
auto bufLen = bytesCount;
if (!m_buf.empty()) {
m_buf.reserve(m_buf.size() + bytesCount);
m_buf.insert(m_buf.end(), m_inData.begin(), m_inData.begin() + bytesCount);
buf = &m_buf[0];
bufLen = m_buf.size();
Expand All @@ -101,6 +102,7 @@ void TcpSession::doRead()
}

assert(buf == &m_inData[0]);
m_buf.reserve(m_buf.size() + (bytesCount - consumed));
m_buf.insert(m_buf.end(), m_inData.begin() + consumed, m_inData.begin() + bytesCount);
} while (false);

Expand Down
Loading

0 comments on commit 6990c08

Please sign in to comment.