Skip to content

Commit

Permalink
Merge branch 'task/#22179-refactor-the-kmsg-scanner-to-be-a-plugin' i…
Browse files Browse the repository at this point in the history
…nto 'integration'

Task #22179 - Refactor the kmsg scanner to be a plugin

See merge request elektrobit/base-os/elos!97
  • Loading branch information
gehwolf committed Jun 18, 2024
2 parents 19b6c24 + 8bd7dd2 commit 363ebe7
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 74 deletions.
42 changes: 35 additions & 7 deletions ci/run_smoketests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,32 @@ set -eou pipefail

CMD_PATH="$(realpath "$(dirname "$0")")"
BASE_DIR="$(realpath "$CMD_PATH/..")"

PARAM=""
INTERACTIVE=0
DISABLED_TESTS=""
ENABLED_TESTS=""
while [ $# -gt 0 ]; do
case ${1} in
--interactive|-i)
INTERACTIVE=1 ;;
--disable|-d)
DISABLED_TESTS="${DISABLED_TESTS} $2"
shift ;;
--enable|-e)
ENABLED_TESTS="${ENABLED_TESTS} $2"
shift ;;
-*)
echo "error: unknown option: $1"; exit 1 ;;
*)
PARAM="$PARAM ${1}" ;;
esac
shift
done

set -- $PARAM
BUILD_TYPE="${1:-Debug}"

. "$BASE_DIR/ci/common_names.sh"

rm -rf $RESULT_DIR/smoketest_results
Expand All @@ -13,12 +38,15 @@ if [ "${CI:-false}" = true ]; then
export SMOKETEST_TMP_DIR="${SMOKETEST_TMP_DIR:-"$(realpath "${BUILD_DIR}/tmp")"}"
fi

export ENABLED_TESTS="${2:-""}"
export DISABLED_TESTS=""
export SMOKETEST_ENABLE_COMPILE_TESTS="YES"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$BASE_DIR/build/deps/lib"
BASE_DIR=$BASE_DIR BUILD_TYPE=$BUILD_TYPE \
$BASE_DIR/test/smoketest/smoketest.sh | \
tee "$RESULT_DIR/smoketest_results/smoktests.log"
export ENABLED_TESTS="${ENABLED_TESTS}"
export DISABLED_TESTS="${DISABLED_TESTS}"
if [ "${INTERACTIVE}" -eq 0 ]; then
BUILD_TYPE=$BUILD_TYPE \
$BASE_DIR/test/smoketest/smoketest.sh | \
tee "$RESULT_DIR/smoketest_results/smoktests.log"
else
BUILD_TYPE=$BUILD_TYPE \
$BASE_DIR/test/smoketest/smoketest_interactive.sh
fi

#tapview > $BUILD_DIR/result/smoketest_results/summary < $BUILD_DIR/result/smoketest_results/log
2 changes: 1 addition & 1 deletion cmake/project.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: MIT
set(ELOS_VERSION 0.58.13)
set(ELOS_VERSION 0.58.14)

# Attention: Aside from the version, as many things as possible in this file
# should be put into functions, as this solves potential issues with commands
Expand Down
9 changes: 8 additions & 1 deletion doc/userManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,13 @@ look like this:
}
}
}
},
"KmsgScanner": {
"File": "scanner_kmsg.so",
"Run": "always",
"Config": {
"KmsgFile": "/dev/kmsg"
}
}
},
"KmsgScanner": {
Expand Down Expand Up @@ -724,7 +731,7 @@ use another default value, decided by us.
logged events (``ELOS_STORAGE_BACKEND_JSON_FILE``)
- **Scanner/Path**: Path to the scanner plugins (``ELOS_SCANNER_PATH``
default value: ``"/usr/lib/elos/scanner"``)
- **Scanner/KmsgScanner/KmsgFile**: Character device or FIFO file node
- **Scanner/Plugins/<KmsgScanner>/Config/KmsgFile**: Character device or FIFO file node
to receive logs in kmsg format from (``ELOS_KMSG_FILE`` default
value: ``"/dev/kmsg"``)
- **Scanner/Plugins/<SyslogScanner>/Config/SyslogPath**: Unix UDP socket to receive logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static elosScannerManagerLegacyErrorCodeE_t _parsePath(elosScannerManagerLegacyC
continue;
}

if ((strcmp(dirEnt->d_name, "scanner_kmsg.so") != 0) && (strcmp(dirEnt->d_name, "scanner_shmem.so") != 0)) {
if ((strcmp(dirEnt->d_name, "scanner_shmem.so") != 0)) {
dirEnt = readdir(dirHandle);
continue;
}
Expand Down
10 changes: 4 additions & 6 deletions src/plugins/scanners/kmsg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ create_interface_library(
FROM
scanner_kmsg
LIBRARIES
elos_event_interface
libelos_common
safu::safu_interface
samconf::samconf_interface
)
Expand All @@ -18,13 +18,11 @@ set_target_properties(scanner_kmsg PROPERTIES PREFIX "")

target_link_libraries(
scanner_kmsg
PRIVATE
elos_scanner_legacy_interface
elos_event_static
config_static
PUBLIC
scanner_kmsg_interface
libelos_common
libelosplugin
samconf::samconf
scanner_kmsg_interface
)

target_include_directories(
Expand Down
28 changes: 28 additions & 0 deletions src/plugins/scanners/kmsg/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,31 @@ Environment:

- ``ELOS_KMSG_FILE`` –> the path where to open expect a character
device or FIFO file node, default is ``ELOSD_SYSLOG_PATH``

Json
~~~~

Under `root/elos/Scanner/Plugins` add:

.. code:: json
"<KmsgScanner Inastance name>": {
"File": "scanner_kmsg.so",
"Run": "always",
"Config": {
"KmsgFile": "/dev/kmsg"
}
}
Configuration structure
~~~~~~~~~~~~~~~~~~~~~~~

.. code:: bash
KmsgScanner
├── File
├── Run
└── Config
└── KmsgFile
Loading

0 comments on commit 363ebe7

Please sign in to comment.