From b237c73a04e01f845e318242ee72dad662fdb809 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Sep 2021 12:49:49 +0200 Subject: [PATCH] [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. --- src/modules/shellprocess/Tests.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/modules/shellprocess/Tests.cpp b/src/modules/shellprocess/Tests.cpp index 77368db48..c1489c1ab 100644 --- a/src/modules/shellprocess/Tests.cpp +++ b/src/modules/shellprocess/Tests.cpp @@ -42,16 +42,11 @@ ShellProcessTests::testProcessListSampleConfig() { YAML::Node doc; - QStringList dirs { "src/modules/shellprocess", "." }; - for ( const auto& dir : dirs ) - { - QString filename = dir + "/shellprocess.conf"; - if ( QFileInfo::exists( filename ) ) - { - doc = YAML::LoadFile( filename.toStdString() ); - break; - } - } + QString filename = QStringLiteral( "shellprocess.conf" ); + QFile fi( QString( "%1/%2" ).arg( BUILD_AS_TEST, filename ) ); + + QVERIFY( fi.exists() ); + doc = YAML::LoadFile( fi.fileName().toStdString() ); CommandList cl( CalamaresUtils::yamlMapToVariant( doc ).value( "script" ) ); QVERIFY( !cl.isEmpty() );