aboutsummaryrefslogtreecommitdiff
path: root/backend/ninja
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-01-03 21:17:49 +0100
committerdec05eba <dec05eba@protonmail.com>2018-01-03 21:42:51 +0100
commit8b052110d8802eda3d4d76700bde8ecc80dbf79a (patch)
tree13d9248067ba61c159e61f6083e090b26916c22f /backend/ninja
parent469a67628f3eb18236ee44e948d1ae0f0e6b1a4a (diff)
Add "sibs test" command. Tests are only run when that command is invoked
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);
}
}