Skip to content

Commit cc41f87

Browse files
committed
Tests: Added an option to pass a file with disabled tests
1 parent e0d24ca commit cc41f87

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

Source/CommandLine.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ File getOutputDir (const ArgumentList& args)
173173
return getOptionValue (args, "--output-dir", {}, "Missing output-dir path argument!").toString();
174174
}
175175

176+
StringArray getDisabledTest (const ArgumentList& args)
177+
{
178+
const File disabledTestsFile (getOptionValue (args, "--disabled-tests", {}, "Missing disabled-tests path argument!").toString());
179+
180+
StringArray disabledTests;
181+
disabledTestsFile.readLines (disabledTests);
182+
183+
return disabledTests;
184+
}
176185

177186
//==============================================================================
178187
String parseCommandLineArgs (String commandLine)
@@ -281,6 +290,8 @@ static String getHelpMessage()
281290
<< " If specified, sets a path to a data file which can be used by tests to configure themselves. This can be useful for things like known audio output." << newLine
282291
<< " --output-dir [pathToDir]" << newLine
283292
<< " If specified, sets a directory to store the log files. This can be useful for continuous integration." << newLine
293+
<< " --disabled-tests [pathToFile]" << newLine
294+
<< " If specified, sets a path to a file that should have the names of disabled tests on each row." << newLine
284295
<< " --version" << newLine
285296
<< " Print pluginval version." << newLine
286297
<< newLine
@@ -337,6 +348,7 @@ static void validate (CommandLineValidator& validator, const ArgumentList& args)
337348
options.dataFile = getDataFile (args);
338349
options.outputDir = getOutputDir (args);
339350
options.withGUI = ! args.containsOption ("--skip-gui-tests");
351+
options.disabledTests = getDisabledTest (args);
340352

341353
validator.validate (fileOrIDs,
342354
options,

Source/PluginTests.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ void PluginTests::testType (const PluginDescription& pd)
168168
|| (! options.withGUI && t->requiresGUI()))
169169
continue;
170170

171+
if (options.disabledTests.contains (t->name))
172+
{
173+
logMessage ("\nINFO: \"" + t->name + "\" is disabled.");
174+
continue;
175+
}
176+
171177
StopwatchTimer sw2;
172178
beginTest (t->name);
173179

Source/PluginTests.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct PluginTests : public UnitTest
3535
bool withGUI = true; /**< Whether or not avoid tests that instantiate a gui. */
3636
File dataFile; /**< File which tests can use to run user provided data. */
3737
File outputDir; /**< Directory in which to write the log files for each test run. */
38+
StringArray disabledTests; /**< List of disabled tests. */
3839
};
3940

4041
/** Creates a set of tests for a fileOrIdentifier. */

Source/Validator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ namespace IDs
246246
DECLARE_ID(dataFile)
247247
DECLARE_ID(outputDir)
248248
DECLARE_ID(withGUI)
249+
DECLARE_ID(disabledTests)
249250

250251
DECLARE_ID(MESSAGE)
251252
DECLARE_ID(type)
@@ -472,6 +473,10 @@ class ValidatorSlaveProcess : public ChildProcessSlave,
472473
options.outputDir = File (v[IDs::outputDir].toString());
473474
options.withGUI = v.getProperty (IDs::withGUI, true);
474475

476+
if (auto varArray = v.getProperty (IDs::disabledTests, true).getArray())
477+
for (auto disabledTest : *varArray)
478+
options.disabledTests.add (disabledTest);
479+
475480
for (auto c : v)
476481
{
477482
String fileOrID;
@@ -661,6 +666,7 @@ class ValidatorMasterProcess : public ChildProcessMaster
661666
v.setProperty (IDs::dataFile, options.dataFile.getFullPathName(), nullptr);
662667
v.setProperty (IDs::outputDir, options.outputDir.getFullPathName(), nullptr);
663668
v.setProperty (IDs::withGUI, options.withGUI, nullptr);
669+
v.setProperty (IDs::disabledTests, options.disabledTests, nullptr);
664670

665671
return v;
666672
}

0 commit comments

Comments
 (0)