41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
|
|
/*
|
||
|
|
Crafter® Build
|
||
|
|
Copyright (C) 2026 Catcrafts®
|
||
|
|
Catcrafts.net
|
||
|
|
|
||
|
|
LGPL-3.0-only.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import std;
|
||
|
|
import Crafter.Build;
|
||
|
|
#include "../_shared/TestUtil.h"
|
||
|
|
namespace fs = std::filesystem;
|
||
|
|
using namespace TestUtil;
|
||
|
|
using namespace Crafter;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
try {
|
||
|
|
fs::path src = fs::current_path() / "tests" / "BuildError" / "inner";
|
||
|
|
Configuration cfg = LoadFixture("BuildError", src);
|
||
|
|
fs::path work = fs::current_path();
|
||
|
|
|
||
|
|
auto br = BuildOnce(cfg);
|
||
|
|
if (br.result.empty()) {
|
||
|
|
std::println(std::cerr, "expected build failure, got success");
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
if (br.result.find("undefined_symbol_xyzzy_oqv") == std::string::npos) {
|
||
|
|
std::println(std::cerr, "diagnostic missing unresolved-name reference:\n{}", br.result);
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
fs::path artifact = work / "bin" / "broken-x86_64-pc-linux-gnu-native" / "broken";
|
||
|
|
if (fs::exists(artifact)) {
|
||
|
|
std::println(std::cerr, "artifact unexpectedly produced at {}", artifact.string());
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
return 0;
|
||
|
|
} catch (const std::exception& e) {
|
||
|
|
std::println(std::cerr, "test exception: {}", e.what());
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
}
|