feat(provenance,daemon): add Ed25519 signing primitives and bounded daemon describe op
This commit is contained in:
1 parent
0bde74f739
commit
21babb8c31
16 files changed
+1232
-20
No files matched your search
@@ -45,9 +45,91 @@ 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(2 "" "--registry, --name, and --version are required" publish)
|
||||
check_process(0 "Usage: vbs daemon <command>.*Commands:.*run.*status.*stop.*recover.*gc" "" daemon --help)
|
||||
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(2 "" "missing subcommand for 'vbs daemon'" daemon)
|
||||
|
||||
# Daemon-backed describe contract: start `vbs daemon run`, query the bounded graph summary over
|
||||
# the Unix socket, then stop it. The daemon is Unix-only, matching the rest of this suite.
|
||||
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}")
|
||||
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)
|
||||
@@ -59,4 +141,4 @@ execute_process(COMMAND "${VBS_REGISTRY}" --help
|
||||
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()
|
||||
message(STATUS "37 native CLI and auto-generated Argparse help contracts verified")
|
||||
message(STATUS "CLI and auto-generated Argparse help contracts verified (including daemon describe round-trip)")
|
||||
Reference in new issue
Block a user