Skip to content

Commit

Permalink
[tests] Avoid warning from ignoring system() return value. MER#1749
Browse files Browse the repository at this point in the history
Compiler warns about ignoring system() function return value.

Since this is test/debug code, just change the code enough to silence the
warning and make it clear we are ignoring the return value on purpose.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Feb 7, 2017
1 parent 346882b commit 51e1528
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion tests/powermanagement/powermanagementtests/helpslot.h
Expand Up @@ -52,7 +52,11 @@ class HelpSlot : public QThread
{
while(!m_stop) {
msleep(250);
system(QString("echo 0 0 0 | datafaker %1 & { sleep 0.1; eval 'kill $!' &> /dev/null; }").arg(m_inputFile).toLatin1().constData());
if (system(QString("echo 0 0 0 | datafaker %1 & { sleep 0.1; eval 'kill $!' &> /dev/null; }").arg(m_inputFile).toLatin1().constData()) != 0) {
/* Gcc will complain about completely ignoring
* system() return values. As we really do not
* care here, use dummy test to silence warnings. */
}
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions tests/powermanagement/standbyoverridetests/helpslot.h
Expand Up @@ -52,11 +52,15 @@ class HelpSlot : public QThread
{
while(!m_stop) {
msleep(250);
system(QString("echo 0 0 0 | datafaker %1 & { sleep 0.1; eval 'kill $!' &> /dev/null; }").arg(m_inputFile).toLatin1().constData());
if (system(QString("echo 0 0 0 | datafaker %1 & { sleep 0.1; eval 'kill $!' &> /dev/null; }").arg(m_inputFile).toLatin1().constData()) != 0) {
/* Gcc will complain about completely ignoring
* system() return values. As we really do not
* care here, use dummy test to silence warnings. */
}
}

}
}

QString m_inputFile;
int m_valueCount;
bool m_stop;
Expand Down

0 comments on commit 51e1528

Please sign in to comment.