Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-methner authored Aug 11, 2023
2 parents 477020c + 8f6cc3f commit 3358bf9
Show file tree
Hide file tree
Showing 250 changed files with 2,735 additions and 998 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/cmake-ctest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,57 @@ on:
branches: [ "master" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
WITH_DLT_UNIT_TESTS: ON
WITH_DLT_COVERAGE: ON
BUILD_GMOCK: OFF

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Prepare submodule
run: |
git submodule init
git submodule init
git submodule update
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a
# single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DWITH_DLT_UNIT_TESTS=${{env.WITH_DLT_UNIT_TESTS}} \
-DWITH_DLT_COVERAGE=${{env.WITH_DLT_COVERAGE}} \
-DBUILD_GMOCK=${{env.BUILD_GMOCK}}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

- name: Install dependencies
run: sudo apt-get install lcov

- name: Generate lcov report
working-directory: ${{github.workspace}}
run: bash util/dlt_coverage_report/lcov_report_generator.sh build -xe

- name: Archive coverage results
uses: actions/upload-artifact@v3
with:
name: dlt_coverage_report
path: ${{github.workspace}}/dlt_lcov_report

- name: Upload lcov report
if: github.ref == 'refs/heads/master'
run: |
git config user.name github-actions
git config user.email [email protected]
git checkout -b dlt_coverage_report
git submodule deinit -f googletest
rm -rf .git/modules/googletest
git rm -f googletest
git add --all
git commit -m "Upload lcov report for dlt-daemon"
git push -f origin dlt_coverage_report
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ include/dlt/dlt_user.h
*.out
*.swp
cmake-build-debug/
.vscode/
.vscode/
googletest/
109 changes: 106 additions & 3 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* This code is developed by Advanced Driver Information Technology.
* Copyright of Advanced Driver Information Technology, Bosch and DENSO.
*
* This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
* This file is part of COVESA Project Dlt - Diagnostic Log and Trace console apps.
*
*
* \copyright
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For further information see http://www.genivi.org/.
* For further information see http://www.covesa.org/.
*/

cc_defaults {
Expand Down Expand Up @@ -195,8 +195,111 @@ cc_binary {
shared_libs: [
"libdlt",
"liblog",
"libjsoncpp",
],
include_dirs: [
"system/logging/liblog/include",
"external/jsoncpp/include",
],
}

// vim: ft=python
cc_binary {

name: "dlt-control",
defaults: ["dlt_defaults"],

srcs: [
"src/console/dlt-control-common.c",
"src/console/dlt-control.c",
],

shared_libs: [
"libc",
"libdlt",
],
}

cc_binary {

name: "dlt-convert",
defaults: ["dlt_defaults"],

srcs: [
"src/console/dlt-convert.c",
],

shared_libs: [
"libc",
"libdlt",
],
}

cc_binary {

name: "dlt-test-non-verbose",
defaults: ["dlt_defaults"],

srcs: [
"src/tests/dlt-test-non-verbose.c",
],

shared_libs: [
"libc",
"libdlt",
],
}

cc_binary {

name: "dlt-test-logstorage",
defaults: ["dlt_defaults"],

srcs: [
"src/tests/dlt-test-logstorage.c",
],

shared_libs: [
"libc",
"libdlt",
],
}

cc_binary {

name: "dlt-test-multi-process",
defaults: ["dlt_defaults"],

srcs: [
"src/tests/dlt-test-multi-process.c",
],

shared_libs: [
"libc",
"libdlt",
],
}

cc_binary {

name: "dlt-logstorage-ctrl",
defaults: ["dlt_defaults"],

local_include_dirs: [
"systemd/3rdparty/",
"src/console",
"src/console/logstorage",
],

srcs: [
"src/console/dlt-control-common.c",
"src/console/logstorage/dlt-logstorage-common.c",
"src/console/logstorage/dlt-logstorage-ctrl.c",
],

shared_libs: [
"libc",
"libdlt",
],
}

// vim: ft=python
50 changes: 35 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@
#
# Copyright(C) 2011-2015, BMW AG
#
# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
# This file is part of COVESA Project DLT - Diagnostic Log and Trace.
#
# This Source Code Form is subject to the terms of the
# Mozilla Public License(MPL), v. 2.0.
# If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# For further information see http://www.genivi.org/.
# For further information see http://www.covesa.org/.
#######

# Set minimum Cmake version and setup policy behavior
cmake_minimum_required(VERSION 3.3)

if(${CMAKE_VERSION} VERSION_GREATER "3.20" OR ${CMAKE_VERSION} VERSION_EQUAL "3.20")
cmake_policy(SET CMP0115 OLD)
endif()
project(automotive-dlt VERSION 2.18.10)


mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)

Expand Down Expand Up @@ -75,13 +81,14 @@ option(WITH_DLT_SYSTEM "Set to ON to build src/system binaries"
option(WITH_DLT_DBUS "Set to ON to build src/dbus binaries" OFF)
option(WITH_DLT_TESTS "Set to ON to build src/test binaries" ON)
option(WITH_DLT_UNIT_TESTS "Set to ON to build gtest framework and tests/binaries" OFF)
option(WITH_DLT_COVERAGE "Set to ON to generate coverage report for dlt-daemon source code" OFF)
option(WITH_DLT_QNX_SYSTEM "Set to ON to build QNX system binary dlt-qnx-system" OFF)
option(WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK "Set to ON to enable fallback to syslog if dlt logging to file fails" OFF)
option(WITH_DLT_NETWORK_TRACE "Set to ON to enable network trace (if message queue is supported)" ON)
option(WITH_DLT_LOG_LEVEL_APP_CONFIG "Set to ON to enable default log levels based on application ids" OFF)

set(DLT_IPC "FIFO" CACHE STRING "UNIX_SOCKET,FIFO")
set(DLT_USER "genivi" CACHE STRING "Set user for process not run as root")
set(DLT_USER "covesa" CACHE STRING "Set user for process not run as root")
set(DLT_QNX_SLOG_ADAPTER_WAIT_BUFFER_TIMEOUT_MS "100" CACHE STRING "Timeout in milliseconds to wait before messages are dropped when input buffer is full")

option(WITH_DLT_PKGCONFIG "Set to ON to generate pkgconfig .pc files" ON)
Expand All @@ -106,7 +113,7 @@ set(DLT_WRITEV_TIMEOUT_SEC "1" CACHE STRING "Set sec timeout for writev to preve
set(DLT_WRITEV_TIMEOUT_USEC "0" CACHE STRING "Set usec timeout for writev to prevent blocking indefinitely")

# RPM settings
set(GENIVI_RPM_RELEASE "1") # ${DLT_REVISION}")
set(COVESA_RPM_RELEASE "1") # ${DLT_REVISION}")
set(LICENSE "Mozilla Public License Version 2.0")

# Build, project and include settings
Expand Down Expand Up @@ -186,21 +193,33 @@ if(WITH_DLT_QNX_SYSTEM AND NOT "${CMAKE_C_COMPILER}" MATCHES "nto-qnx|qcc|ntoaar
message(FATAL_ERROR "Can only compile for QNX with a QNX compiler, but found '${CMAKE_C_COMPILER}'.")
endif()

if (WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK)
if(WITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK)
add_definitions(-DWITH_DLT_FILE_LOGGING_SYSLOG_FALLBACK)
endif()

if (WITH_DLT_LOGSTORAGE_GZIP)
if(WITH_DLT_LOGSTORAGE_GZIP)
add_definitions(-DDLT_LOGSTORAGE_USE_GZIP)
endif()

if(WITH_GPROF)
add_compile_options(-pg)
endif()

if(WITH_DLT_COVERAGE)
add_definitions(-DWITH_DLT_COVERAGE)
set(WITH_DLT_UNIT_TESTS ON)
if(WITH_DLT_UNIT_TESTS)
add_definitions(-DDLT_UNIT_TESTS)
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()

add_compile_options(
$<$<COMPILE_LANGUAGE:C>:-std=gnu99>
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++14>
-Wall
-Wextra
# -pedantic
Expand All @@ -214,7 +233,7 @@ else()
set(PACKAGE_DOC "")
endif()

if (BUILD_SHARED_LIBS)
if(BUILD_SHARED_LIBS)
set(CMAKE_STATIC_LIB_PATH "")
else()
set(CMAKE_STATIC_LIB_PATH "-L\$\{libdir\}/static")
Expand All @@ -236,7 +255,7 @@ add_definitions(-DCONFIGURATION_FILES_DIR="${CONFIGURATION_FILES_DIR}")

add_subdirectory(cmake)

if (WITH_DLT_NETWORK_TRACE)
if(WITH_DLT_NETWORK_TRACE)
# Message queue
if(HAVE_MQUEUE_H AND HAVE_FUNC_MQOPEN AND HAVE_FUNC_MQCLOSE AND
HAVE_FUNC_MQUNLINK AND HAVE_FUNC_MQSEND AND HAVE_FUNC_MQRECEIVE)
Expand Down Expand Up @@ -272,15 +291,15 @@ if(WITH_SYSTEMD
add_definitions(-DDLT_SYSTEMD_JOURNAL_ENABLE)
endif()

if (WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX)
if(WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX)
add_definitions(-DDLT_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_ENABLE)
endif()

if (WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_DLT_SYSTEM)
if(WITH_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_DLT_SYSTEM)
add_definitions(-DDLT_SYSTEMD_WATCHDOG_ENFORCE_MSG_RX_ENABLE_DLT_SYTSTEM)
endif()

if (WITH_SYSTEMD_SOCKET_ACTIVATION)
if(WITH_SYSTEMD_SOCKET_ACTIVATION)
if(NOT DLT_IPC STREQUAL "UNIX_SOCKET")
message(FATAL_ERROR "WITH_SYSTEMD_SOCKET_ACTIVATION is only supported for UNIX_SOCKET")
endif()
Expand Down Expand Up @@ -332,11 +351,11 @@ add_subdirectory(doc)
add_subdirectory(src)
add_subdirectory(include)
add_subdirectory(testscripts)
if (WITH_DLT_UNIT_TESTS)
if(WITH_DLT_UNIT_TESTS)
find_package(GTest)

if (NOT GTEST_FOUND)
add_subdirectory( googletest )
if(NOT GTEST_FOUND)
add_subdirectory(googletest)
endif()
enable_testing()
add_subdirectory(tests)
Expand All @@ -362,6 +381,7 @@ message(STATUS "WITH_DLT_FILETRANSFER = ${WITH_DLT_FILETRANSFER}")
message(STATUS "WITH_DLT_DBUS = ${WITH_DLT_DBUS}")
message(STATUS "WITH_DLT_TESTS = ${WITH_DLT_TESTS}")
message(STATUS "WITH_DLT_UNIT_TESTS = ${WITH_DLT_UNIT_TESTS}")
message(STATUS "WITH_DLT_COVERAGE = ${WITH_DLT_COVERAGE}")
message(STATUS "WITH_DLT_SHM_ENABLE = ${WITH_DLT_SHM_ENABLE}")
message(STATUS "WITH_DLTTEST = ${WITH_DLTTEST}")
message(STATUS "WITH_DLT_PKGCONFIG = ${WITH_DLT_PKGCONFIG}")
Expand Down
4 changes: 2 additions & 2 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#
# Copyright (C) 2011-2015, BMW AG
#
# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
# This file is part of COVESA Project DLT - Diagnostic Log and Trace.
#
# This Source Code Form is subject to the terms of the
# Mozilla Public License (MPL), v. 2.0.
# If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# For further information see http://www.genivi.org/.
# For further information see http://www.covesa.org/.
Loading

0 comments on commit 3358bf9

Please sign in to comment.