[shellprocess] Fix test

The test was loading the config file (for testing) either from the
build directory or possibly the source directory; if the config
in the build-dir was edited (for other testing purposes) then
the test would fail. Load only the source-dir version of the file.
main
Adriaan de Groot 3 years ago
parent 563c149217
commit b237c73a04

@ -42,16 +42,11 @@ ShellProcessTests::testProcessListSampleConfig()
{ {
YAML::Node doc; YAML::Node doc;
QStringList dirs { "src/modules/shellprocess", "." }; QString filename = QStringLiteral( "shellprocess.conf" );
for ( const auto& dir : dirs ) QFile fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) );
{
QString filename = dir + "/shellprocess.conf"; QVERIFY( fi.exists() );
if ( QFileInfo::exists( filename ) ) doc = YAML::LoadFile( fi.fileName().toStdString() );
{
doc = YAML::LoadFile( filename.toStdString() );
break;
}
}
CommandList cl( CalamaresUtils::yamlMapToVariant( doc ).value( "script" ) ); CommandList cl( CalamaresUtils::yamlMapToVariant( doc ).value( "script" ) );
QVERIFY( !cl.isEmpty() ); QVERIFY( !cl.isEmpty() );

Loading…
Cancel
Save