Merge branch 'mueller/cmd-executor' of https://egit.irs.uni-stuttgart.de/eive/fsfw into mueller/cmd-executor

This commit is contained in:
Robin Müller 2022-02-02 09:56:41 +01:00
commit 30687f84c8
5 changed files with 27 additions and 54 deletions

View File

@ -56,7 +56,7 @@ if(FSFW_BUILD_UNITTESTS)
FetchContent_Declare( FetchContent_Declare(
Catch2 Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.0-preview3 GIT_TAG v3.0.0-preview4
) )
FetchContent_MakeAvailable(Catch2) FetchContent_MakeAvailable(Catch2)
@ -90,7 +90,7 @@ set(FSFW_CORE_INC_PATH "inc")
set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos) set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos)
# Configure Files # For configure files
target_include_directories(${LIB_FSFW_NAME} PRIVATE target_include_directories(${LIB_FSFW_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
@ -152,13 +152,8 @@ else()
set(OS_FSFW "host") set(OS_FSFW "host")
endif() endif()
if(FSFW_BUILD_UNITTESTS OR FSFW_BUILD_DOCS)
configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h) configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h)
configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h) configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h)
else()
configure_file(src/fsfw/FSFW.h.in FSFW.h)
configure_file(src/fsfw/FSFWVersion.h.in FSFWVersion.h)
endif()
message(STATUS "Compiling FSFW for the ${FSFW_OS_NAME} operating system.") message(STATUS "Compiling FSFW for the ${FSFW_OS_NAME} operating system.")

View File

@ -5,4 +5,10 @@ RUN apt-get --yes upgrade
#tzdata is a dependency, won't install otherwise #tzdata is a dependency, won't install otherwise
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
RUN git clone https://github.com/catchorg/Catch2.git && \
cd Catch2 && \
git checkout v3.0.0-preview4 && \
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
cmake --build build/ --target install

View File

@ -1,28 +1,23 @@
pipeline { pipeline {
agent any
environment { environment {
BUILDDIR = 'build-unittests' BUILDDIR = 'build-tests'
} }
stages {
stage('Create Docker') {
agent { agent {
dockerfile { dockerfile {
dir 'automation' dir 'automation'
additionalBuildArgs '--no-cache' //force docker to redownload base image and rebuild all steps instead of caching them
//this way, we always get an up to date docker image one each build
additionalBuildArgs '--no-cache --pull'
reuseNode true reuseNode true
} }
} }
stages {
stage('Clean') {
steps { steps {
sh 'rm -rf $BUILDDIR' sh 'rm -rf $BUILDDIR'
} }
} }
stage('Configure') { stage('Configure') {
agent {
dockerfile {
dir 'automation'
reuseNode true
}
}
steps { steps {
dir(BUILDDIR) { dir(BUILDDIR) {
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..'
@ -30,12 +25,6 @@ pipeline {
} }
} }
stage('Build') { stage('Build') {
agent {
dockerfile {
dir 'automation'
reuseNode true
}
}
steps { steps {
dir(BUILDDIR) { dir(BUILDDIR) {
sh 'cmake --build . -j' sh 'cmake --build . -j'
@ -43,12 +32,6 @@ pipeline {
} }
} }
stage('Unittests') { stage('Unittests') {
agent {
dockerfile {
dir 'automation'
reuseNode true
}
}
steps { steps {
dir(BUILDDIR) { dir(BUILDDIR) {
sh 'cmake --build . -- fsfw-tests_coverage -j' sh 'cmake --build . -- fsfw-tests_coverage -j'
@ -56,12 +39,6 @@ pipeline {
} }
} }
stage('Valgrind') { stage('Valgrind') {
agent {
dockerfile {
dir 'automation'
reuseNode true
}
}
steps { steps {
dir(BUILDDIR) { dir(BUILDDIR) {
sh 'valgrind --leak-check=full --error-exitcode=1 ./fsfw-tests' sh 'valgrind --leak-check=full --error-exitcode=1 ./fsfw-tests'

View File

@ -7,12 +7,3 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE
) )
add_subdirectory(fsfw) add_subdirectory(fsfw)
# Configure File
target_include_directories(${LIB_FSFW_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
target_include_directories(${LIB_FSFW_NAME} INTERFACE
${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -59,7 +59,11 @@ TEST_CASE( "Command Executor" , "[cmd-exec]") {
REQUIRE(outputBuffer.getAvailableReadData() == 12); REQUIRE(outputBuffer.getAvailableReadData() == 12);
uint8_t readBuffer[32]; uint8_t readBuffer[32];
REQUIRE(outputBuffer.readData(readBuffer, 12) == HasReturnvaluesIF::RETURN_OK); REQUIRE(outputBuffer.readData(readBuffer, 12) == HasReturnvaluesIF::RETURN_OK);
CHECK(strcmp(reinterpret_cast<char*>(readBuffer), "Hello World\n") == 0); std::string readString(reinterpret_cast<char*>(readBuffer));
std::string cmpString = "Hello World\n";
//int cmpResult = strcmp(reinterpret_cast<char*>(readBuffer), cmpString.c_str());
int cmpResult = (readString == cmpString);
CHECK(cmpResult);
outputBuffer.deleteData(12, true); outputBuffer.deleteData(12, true);
// Test more complex command // Test more complex command
result = cmdExecutor.load("ping -c 1 localhost", false, false); result = cmdExecutor.load("ping -c 1 localhost", false, false);