Merge branch 'development' into gaisser_storage_accessor_fix

This commit is contained in:
Robin Müller 2022-06-20 17:56:58 +02:00
commit 28ea71a077
6 changed files with 28 additions and 6 deletions

View File

@ -120,6 +120,9 @@ https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/593
## Additions
- Added options for CI/CD builds: `FSFW_CICD_BUILD`. This allows the source code to know
whether it is running in CI/CD
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/623
- Basic `clion` support: Update `.gitignore` and add some basic run configurations
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/625
- LTO support: Allow using LTO/IPO by setting `FSFW_ENABLE_LTO=1`. CMake is able to detect whether

View File

@ -105,6 +105,7 @@ endif()
option(FSFW_BUILD_UNITTESTS
"Build unittest binary in addition to static library" OFF)
option(FSFW_CICD_BUILD "Build for CI/CD. This can disable problematic test" OFF)
option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF)
if(FSFW_BUILD_UNITTESTS)
option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON)

View File

@ -99,7 +99,7 @@ add and link against the FSFW library in general.
4. Link against the FSFW library
```cmake
```sh
target_link_libraries(${YourProjectName} PRIVATE fsfw)
```
@ -131,7 +131,7 @@ default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF
You can use the following commands inside the `fsfw` folder to set up the build system
```sh
mkdir build-Unittest && cd build-Unittest
mkdir build-tests && cd build-tests
cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug ..
```

View File

@ -14,7 +14,7 @@ pipeline {
stage('Configure') {
steps {
dir(BUILDDIR) {
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..'
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON -DFSFW_CICD_BUILD=ON ..'
}
}
}

View File

@ -2,7 +2,9 @@
#include <catch2/catch_test_macros.hpp>
#include <fstream>
#include <iostream>
#include "tests/TestsConfig.h"
#include "fsfw/container/DynamicFIFO.h"
#include "fsfw/container/SimpleRingBuffer.h"
#include "fsfw/platform.h"
@ -61,6 +63,9 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
std::string cmpString = "Hello World\n";
CHECK(readString == cmpString);
outputBuffer.deleteData(12, true);
// Issues with CI/CD
#if FSFW_CICD_BUILD == 0
// Test more complex command
result = cmdExecutor.load("ping -c 1 localhost", false, false);
REQUIRE(cmdExecutor.getCurrentState() == CommandExecutor::States::COMMAND_LOADED);
@ -81,16 +86,27 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
REQUIRE(cmdExecutor.getCurrentState() == CommandExecutor::States::IDLE);
readBytes = 0;
sizesFifo.retrieve(&readBytes);
// That's about the size of the reply
bool beTrue = (readBytes > 200) and (readBytes < 300);
REQUIRE(beTrue);
uint8_t largerReadBuffer[1024] = {};
// That's about the size of the reply
bool beTrue = (readBytes > 100) and (readBytes < 400);
if (not beTrue) {
size_t readLen = outputBuffer.getAvailableReadData();
if (readLen > sizeof(largerReadBuffer) - 1) {
readLen = sizeof(largerReadBuffer) - 1;
}
outputBuffer.readData(largerReadBuffer, readLen);
std::string readString(reinterpret_cast<char*>(largerReadBuffer));
std::cerr << "Catch2 tag cmd-exec: Read " << readBytes << ": " << std::endl;
std::cerr << readString << std::endl;
}
REQUIRE(beTrue);
outputBuffer.readData(largerReadBuffer, readBytes);
// You can also check this output in the debugger
std::string allTheReply(reinterpret_cast<char*>(largerReadBuffer));
// I am just going to assume that this string is the same across ping implementations
// of different Linux systems
REQUIRE(allTheReply.find("PING localhost") != std::string::npos);
#endif
// Now check failing command
result = cmdExecutor.load("false", false, false);

View File

@ -1,6 +1,8 @@
#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
#cmakedefine01 FSFW_CICD_BUILD
#define FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS 1
#ifdef __cplusplus