From 8b052110d8802eda3d4d76700bde8ecc80dbf79a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 3 Jan 2018 21:17:49 +0100 Subject: Add "sibs test" command. Tests are only run when that command is invoked --- backend/ninja/Ninja.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'backend') diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp index a5fdb0d..04669f7 100644 --- a/backend/ninja/Ninja.cpp +++ b/backend/ninja/Ninja.cpp @@ -814,7 +814,7 @@ namespace backend Result Ninja::buildTests(const std::string &projectGeneratedBinary, const SibsConfig &config, const _tinydir_char_t *savePath) { - if(testSourceDirs.empty()) + if(testSourceDirs.empty() || !config.shouldBuildTests()) return Result::Ok(true); // Tests need parent project as dependency. Executables can't be included as dependency so we build it as dynamic library. @@ -888,6 +888,13 @@ namespace backend Result buildResult = ninja.compile(buildPath.c_str()); if (!buildResult) return buildResult; + + FileString testExecutableName = buildPath; + testExecutableName += TINYDIR_STRING("/"); + testExecutableName += toFileString(sibsTestConfig.getPackageName()); + Result runTestResult = exec(testExecutableName.c_str(), true); + if(!runTestResult) + return Result::Err(runTestResult); } } -- cgit v1.2.3