From 150e2d5284b5c233ad1028bf9dd02dca40bdd377 Mon Sep 17 00:00:00 2001 From: Ben Vining Date: Mon, 28 Aug 2023 20:26:25 -0500 Subject: [PATCH 1/2] feat: added auto-generation of a command line docs page resolves #89 [https://github.com/Tracktion/pluginval/issues/89] --- CMakeLists.txt | 9 +++++++ docs/Command line options.md | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 docs/Command line options.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a301822..4b64c0d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,3 +92,12 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") target_link_libraries(pluginval PRIVATE -static-libstdc++) endif() + +set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR}/docs/Command line options.md") + +add_custom_command (OUTPUT "${cmdline_docs_out}" + COMMAND pluginval --help > "${cmdline_docs_out}" + COMMENT "Regenerating Command line options.md..." + USES_TERMINAL) + +add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out}") diff --git a/docs/Command line options.md b/docs/Command line options.md new file mode 100644 index 00000000..178d2ddb --- /dev/null +++ b/docs/Command line options.md @@ -0,0 +1,51 @@ +//============================================================================== +pluginval +JUCE v7.0.2 + +Description: + Validate plugins to test compatibility with hosts and verify plugin API conformance + +Usage: + --validate [pathToPlugin] + Validates the plugin at the given path. + N.B. the --validate flag is optional if the path is the last argument. This enables you to validate a plugin with simply "pluginval path_to_plugin". + --strictness-level [1-10] + Sets the strictness level to use. A minimum level of 5 (also the default) is recomended for compatibility. Higher levels include longer, more thorough tests such as fuzzing. + --random-seed [hex or int] + Sets the random seed to use for the tests. Useful for replicating test environments. + --timeout-ms [numMilliseconds] + Sets a timout which will stop validation with an error if no output from any test has happened for this number of ms. + By default this is 30s but can be set to -1 to never timeout. + --verbose + If specified, outputs additional logging information. It can be useful to turn this off when building with CI to avoid huge log files. + --skip-gui-tests + If specified, avoids tests that create GUI windows, which can cause problems on headless CI systems. + --repeat [num repeats] + If specified repeats the tests a given number of times. Note that this does not delete and re-instantiate the plugin for each repeat. --randomise + If specified the tests are run in a random order per repeat. --data-file [pathToFile] + 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. + --output-dir [pathToDir] + If specified, sets a directory to store the log files. This can be useful for continuous integration. + --disabled-tests [pathToFile] + If specified, sets a path to a file that should have the names of disabled tests on each row. + --sample-rates [list of comma separated sample rates] + If specified, sets the list of sample rates at which tests will be executed (default=44100,48000,96000) + --block-sizes [list of comma separated block sizes] + If specified, sets the list of block sizes at which tests will be executed (default=64,128,256,512,1024) + --vst3validator [pathToValidator] + If specified, this will run the VST3 validator as part of the test process. + --version + Print pluginval version. + +Exit code: + 0 if all tests complete successfully + 1 if there are any errors + +Additionally, you can specify any of the command line options as environment varibles by removing prefix dashes, converting internal dashes to underscores and captialising all letters e.g. "--skip-gui-tests" > "SKIP_GUI_TESTS=1", "--timeout-ms 30000" > "TIMEOUT_MS=30000" +Specifying specific command-line options will override any environment variables set for that option. + + pluginval --version Prints the current version number + pluginval --help|-h Prints the list of commands + pluginval --validate [pathToPlugin] Validates the file (or IDs for AUs). + pluginval --run-tests Runs the internal unit tests. + From a8efcebc592e3eca574043f02409f537adc87a20 Mon Sep 17 00:00:00 2001 From: Ben Vining Date: Wed, 24 Jan 2024 17:59:24 -0600 Subject: [PATCH 2/2] added cmake script to register tests --- tests/AddPluginvalTests.cmake | 103 ++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 tests/AddPluginvalTests.cmake diff --git a/tests/AddPluginvalTests.cmake b/tests/AddPluginvalTests.cmake new file mode 100644 index 00000000..c4850712 --- /dev/null +++ b/tests/AddPluginvalTests.cmake @@ -0,0 +1,103 @@ +include_guard (GLOBAL) + +find_program (PLUGINVAL_PROGRAM pluginval DOC "pluginval executable") + +if (NOT PLUGINVAL_PROGRAM) + message (WARNING "pluginval not found!") +endif () + +set (PLUGINVAL_STRICTNESS 10 CACHE STRING "pluginval strictness level, 1 to 10") + +set_property ( + CACHE PLUGINVAL_STRICTNESS + PROPERTY STRINGS + 1 2 3 4 5 6 7 8 9 10) + +set (PLUGINVAL_REPEATS 0 CACHE STRING "number of times to repeat pluginval tests") + +set (PLUGINVAL_SAMPLERATES "44100;44800;96000" CACHE STRING "samplerates to test in pluginval") + +set (PLUGINVAL_BLOCKSIZES "1;250;512" CACHE STRING "blocksizes to test in pluginval") + +mark_as_advanced ( + PLUGINVAL_PROGRAM PLUGINVAL_STRICTNESS PLUGINVAL_REPEATS + PLUGINVAL_SAMPLERATES PLUGINVAL_BLOCKSIZES +) + +# + +#[[ + add_pluginval_tests ( + pluginTarget + [TEST_PREFIX ] + [LOG_DIR ] + [NAMES_OUT ] + ) + + TEST_PREFIX defaults to ${pluginTarget}.pluginval + + LOG_DIR - relative paths will be evaluated relative to the current binary directory + + NAMES_OUT can be name of a variable to be poplated with test names in calling scope +]] +function (add_pluginval_tests pluginTarget) + + if (NOT TARGET "${pluginTarget}") + message ( + FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} - target '${pluginTarget}' does not exist!" + ) + endif () + + cmake_parse_arguments (ARG "" "TEST_PREFIX;LOG_DIR;NAMES_OUT" "" ${ARGN}) + + if (ARG_NAMES_OUT) + unset ("${ARG_NAMES_OUT}" PARENT_SCOPE) + endif () + + if (NOT PLUGINVAL_PROGRAM) + return () + endif () + + if (NOT ARG_TEST_PREFIX) + set (ARG_TEST_PREFIX "${pluginTarget}.pluginval") + endif () + + list (JOIN PLUGINVAL_SAMPLERATES "," sample_rates) + list (JOIN PLUGINVAL_BLOCKSIZES "," block_sizes) + + set (test_name "${ARG_TEST_PREFIX}.VST3") + + get_target_property (plugin_artefact "${pluginTarget}_VST3" JUCE_PLUGIN_ARTEFACT_FILE) + + if (ARG_LOG_DIR) + if (NOT IS_ABSOLUTE "${ARG_LOG_DIR}") + set (ARG_LOG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${ARG_LOG_DIR}") + endif () + + set (log_dir_arg --output-dir "${ARG_LOG_DIR}") + else () + unset (log_dir_arg) + endif () + + add_test (NAME "${test_name}" + COMMAND "${PLUGINVAL_PROGRAM}" + --strictness-level "${PLUGINVAL_STRICTNESS}" + --sample-rates "${sample_rates}" + --block-sizes "${block_sizes}" + --repeat "${PLUGINVAL_REPEATS}" + --randomise + --validate "${plugin_artefact}" + ${log_dir_arg} + ) + + set_tests_properties ( + "${test_name}" PROPERTIES REQUIRED_FILES "${plugin_artefact}" + ) + + message (VERBOSE "Added pluginval test for plugin target ${format_target}") + + if (ARG_NAMES_OUT) + set ("${ARG_NAMES_OUT}" "${test_name}" PARENT_SCOPE) + endif () + +endfunction ()