VoidBuildSystem CI / 1 · Requirements (push) Successful in 4s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m6s
VoidBuildSystem CI / 2A · Linux build (coverage) (push) Successful in 2m19s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m19s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m18s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m40s
VoidBuildSystem CI / 3A · Linux test (coverage) (push) Failing after 35s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 19s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 17s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 52s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Failing after 5m50s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Failing after 6m55s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Skipped
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Skipped
VoidBuildSystem CI / 5 · Release (push) Skipped
- vbs tree prints the resolved lock contexts (source kind, version, features, build-only) and reports packages resolved to multiple versions with --duplicates. - vbs fmt formats or checks owned C/C++ sources with clang-format, supports explicit paths (resolved against --project), --changed-only via git, and skips build/VCS/vendor directories. - vbs lint runs clang-tidy against the build's compile_commands.json with --fix and --warnings-as-errors, --changed-only included. - vbs install-binary picks the newest release with Void::Semver ordering, selects the host os/arch variant by default, verifies signatures when trusted keys are configured, SHA-256-verifies the download and installs into <prefix>/bin. Verified: tree_prints_lock_entries_and_reports_duplicates, fmt_check_detects_unformatted_files_and_fixes_them and the CLI contract suite pass; clang-format clean.
258 lines
14 KiB
CMake
258 lines
14 KiB
CMake
cmake_minimum_required(VERSION 4.0)
|
|
|
|
# Captured output must be plain text: the CLI colorizes help when colors are allowed.
|
|
set(ENV{NO_COLOR} "1")
|
|
|
|
function(check_process expected_code expected_out_regex expected_err_regex)
|
|
execute_process(COMMAND "${VBS}" ${ARGN}
|
|
RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 15)
|
|
if(NOT "${code}" STREQUAL "${expected_code}")
|
|
message(FATAL_ERROR "vbs ${ARGN}: expected exit ${expected_code}, got ${code}\nstdout=[${out}]\nstderr=[${err}]")
|
|
endif()
|
|
if(NOT "${expected_out_regex}" STREQUAL "" AND NOT out MATCHES "${expected_out_regex}")
|
|
message(FATAL_ERROR "vbs ${ARGN}: stdout did not match [${expected_out_regex}]\nactual=[${out}]")
|
|
endif()
|
|
if(NOT "${expected_err_regex}" STREQUAL "" AND NOT err MATCHES "${expected_err_regex}")
|
|
message(FATAL_ERROR "vbs ${ARGN}: stderr did not match [${expected_err_regex}]\nactual=[${err}]")
|
|
endif()
|
|
endfunction()
|
|
|
|
check_process(0 "Usage: vbs .*<command>.*Commands:" "" )
|
|
check_process(0 "Usage: vbs .*<command>.*Commands:" "" --help)
|
|
check_process(0 "Usage: vbs .*<command>.*Commands:" "" -h)
|
|
check_process(0 "^vbs ${VBS_VERSION}\n$" "" --version)
|
|
check_process(0 "^vbs ${VBS_VERSION}\n$" "" -V)
|
|
check_process(2 "" "unknown option: --invalid" --version --invalid)
|
|
check_process(2 "" "--version cannot be combined with subcommands" --version build)
|
|
check_process(2 "" "unknown subcommand: invalid" invalid)
|
|
check_process(0 "Usage: vbs build .*--native-foreign.*--profile.*\\(repeatable\\)" "" build --help)
|
|
check_process(0 "Usage: vbs test " "" test --help)
|
|
check_process(2 "" "invalid --test-timeout" test --test-timeout 0)
|
|
check_process(0 "Usage: vbs test .*--repeat" "" test --help)
|
|
check_process(0 "--shuffle" "" test --help)
|
|
check_process(0 "--stop-on-failure" "" test --help)
|
|
check_process(0 "Usage: vbs explain " "" explain --help)
|
|
check_process(0 "--format" "" explain --help)
|
|
check_process(2 "" "unsupported --format" explain --format xml)
|
|
check_process(0 "--trace" "" build --help)
|
|
check_process(0 "Usage: vbs completions " "" completions --help)
|
|
check_process(2 "" "unsupported --shell" completions --shell tcsh)
|
|
check_process(0 "Usage: vbs man " "" man --help)
|
|
check_process(0 "--from" "" migrate --help)
|
|
check_process(2 "" "invalid value 'bazel' for '--from'" migrate --from bazel)
|
|
check_process(2 "" "invalid value 'bogus' for '--template'" init --template bogus)
|
|
check_process(0 "--template" "" init --help)
|
|
check_process(0 "--export" "" presets --help)
|
|
check_process(0 "Usage: vbs run " "" run --help)
|
|
check_process(0 "Usage: vbs metadata " "" metadata --help)
|
|
check_process(0 "Usage: vbs why " "" why --help)
|
|
check_process(0 "Usage: vbs add " "" add --help)
|
|
check_process(0 "Usage: vbs remove " "" remove --help)
|
|
check_process(0 "--frozen" "" build --help)
|
|
check_process(0 "--native-cache" "" build --help)
|
|
check_process(2 "" "unsupported --native-cache" build --native-cache bogus)
|
|
check_process(2 "" "invalid version range" add fmt@bad --no-lock)
|
|
check_process(0 "Usage: vbs fmt " "" fmt --help)
|
|
check_process(0 "Usage: vbs lint " "" lint --help)
|
|
check_process(0 "Usage: vbs tree " "" tree --help)
|
|
check_process(0 "Usage: vbs install-binary " "" install-binary --help)
|
|
check_process(2 "" "missing required argument" install-binary)
|
|
check_process(2 "" "--registry and a package name are required" install-binary foo)
|
|
check_process(2 "" "invalid --repeat mode" test --repeat bogus)
|
|
check_process(2 "" "invalid --repeat count" test --repeat until-pass:0)
|
|
check_process(2 "" "invalid --retry value" test --retry 99)
|
|
check_process(2 "" "invalid --shuffle-seed" test --shuffle --shuffle-seed abc)
|
|
check_process(0 "Usage: vbs init " "" init --help)
|
|
check_process(0 "Usage: vbs clean " "" clean --help)
|
|
check_process(0 "Usage: vbs doctor " "" doctor --help)
|
|
check_process(0 "host platform: (Linux|Windows)" "" doctor)
|
|
check_process(0 "Void::Sqlite: (enabled|disabled)" "" doctor)
|
|
check_process(0 "Usage: vbs graph " "" graph --help)
|
|
check_process(2 "" "unsupported --format" graph --format xml)
|
|
check_process(2 "" "multi-profile build requires --editor-profile" build --profile debug --profile release)
|
|
check_process(2 "" "must be one of the requested profiles" build --profile debug --profile release --editor-profile custom)
|
|
check_process(0 "Usage: vbs compdb <command>.*Commands:.*use.*show.*export.*watch" "" compdb --help)
|
|
check_process(0 "Usage: vbs compdb use " "" compdb use --help)
|
|
check_process(2 "" "missing subcommand for 'vbs compdb'" compdb)
|
|
check_process(2 "" "unknown subcommand: bogus" compdb bogus)
|
|
check_process(0 "Usage: vbs deps <command>.*Commands:.*resolve.*update" "" deps --help)
|
|
check_process(0 "Usage: vbs deps resolve " "" deps resolve --help)
|
|
check_process(2 "" "missing subcommand for 'vbs deps'" deps)
|
|
check_process(2 "" "--request and --output are required" bridge)
|
|
check_process(0 "Usage: vbs install " "" install --help)
|
|
check_process(2 "" "--prefix is required" install)
|
|
check_process(2 "" "--prefix is required" uninstall)
|
|
check_process(2 "" "--input and --output-dir are required" gen-tests)
|
|
check_process(0 "Usage: vbs publish " "" publish --help)
|
|
check_process(0 "Usage: vbs publish-binary " "" publish-binary --help)
|
|
check_process(0 "Usage: vbs binaries <command>.*Commands:.*list.*fetch" "" binaries --help)
|
|
check_process(0 "Usage: vbs binaries list " "" binaries list --help)
|
|
check_process(0 "Usage: vbs binaries show " "" binaries show --help)
|
|
check_process(0 "Usage: vbs releases list " "" releases list --help)
|
|
check_process(0 "Usage: vbs releases yank " "" releases yank --help)
|
|
check_process(2 "" "--registry, --name, and --version are required" releases yank)
|
|
check_process(0 "Usage: vbs tokens list " "" tokens list --help)
|
|
check_process(0 "Usage: vbs lock show " "" lock show --help)
|
|
check_process(0 "Usage: vbs presets " "" presets --help)
|
|
check_process(0 "Usage: vbs migrate " "" migrate --help)
|
|
check_process(1 "" "vbs migrate" migrate --input "${CMAKE_CURRENT_BINARY_DIR}/no-such-CMakeLists.txt")
|
|
check_process(0 "Usage: vbs verify " "" verify --help)
|
|
check_process(0 "Usage: vbs compdb-entries " "" compdb-entries --help)
|
|
check_process(1 "" "no compilation database is published" compdb-entries --project
|
|
"${CMAKE_CURRENT_BINARY_DIR}/no-lock-project")
|
|
check_process(2 "" "--name, --version, --file, --signature, and --public-key are required" verify)
|
|
check_process(1 "" "public key is not trusted" verify --name demo --version 1.0.0
|
|
--file CMakeLists.txt
|
|
--signature 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
--public-key 0000000000000000000000000000000000000000000000000000000000000000
|
|
--trusted-public-key aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
|
|
check_process(1 "" "" verify --name demo --version 1.0.0 --file CMakeLists.txt
|
|
--signature 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
--public-key 0000000000000000000000000000000000000000000000000000000000000000)
|
|
check_process(0 "no vbs.lock in" "" lock show --project "${CMAKE_CURRENT_BINARY_DIR}/no-lock-project")
|
|
check_process(2 "" "vbs tokens: --registry is required" tokens list)
|
|
check_process(0 "Usage: vbs tokens revoke .*--token-id" "" tokens revoke --help)
|
|
check_process(2 "" "--registry and --name are required" releases list)
|
|
check_process(0 "Usage: vbs releases show " "" releases show --help)
|
|
check_process(2 "" "--registry, --name, and --version are required" releases show)
|
|
check_process(0 "Usage: vbs binaries fetch " "" binaries fetch --help)
|
|
check_process(2 "" "--registry, --name, and --version are required" binaries list)
|
|
check_process(2 "" "--variant and --output are required" binaries fetch --registry http://127.0.0.1:1 --name p --version 1.0.0)
|
|
check_process(2 "" "--registry, --name, --version, --variant, and --file are required" publish-binary)
|
|
check_process(2 "" "--registry, --name, and --version are required" publish)
|
|
check_process(0 "Usage: vbs daemon <command>.*Commands:.*run.*status.*stop.*recover.*gc.*describe" "" daemon --help)
|
|
check_process(0 "Usage: vbs daemon run " "" daemon run --help)
|
|
check_process(0 "Usage: vbs daemon describe .*--profile" "" daemon describe --help)
|
|
check_process(0 "Usage: vbs daemon build .*--profile.*--target.*--jobs" "" daemon build --help)
|
|
check_process(0 "Usage: vbs daemon ide query .*--profile" "" daemon ide query --help)
|
|
check_process(0 "Usage: vbs daemon compdb export .*--profile" "" daemon compdb export --help)
|
|
check_process(0 "Usage: vbs daemon compdb use .*--profile" "" daemon compdb use --help)
|
|
check_process(0 "Usage: vbs daemon compdb entries .*--file.*--limit" "" daemon compdb entries --help)
|
|
check_process(0 "Usage: vbs daemon ide generate " "" daemon ide generate --help)
|
|
check_process(0 "--force" "" daemon ide generate --help)
|
|
check_process(0 "--profile" "" daemon ide generate --help)
|
|
check_process(0 "--editor" "" daemon ide generate --help)
|
|
check_process(0 "Usage: vbs daemon ide poll " "" daemon ide poll --help)
|
|
check_process(0 "Usage: vbs daemon ide status " "" daemon ide status --help)
|
|
check_process(0 "Usage: vbs daemon graph .*--format" "" daemon graph --help)
|
|
check_process(0 "Usage: vbs daemon test .*--profile.*--target.*--jobs" "" daemon test --help)
|
|
check_process(0 "Usage: vbs daemon workspace members " "" daemon workspace members --help)
|
|
check_process(0 "Usage: vbs daemon ide configs " "" daemon ide configs --help)
|
|
check_process(0 "Usage: vbs daemon compdb generations .*--profile" "" daemon compdb generations --help)
|
|
check_process(0 "Usage: vbs daemon deps .*--profile" "" daemon deps --help)
|
|
check_process(0 "Usage: vbs daemon info " "" daemon info --help)
|
|
check_process(0 "Usage: vbs daemon clean " "" daemon clean --help)
|
|
check_process(0 "Usage: vbs daemon target info .*--name" "" daemon target info --help)
|
|
check_process(0 "Usage: vbs daemon target flags .*--name.*--file" "" daemon target flags --help)
|
|
check_process(0 "Usage: vbs daemon pack .*--output" "" daemon pack --help)
|
|
check_process(0 "Usage: vbs daemon actions .*--limit" "" daemon actions --help)
|
|
check_process(0 "Usage: vbs daemon install " "" daemon install --help)
|
|
check_process(0 "--prefix" "" daemon install --help)
|
|
check_process(0 "--component" "" daemon install --help)
|
|
check_process(0 "--no-cmake-export" "" daemon install --help)
|
|
check_process(0 "--no-native-export" "" daemon install --help)
|
|
check_process(0 "Usage: vbs daemon uninstall .*--prefix" "" daemon uninstall --help)
|
|
check_process(0 "Usage: vbs daemon gen-tests .*--input.*--output-dir" "" daemon gen-tests --help)
|
|
check_process(0 "Usage: vbs daemon init .*--dir" "" daemon init --help)
|
|
check_process(0 "Usage: vbs daemon ide wait .*--timeout-ms" "" daemon ide wait --help)
|
|
check_process(2 "" "missing subcommand for 'vbs daemon'" daemon)
|
|
|
|
if(NOT VBS_WINDOWS)
|
|
# Daemon-backed describe contract: start `vbs daemon run`, query the bounded graph summary over
|
|
# the Unix socket, then stop it (Unix-only; the Windows transport is Track C3).
|
|
set(daemon_contract_root "${CMAKE_CURRENT_BINARY_DIR}/daemon_contract")
|
|
file(REMOVE_RECURSE "${daemon_contract_root}")
|
|
file(MAKE_DIRECTORY "${daemon_contract_root}/project")
|
|
file(WRITE "${daemon_contract_root}/project/build.cpp" [=[#include <Void/Build.hpp>
|
|
|
|
void build(Void::Build::Project &project) {
|
|
auto app = project.executable("app");
|
|
app.sources({"main.cpp"});
|
|
}
|
|
]=])
|
|
file(WRITE "${daemon_contract_root}/project/main.cpp" "int main() { return 0; }\n")
|
|
|
|
set(daemon_contract_script [=[
|
|
set -u
|
|
vbs="$1"
|
|
project="$2"
|
|
build="$3"
|
|
out="$4"
|
|
log="$5"
|
|
|
|
"$vbs" daemon run -C "$project" -B "$build" --max-requests 2 >"$log" 2>&1 &
|
|
pid=$!
|
|
cleanup() {
|
|
kill "$pid" 2>/dev/null || true
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
socket="$build/.vbs/vbs-daemon.sock"
|
|
i=0
|
|
while [ ! -S "$socket" ]; do
|
|
i=$((i + 1))
|
|
if [ "$i" -gt 400 ]; then
|
|
echo "daemon socket did not appear" >&2
|
|
exit 1
|
|
fi
|
|
sleep 0.05
|
|
done
|
|
|
|
"$vbs" daemon describe -C "$project" -B "$build" >"$out"
|
|
status=$?
|
|
|
|
"$vbs" daemon stop -C "$project" -B "$build" >/dev/null 2>&1 || true
|
|
i=0
|
|
while kill -0 "$pid" 2>/dev/null; do
|
|
i=$((i + 1))
|
|
if [ "$i" -gt 100 ]; then
|
|
break
|
|
fi
|
|
sleep 0.05
|
|
done
|
|
kill "$pid" 2>/dev/null || true
|
|
wait "$pid" 2>/dev/null || true
|
|
trap - EXIT
|
|
exit "$status"
|
|
]=])
|
|
|
|
execute_process(
|
|
COMMAND sh -c "${daemon_contract_script}" sh "${VBS}"
|
|
"${daemon_contract_root}/project" "${daemon_contract_root}/build"
|
|
"${daemon_contract_root}/describe.json" "${daemon_contract_root}/daemon.log"
|
|
RESULT_VARIABLE daemon_contract_code
|
|
TIMEOUT 180)
|
|
|
|
set(daemon_contract_log "")
|
|
if(EXISTS "${daemon_contract_root}/daemon.log")
|
|
file(READ "${daemon_contract_root}/daemon.log" daemon_contract_log)
|
|
endif()
|
|
if(NOT "${daemon_contract_code}" STREQUAL "0")
|
|
message(FATAL_ERROR "vbs daemon describe failed: exit ${daemon_contract_code}\ndaemon log=[${daemon_contract_log}]")
|
|
endif()
|
|
|
|
file(READ "${daemon_contract_root}/describe.json" daemon_describe_out)
|
|
if(NOT daemon_describe_out MATCHES "\"ok\":true" OR
|
|
NOT daemon_describe_out MATCHES "\"op\":\"describe\"" OR
|
|
NOT daemon_describe_out MATCHES "\"target_names\":\\[[^]]*\"app\"")
|
|
message(FATAL_ERROR "vbs daemon describe: unexpected response [${daemon_describe_out}]")
|
|
endif()
|
|
message(STATUS "daemon describe response: ${daemon_describe_out}")
|
|
endif()
|
|
check_process(0 "Usage: vbs ide <command>.*Commands:.*generate.*query" "" ide --help)
|
|
check_process(0 "Usage: vbs ide generate " "" ide generate --help)
|
|
check_process(0 "Usage: vbs ide query " "" ide query --help)
|
|
check_process(0 "Usage: vbs ide plugin .*--editor.*--output" "" ide plugin --help)
|
|
check_process(2 "" "--output is required" ide plugin)
|
|
check_process(2 "" "missing subcommand for 'vbs ide'" ide)
|
|
check_process(2 "" "unknown IDE kind" ide generate --editor invalid_ide)
|
|
|
|
if(VBS_REGISTRY)
|
|
execute_process(COMMAND "${VBS_REGISTRY}" --help
|
|
RESULT_VARIABLE reg_code OUTPUT_VARIABLE reg_out ERROR_VARIABLE reg_err TIMEOUT 15)
|
|
if(NOT "${reg_code}" STREQUAL "0" OR NOT reg_out MATCHES "Usage: vbs-registry")
|
|
message(FATAL_ERROR "vbs-registry --help failed: code=${reg_code}\nstdout=[${reg_out}]\nstderr=[${reg_err}]")
|
|
endif()
|
|
endif()
|
|
message(STATUS "CLI and auto-generated Argparse help contracts verified (including daemon describe round-trip)")
|