aboutsummaryrefslogtreecommitdiff
path: root/backend/ninja
diff options
context:
space:
mode:
Diffstat (limited to 'backend/ninja')
-rw-r--r--backend/ninja/Ninja.cpp9
1 files changed, 8 insertions, 1 deletions
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<bool> Ninja::buildTests(const std::string &projectGeneratedBinary, const SibsConfig &config, const _tinydir_char_t *savePath)
{
- if(testSourceDirs.empty())
+ if(testSourceDirs.empty() || !config.shouldBuildTests())
return Result<bool>::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<bool> buildResult = ninja.compile(buildPath.c_str());
if (!buildResult)
return buildResult;
+
+ FileString testExecutableName = buildPath;
+ testExecutableName += TINYDIR_STRING("/");
+ testExecutableName += toFileString(sibsTestConfig.getPackageName());
+ Result<ExecResult> runTestResult = exec(testExecutableName.c_str(), true);
+ if(!runTestResult)
+ return Result<bool>::Err(runTestResult);
}
}