This commit is contained in:
parent
a25b0a1ded
commit
8892154b28
70 changed files with 2780 additions and 596 deletions
|
|
@ -1,5 +1,5 @@
|
|||
//SPDX-License-Identifier: LGPL-3.0-only
|
||||
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||||
|
||||
import std;
|
||||
import Crafter.Build;
|
||||
|
|
@ -7,28 +7,24 @@ namespace fs = std::filesystem;
|
|||
using namespace Crafter;
|
||||
|
||||
namespace {
|
||||
int failures = 0;
|
||||
std::int32_t Failures = 0;
|
||||
|
||||
void Check(bool cond, std::string_view msg) {
|
||||
if (!cond) {
|
||||
std::println(std::cerr, "FAIL: {}", msg);
|
||||
++failures;
|
||||
++Failures;
|
||||
}
|
||||
}
|
||||
|
||||
// Write a tiny POSIX shell script that exits with `code` and return its
|
||||
// path. The harness invokes `<binary> <args>` through the host shell, so
|
||||
// a #!/bin/sh script works as a stand-in for a real test binary.
|
||||
fs::path WriteExitScript(const fs::path& dir, std::string_view stem, int code) {
|
||||
fs::path WriteExitScript(const fs::path& dir, std::string_view stem, std::int32_t code) {
|
||||
fs::path script = dir / stem;
|
||||
std::ofstream out(script);
|
||||
out << "#!/bin/sh\nexit " << code << "\n";
|
||||
out.close();
|
||||
fs::permissions(script,
|
||||
fs::perms::owner_read | fs::perms::owner_write | fs::perms::owner_exec
|
||||
| fs::perms::group_read | fs::perms::group_exec
|
||||
| fs::perms::others_read | fs::perms::others_exec,
|
||||
fs::perm_options::replace);
|
||||
fs::permissions(script, fs::perms::owner_read | fs::perms::owner_write | fs::perms::owner_exec | fs::perms::group_read | fs::perms::group_exec | fs::perms::others_read | fs::perms::others_exec, fs::perm_options::replace);
|
||||
return script;
|
||||
}
|
||||
}
|
||||
|
|
@ -82,8 +78,8 @@ int main() {
|
|||
|
||||
fs::remove_all(dir, ec);
|
||||
|
||||
if (failures > 0) {
|
||||
std::println(std::cerr, "{} assertions failed", failures);
|
||||
if (Failures > 0) {
|
||||
std::println(std::cerr, "{} assertions failed", Failures);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue