Add handling of test-mode.

This commit is contained in:
Gerhard Hoffmann 2023-07-06 14:23:04 +02:00
parent f2556412d8
commit 17eaa7858f

View File

@ -83,6 +83,7 @@ Update::Update(hwinf *hw,
QString update_ctrl_file,
QString workingDir,
bool maintenanceMode,
bool testMode,
QObject *parent,
char const *serialInterface,
char const *baudrate)
@ -94,8 +95,10 @@ Update::Update(hwinf *hw,
, m_update_ctrl_file_copy(update_ctrl_file + ".copy")
, m_workingDir(workingDir)
, m_maintenanceMode(maintenanceMode)
, m_testMode(testMode)
, m_init(true) {
if (!m_testMode) {
// make sure the files are empty
if (m_update_ctrl_file.exists()) {
if (m_update_ctrl_file.open(QIODevice::ReadWrite |
@ -119,12 +122,16 @@ Update::Update(hwinf *hw,
<< "does not exist";
m_init = false;
}
}
// execute update_psa-script
if (m_init) {
if (!m_testMode) {
if ((m_init = execUpdateScript()) == false) {
qCritical() << "UPDATE_SCRIPT FAILED";
} else {
}
}
if (m_init) {
if (!m_update_ctrl_file.open(QIODevice::ReadWrite | QIODevice::Text)) {
qCritical() << "CAN NOT OPEN" << m_update_ctrl_file.fileName();
m_init = false;