[libcalamares] Start extending tests to runCommand()
This commit is contained in:
parent
07a59bd09c
commit
5a835f32b8
@ -18,9 +18,12 @@
|
||||
|
||||
#include "Tests.h"
|
||||
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Yaml.h"
|
||||
|
||||
#include <QTemporaryFile>
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
QTEST_GUILESS_MAIN( LibCalamaresTests )
|
||||
@ -113,3 +116,21 @@ LibCalamaresTests::testLoadSaveYamlExtended()
|
||||
}
|
||||
QFile::remove( "out.yaml" );
|
||||
}
|
||||
|
||||
void
|
||||
LibCalamaresTests::testCommands()
|
||||
{
|
||||
using CalamaresUtils::System;
|
||||
auto r = System::runCommand(
|
||||
System::RunLocation::RunInHost,
|
||||
{ "/bin/ls", "/tmp" }
|
||||
);
|
||||
|
||||
QVERIFY( r.getExitCode() == 0 );
|
||||
|
||||
QTemporaryFile tf( "/tmp/calamares-test-XXXXXX" );
|
||||
QVERIFY( tf.open() );
|
||||
QVERIFY( !tf.fileName().isEmpty() );
|
||||
|
||||
QVERIFY( r.getOutput().contains( tf.fileName() ) );
|
||||
}
|
||||
|
@ -34,6 +34,8 @@ private Q_SLOTS:
|
||||
|
||||
void testLoadSaveYaml(); // Just settings.conf
|
||||
void testLoadSaveYamlExtended(); // Do a find() in the src dir
|
||||
|
||||
void testCommands();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user