From 05bc0cbb09964b0349f941f4654955f781a914ec Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 5 Nov 2024 14:51:11 +0100 Subject: [PATCH] [libcalamares] Make other tests more resilient Use the full path to the test file, rather than assuming the test is run from the build-directory. Repair check that looked at the number of keys in the test-file, now that a new key has been added. --- src/libcalamares/Tests.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libcalamares/Tests.cpp b/src/libcalamares/Tests.cpp index 956fda14f..0b718d14e 100644 --- a/src/libcalamares/Tests.cpp +++ b/src/libcalamares/Tests.cpp @@ -127,17 +127,14 @@ TestLibCalamares::testGSLoadSave2() { Logger::setupLogLevel( Logger::LOGDEBUG ); - const QString filename( "../src/libcalamares/testdata/yaml-list.conf" ); - if ( !QFile::exists( filename ) ) - { - return; - } + const QString filename( BUILD_AS_TEST "/testdata/yaml-list.conf" ); + QVERIFY2( QFile::exists( filename ), qPrintable( filename ) ); Calamares::GlobalStorage gs1; const QString key( "dwarfs" ); QVERIFY( gs1.loadYaml( filename ) ); - QCOMPARE( gs1.count(), 3 ); // From examining the file + QCOMPARE( gs1.count(), 4 ); // From examining the file QVERIFY( gs1.contains( key ) ); cDebug() << Calamares::typeOf( gs1.value( key ) ) << gs1.value( key ); QCOMPARE( Calamares::typeOf( gs1.value( key ) ), Calamares::ListVariantType );