Skip to content

Commit

Permalink
ci: split test targets
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas committed Jun 11, 2024
1 parent 42d32a4 commit 3fa59db
Show file tree
Hide file tree
Showing 179 changed files with 24 additions and 12 deletions.
20 changes: 9 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,15 @@ if (MRDOCS_BUILD_TESTS)
target_compile_options(mrdocs-test PRIVATE -Wno-covered-switch-default)
endif ()
target_compile_definitions(mrdocs-test PRIVATE -DMRDOCS_TEST_FILES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/test-files")
add_custom_command(
# if we run tests, we need the addons in the right place.
TARGET mrdocs-test
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/share/mrdocs/addons
${CMAKE_BINARY_DIR}/addons
BYPRODUCTS ${CMAKE_BINARY_DIR}/addons
DEPENDS ${CMAKE_SOURCE_DIR}/share/mrdocs/addons
)
add_test(NAME mrdocs-test COMMAND mrdocs-test --action test "${PROJECT_SOURCE_DIR}/test-files/old-tests")
add_test(NAME mrdocs-unit-tests COMMAND mrdocs-test --unit=true)
add_test(NAME mrdocs-golden-tests COMMAND mrdocs-test --unit=false --action=test "${PROJECT_SOURCE_DIR}/test-files/golden-tests" --addons="${CMAKE_SOURCE_DIR}/share/mrdocs/addons")
foreach (action IN ITEMS create update)
add_custom_target(
mrdocs-${action}-test-fixtures
COMMAND mrdocs-test --unit=false --action=${action} "${PROJECT_SOURCE_DIR}/test-files/golden-tests" --addons="${CMAKE_SOURCE_DIR}/share/mrdocs/addons"
DEPENDS mrdocs-test
)
endforeach ()

#-------------------------------------------------
# XML lint
Expand Down
5 changes: 5 additions & 0 deletions src/test/TestArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ R"(
llvm::cl::Sink,
llvm::cl::desc("A list of directories and/or .cpp files to test."),
llvm::cl::cat(commonCat))

, addons(
"addons",
llvm::cl::desc("The directory with the addons."),
llvm::cl::cat(commonCat))
{
}

Expand Down
3 changes: 2 additions & 1 deletion src/test/TestArgs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ class TestArgs
llvm::cl::opt<bool> badOption;
llvm::cl::opt<bool> unitOption;
llvm::cl::list<std::string> inputPaths;
llvm::cl::opt<std::string> addons;

// Hide all options which don't belong to us
// Hide all options that don't belong to us
void hideForeignOptions();
};

Expand Down
8 changes: 8 additions & 0 deletions src/test/TestRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@ checkPath(
publicSettings.config = configPath;
publicSettings.configDir = files::getParentDir(inputPath);
publicSettings.configYaml = files::getFileText(publicSettings.config).value();
if (testArgs.addons.getValue() != "")
{
publicSettings.addons = files::normalizeDir(testArgs.addons.getValue());
}
else
{
report::warn("No addons directory specified to mrdocs tests");
}
loadConfig(publicSettings, publicSettings.configYaml).value();
auto configFile = loadConfigFile(
publicSettings,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 3fa59db

Please sign in to comment.