This commit is contained in:
Jorijn van der Graaf 2025-11-03 15:52:04 +01:00
commit ec64b17b27
4 changed files with 14 additions and 9 deletions

View file

@ -182,17 +182,16 @@ clang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --pr
name.replace_extension(); name.replace_extension();
if(!fs::exists(buildDir/name)) { if(!fs::exists(buildDir/name)) {
if(!config.dependencies[i].branch.empty()) { if(!config.dependencies[i].branch.empty()) {
RunCommandIgnore(std::format("cd {} && git clone {} && cd {} && git switch {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].branch)); system(std::format("cd {} && git clone {} && cd {} && git switch {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].branch).c_str());
} else if(!config.dependencies[i].commit.empty()){ } else if(!config.dependencies[i].commit.empty()){
std::cout << std::format("cd {} && git clone {} && cd {} && git checkout {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].commit) << std::endl; system(std::format("cd {} && git clone {} && cd {} && git checkout {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].commit).c_str());
RunCommandIgnore(std::format("cd {} && git clone {} && cd {} && git checkout {}", buildDir.string(), config.dependencies[i].path, (buildDir/name).string(), config.dependencies[i].commit));
} else { } else {
RunCommandIgnore(std::format("cd {} && git clone {}", buildDir.string(), config.dependencies[i].path)); system(std::format("cd {} && git clone {}", buildDir.string(), config.dependencies[i].path).c_str());
} }
} else if(config.dependencies[i].commit.empty()) { } else if(config.dependencies[i].commit.empty()) {
RunCommandIgnore(std::format("cd {} && git pull", (buildDir/name).string())); system(std::format("cd {} && git pull", (buildDir/name).string()).c_str());
} }
config.dependencies[i].path = fs::path(config.dependencies[i].path).filename().replace_extension()/"project.json"; config.dependencies[i].path = buildDir/name/"project.json";
} }
if(fs::path(config.dependencies[i].path).is_relative()) { if(fs::path(config.dependencies[i].path).is_relative()) {
config.dependencies[i].path = this->path/config.dependencies[i].path; config.dependencies[i].path = this->path/config.dependencies[i].path;
@ -372,7 +371,12 @@ clang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --pr
dlclose(handle); dlclose(handle);
throw std::runtime_error(std::format("Cannot load symbol 'RunTest': {}", msg)); throw std::runtime_error(std::format("Cannot load symbol 'RunTest': {}", msg));
} }
std::string* testResult = loadedTest(); std::string* testResult;
try {
testResult = loadedTest();
} catch(std::exception& e) {
return {test.config.name, std::string(e.what())};
}
if(testResult != nullptr) { if(testResult != nullptr) {
TestResult result = {test.config.name, *testResult}; TestResult result = {test.config.name, *testResult};
delete testResult; delete testResult;

View file

@ -70,7 +70,8 @@ int main(int argc, char* argv[]) {
binDir = std::format("{}/{}", project.binDir.string(), config.name); binDir = std::format("{}/{}", project.binDir.string(), config.name);
} }
if(config.debug) { if(config.debug) {
system(std::format("cd {} && lldb -o run {}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
//system(std::format("cd {} && lldb -o run {}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
} else { } else {
system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str()); system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
} }

View file

@ -37,7 +37,7 @@
"tests": [ "tests": [
{ {
"name": "should-compile", "name": "should-compile",
"implementations": ["tests/ShouldCompile/ShouldCompile"], "implementations": ["tests/ShouldCompile"],
"dependencies": [ "dependencies": [
{ {
"path":"./project.json", "path":"./project.json",