[libcalamares] Start extending tests to runCommand()

This commit is contained in:
Adriaan de Groot 2019-06-07 13:56:16 +02:00
parent 07a59bd09c
commit 5a835f32b8
2 changed files with 23 additions and 0 deletions

View File

@ -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() ) );
}

View File

@ -34,6 +34,8 @@ private Q_SLOTS:
void testLoadSaveYaml(); // Just settings.conf
void testLoadSaveYamlExtended(); // Do a find() in the src dir
void testCommands();
};
#endif