moved test

This commit is contained in:
Robin Müller 2021-08-19 14:16:26 +02:00
parent c1b22af695
commit a6777067da
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 46 additions and 3 deletions

View File

@ -1,3 +1,4 @@
#include <bsp_q7s/core/CoreController.h>
#include <bsp_q7s/memory/FileSystemHandler.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include "Q7STestTask.h"
@ -24,6 +25,7 @@ ReturnValue_t Q7STestTask::performOneShotAction() {
//testScratchApi();
//testJsonLibDirect();
//testDummyParams();
testProtHandler();
//FsOpCodes opCode = FsOpCodes::ATTEMPT_DIR_REMOVAL_NON_EMPTY;
//testFileSystemHandlerDirect(opCode);
return TestTask::performOneShotAction();
@ -131,6 +133,46 @@ void Q7STestTask::testDummyParams() {
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
}
ReturnValue_t Q7STestTask::initialize() {
coreController = ObjectManager::instance()->get<CoreController>(objects::CORE_CONTROLLER);
if(coreController == nullptr) {
sif::warning << "Q7STestTask::initialize: Could not retrieve CORE_CONTROLLER object" <<
std::endl;
}
return TestTask::initialize();
}
void Q7STestTask::testProtHandler() {
bool opPerformed = false;
ReturnValue_t result = coreController->checkAndSetBootCopyProtection(
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, false,
opPerformed, true);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if(not opPerformed) {
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
}
int retval = std::system("print-chip-prot-status.sh");
if(retval != 0) {
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
}
result = coreController->checkAndSetBootCopyProtection(
CoreController::Chip::SELF_CHIP, CoreController::Copy::SELF_COPY, true,
opPerformed, true);
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "Q7STestTask::testProtHandler: Op failed" << std::endl;
}
if(not opPerformed) {
sif::warning << "Q7STestTask::testProtHandler: No op performed" << std::endl;
}
retval = std::system("print-chip-prot-status.sh");
if(retval != 0) {
utility::handleSystemError(retval, "Q7STestTask::testProtHandler");
}
}
void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) {
auto fsHandler = ObjectManager::instance()->
get<FileSystemHandler>(objects::FILE_SYSTEM_HANDLER);

View File

@ -6,7 +6,10 @@
class Q7STestTask: public TestTask {
public:
Q7STestTask(object_id_t objectId);
ReturnValue_t initialize() override;
private:
CoreController* coreController = nullptr;
ReturnValue_t performOneShotAction() override;
void testSdCard();
@ -15,6 +18,7 @@ private:
void testScratchApi();
void testJsonLibDirect();
void testDummyParams();
void testProtHandler();
enum FsOpCodes {
CREATE_EMPTY_FILE_IN_TMP,

View File

@ -1052,9 +1052,6 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) {
"Line counter larger than 4" << std::endl;
}
}
for(uint8_t idx = 0; idx < 4; idx ++) {
sif::debug << (int) protArray[idx] << std::endl;
}
return HasReturnvaluesIF::RETURN_OK;
}