VoidBuildSystem CI / 1 · Requirements (push) Successful in 9s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m45s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 2m34s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 4m34s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 4m50s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 22s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 24s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 5m41s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m36s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m2s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 6m8s
VoidBuildSystem CI / 4A2 · VBS installers (windows target) (push) Successful in 3m12s
VoidBuildSystem CI / 4A2 · VBS installers (linux target) (push) Successful in 3m17s
VoidBuildSystem CI / 5 · Release (push) Skipped
Cold builds in a fresh build directory now reuse content-addressed artifacts from $XDG_CACHE_HOME/vbs (or ~/.cache/vbs): the compiled build descriptor and the toolchain capability probes. Keys already cover the compiler identity, the SDK, the generated driver source and every configuration source, and the descriptor's discovered headers are re-verified on every run, so sharing cannot change a result; VBS_SHARED_CACHE=0 keeps a build directory self-contained. Measured on a 20-source fixture (Debug vbs): cold 3897 ms -> 755 ms in a fresh build directory, warm 153 ms (config 1986 -> 128 ms, toolchain 562 -> 6.5 ms). `vbs completions --shell bash|zsh|fish` and `vbs man [--output DIR]` generate shell completion scripts and roff man pages from the live parser tree by running `vbs <path> --help`, so they cannot drift from the CLI (86 man pages). Verified: new FullV1Tests cases for the shared cache and for completions/man (including `bash -n` on the generated script) pass, and the CLI contract suite passes.
238 lines
13 KiB
CMake
238 lines
13 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(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)")
|