continued tests, first fixes
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
parent
a2bc72a798
commit
8c2c402821
@ -1198,8 +1198,8 @@ void CoreController::performRebootFileHandling(bool recreateFile) {
|
||||
if (rebootFile.bootFlag) {
|
||||
// Trigger event to inform ground that a reboot was triggered
|
||||
uint32_t p1 = rebootFile.lastChip << 16 | rebootFile.lastCopy;
|
||||
uint32_t p2 = rebootFile.img00Cnt << 24 | rebootFile.img01Cnt << 16 |
|
||||
rebootFile.img10Cnt << 8 | rebootFile.img11Cnt;
|
||||
uint32_t p2 = rebootFile.img00Cnt << 24 | rebootFile.img01Cnt << 16 | rebootFile.img10Cnt << 8 |
|
||||
rebootFile.img11Cnt;
|
||||
triggerEvent(REBOOT_MECHANISM_TRIGGERED, p1, p2);
|
||||
// Clear the boot flag
|
||||
rebootFile.bootFlag = false;
|
||||
|
@ -25,11 +25,11 @@ struct RebootFile {
|
||||
|
||||
bool enabled = false;
|
||||
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
|
||||
uint8_t img00Cnt = 0;
|
||||
uint8_t img01Cnt = 0;
|
||||
uint8_t img10Cnt = 0;
|
||||
uint8_t img11Cnt = 0;
|
||||
uint8_t relevantBootCnt = 0;
|
||||
uint32_t img00Cnt = 0;
|
||||
uint32_t img01Cnt = 0;
|
||||
uint32_t img10Cnt = 0;
|
||||
uint32_t img11Cnt = 0;
|
||||
uint32_t relevantBootCnt = 0;
|
||||
bool bootFlag = false;
|
||||
xsc::Chip lastChip = xsc::Chip::CHIP_0;
|
||||
xsc::Copy lastCopy = xsc::Copy::COPY_0;
|
||||
@ -46,8 +46,10 @@ class CoreController : public ExtendedControllerBase {
|
||||
static constexpr char CONF_FOLDER[] = "conf";
|
||||
static constexpr char VERSION_FILE_NAME[] = "version.txt";
|
||||
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
|
||||
const std::string VERSION_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
|
||||
const std::string REBOOT_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
||||
const std::string VERSION_FILE =
|
||||
"/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
|
||||
const std::string REBOOT_FILE =
|
||||
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
|
||||
|
||||
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
|
||||
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;
|
||||
|
5
unittest/rebootLogic/.vscode/settings.json
vendored
5
unittest/rebootLogic/.vscode/settings.json
vendored
@ -1,3 +1,6 @@
|
||||
{
|
||||
"editor.tabSize": 2
|
||||
"editor.tabSize": 2,
|
||||
"files.associations": {
|
||||
"iosfwd": "cpp"
|
||||
}
|
||||
}
|
@ -362,7 +362,7 @@ void CoreController::rewriteRebootFile(RebootFile file) {
|
||||
rebootFile << "on: " << file.enabled << "\nmaxcnt: " << file.maxCount
|
||||
<< "\nimg00: " << file.img00Cnt << "\nimg01: " << file.img01Cnt
|
||||
<< "\nimg10: " << file.img10Cnt << "\nimg11: " << file.img11Cnt
|
||||
<< "\nbootflag: " << file.bootFlag << "\nlast: " << file.lastChip << " "
|
||||
<< file.lastCopy << "\n";
|
||||
<< "\nbootflag: " << file.bootFlag << "\nlast: " << static_cast<int>(file.lastChip) << " "
|
||||
<< static_cast<int>(file.lastCopy) << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ struct RebootFile {
|
||||
|
||||
bool enabled = false;
|
||||
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
|
||||
uint8_t img00Cnt = 0;
|
||||
uint8_t img01Cnt = 0;
|
||||
uint8_t img10Cnt = 0;
|
||||
uint8_t img11Cnt = 0;
|
||||
uint8_t relevantBootCnt = 0;
|
||||
uint32_t img00Cnt = 0;
|
||||
uint32_t img01Cnt = 0;
|
||||
uint32_t img10Cnt = 0;
|
||||
uint32_t img11Cnt = 0;
|
||||
uint32_t relevantBootCnt = 0;
|
||||
bool bootFlag = false;
|
||||
xsc::Chip lastChip = xsc::Chip::CHIP_0;
|
||||
xsc::Copy lastCopy = xsc::Copy::COPY_0;
|
||||
|
@ -1,8 +1,35 @@
|
||||
#include "CoreController.h"
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
|
||||
static constexpr bool CAT_FILE_TO_CONSOLE = true;
|
||||
const std::string CONF_PATH = "/tmp/conf";
|
||||
const std::string REBOOT_FILE = CONF_PATH + "/reboot.txt";
|
||||
|
||||
void catFileToConsole();
|
||||
|
||||
TEST_CASE( "Core Controller Reboot File Handling", "[reboot-file]" ) {
|
||||
CoreController ctrl;
|
||||
ctrl.performRebootFileHandling(true);
|
||||
|
||||
if(not std::filesystem::exists(CONF_PATH)) {
|
||||
std::filesystem::create_directory(CONF_PATH);
|
||||
}
|
||||
CoreController ctrl;
|
||||
RebootFile rf;
|
||||
ctrl.performRebootFileHandling(true);
|
||||
catFileToConsole();
|
||||
ctrl.parseRebootFile(REBOOT_FILE, rf);
|
||||
REQUIRE(rf.enabled == 1);
|
||||
REQUIRE(rf.enabled == 1);
|
||||
std::filesystem::remove_all(CONF_PATH);
|
||||
}
|
||||
|
||||
void catFileToConsole() {
|
||||
if(CAT_FILE_TO_CONSOLE) {
|
||||
std::ifstream file(REBOOT_FILE);
|
||||
if (file.is_open()) {
|
||||
std::cout << file.rdbuf();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user