Files
Build-System/tests/ExampleContexts.cpp
T
faumaray e333bbe84b
VoidBuildSystem CI / 1 · Requirements (push) Successful in 6s
VoidBuildSystem CI / 2C · Windows native build (debug) (push) Failing after 1m32s
VoidBuildSystem CI / 2C · Windows native build (sanitizers) (push) Failing after 18s
VoidBuildSystem CI / 2C · Windows native build (relwithdebinfo) (push) Failing after 3m4s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 6m20s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 6m32s
VoidBuildSystem CI / 3C · Windows native test (debug) (push) Failing after 1m45s
VoidBuildSystem CI / 2B · Windows Wine build (sanitizers) (push) Successful in 6m55s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 6m59s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 6m59s
VoidBuildSystem CI / 3C · Windows native test (sanitizers) (push) Failing after 15s
VoidBuildSystem CI / 3C · Windows native test (relwithdebinfo) (push) Failing after 1m47s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 2m4s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 1m6s
VoidBuildSystem CI / 4B · Windows package (sanitizers) (push) Successful in 12s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 4m2s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 1m44s
VoidBuildSystem CI / 3B · Windows Wine test (sanitizers) (push) Successful in 3m16s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 3m21s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m45s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 6m54s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 3m42s
feat(platform): build on native Windows hosts
Bump VoidLibrary to 482a3ea (Windows target support: qualified
Configuration/Crypto/System/Archive, Windows DirectoryWatcher,
TempDir/TempFile, process pipes) and port VBS's own host backends:

- Toolchain: Windows/macOS host names and architectures without uname.
- Platform FileOps: Win32 stat metadata, CreateFileW+LockFileEx file
  locks (Void FileLock is POSIX-only, Void/Library#66), no-op
  directory fsync, GetModuleFileNameW executable path, mtime via
  std::filesystem, and a file-copy fallback for the compdb alias.
- ProcessSupervisor: Windows PATH/PATHEXT resolution and no POSIX
  waitpid reaping (job objects own descendants).
- Snapshot: directory listing through std::filesystem on Windows.
- Remote cache/registry client/CDash: curl or Winsock-based HTTP on
  Windows (Void::Net is not qualified there yet).
- Daemon: explicit unsupported errors on Windows (named-pipe
  transport is Track C3); the registry service stays POSIX-only and
  is excluded from the Windows build.
- StateStore/Sbom/Main/Graph: portable stat, time and path handling.

Verified: MinGW-w64 GCC 16.2 builds vbs, vbs_describe, vbs_benchmarks
and the sdk/core/v1/selfhost test executables; vbs runs under Wine
and the SDK suite passes 17/17. The Linux suite stays green (8/8).
2026-12-06 02:01:24 +03:00

83 lines
4.8 KiB
C++

#include <Void/Build.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
#include <algorithm>
VOID_TEST(ExampleContexts, example_uses_runtime_compiler) {
Void::Build::Profiles definitions;
profiles(definitions);
Void::Build::Project gcc{
definitions.resolve("debug", Void::Build::CompilerFamily::Gcc, "linux", "x86_64")};
Void::Build::Project clang{
definitions.resolve("debug", Void::Build::CompilerFamily::Clang, "linux", "x86_64")};
build(gcc);
build(clang);
Void::Testing::expect_eq(gcc.targets().size(), clang.targets().size());
for (std::size_t index = 0; index < gcc.targets().size(); ++index) {
if (gcc.targets().at(index).kind == Void::Build::TargetKind::CustomAction) {
continue;
}
Void::Testing::expect(std::ranges::contains(gcc.targets().at(index).compile_options,
std::string{"-Wduplicated-cond"}));
Void::Testing::expect(!std::ranges::contains(gcc.targets().at(index).compile_options,
std::string{"-Wextra-semi"}));
Void::Testing::expect(std::ranges::contains(clang.targets().at(index).compile_options,
std::string{"-Wextra-semi"}));
Void::Testing::expect(!std::ranges::contains(clang.targets().at(index).compile_options,
std::string{"-Wduplicated-cond"}));
}
}
VOID_TEST(ExampleContexts, example_profile_options_are_separate) {
Void::Build::Profiles definitions;
profiles(definitions);
Void::Build::Project debug{
definitions.resolve("debug", Void::Build::CompilerFamily::Gcc, "linux", "x86_64")};
Void::Build::Project release{
definitions.resolve("release", Void::Build::CompilerFamily::Gcc, "linux", "x86_64")};
build(debug);
build(release);
Void::Testing::expect(
std::ranges::contains(debug.context().compile_options, std::string{"-g"}));
Void::Testing::expect(
std::ranges::contains(release.context().compile_options, std::string{"-O3"}));
Void::Testing::expect(
!std::ranges::contains(release.context().compile_options, std::string{"-g"}));
Void::Testing::expect(debug.to_json() != release.to_json());
}
VOID_TEST(ExampleContexts, example_records_sources_links_and_pin) {
Void::Build::Project project{Void::Build::default_profiles().resolve(
"debug", Void::Build::CompilerFamily::Gcc, "linux", "x86_64")};
build(project);
Void::Testing::expect_eq(project.targets().size(), std::size_t{13});
Void::Testing::expect_eq(project.targets().at(0).name, std::string{"VoidBuildSdk"});
Void::Testing::expect_eq(project.targets().at(0).sources.at(0).path,
std::string{"sdk/*.cpp"});
Void::Testing::expect_eq(project.targets().at(1).name, std::string{"VoidBuildCore"});
Void::Testing::expect_eq(project.targets().at(1).links.at(0).target,
std::string{"VoidBuildSdk"});
Void::Testing::expect_eq(project.targets().at(1).links.at(1).target,
std::string{"Void::Configuration"});
Void::Testing::expect_eq(project.targets().at(2).name, std::string{"GenerateBootstrapConfig"});
Void::Testing::expect_eq(project.targets().at(3).name, std::string{"vbs"});
Void::Testing::expect_eq(project.targets().at(3).links.at(0).target,
std::string{"VoidBuildCore"});
Void::Testing::expect_eq(project.targets().at(4).name, std::string{"VoidBuildRegistry"});
Void::Testing::expect_eq(project.targets().at(5).name, std::string{"vbs-registry"});
Void::Testing::expect_eq(project.targets().at(6).name, std::string{"vbs_registry_tests"});
Void::Testing::expect_eq(project.targets().at(6).kind, Void::Build::TargetKind::Test);
Void::Testing::expect_eq(project.targets().at(7).name, std::string{"vbs_self_smoke"});
Void::Testing::expect_eq(project.targets().at(7).kind, Void::Build::TargetKind::Test);
Void::Testing::expect_eq(project.targets().at(8).name, std::string{"vbs_benchmarks"});
Void::Testing::expect_eq(project.targets().at(9).name, std::string{"vbs_sdk_tests"});
Void::Testing::expect_eq(project.targets().at(9).kind, Void::Build::TargetKind::Test);
Void::Testing::expect_eq(project.targets().at(10).name, std::string{"vbs_core_tests"});
Void::Testing::expect_eq(project.targets().at(11).name, std::string{"vbs_v1_tests"});
Void::Testing::expect_eq(project.targets().at(12).name, std::string{"vbs_selfhost_tests"});
Void::Testing::expect_eq(project.dependencies().at(0).revision,
std::string{"482a3ea46b0050ec07f5063fd319e66180b4d2e4"});
Void::Testing::expect_eq(project.dependencies().at(0).builder, std::string{"native"});
}