29 lines
1.7 KiB
CMake
29 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 4.0)
|
|
|
|
function(check_process expected_code expected_stdout expected_stderr)
|
|
execute_process(COMMAND "${VBS}" ${ARGN}
|
|
RESULT_VARIABLE code OUTPUT_VARIABLE out ERROR_VARIABLE err TIMEOUT 10)
|
|
if(NOT "${code}" STREQUAL "${expected_code}" OR
|
|
NOT "${out}" STREQUAL "${expected_stdout}" OR
|
|
NOT "${err}" STREQUAL "${expected_stderr}")
|
|
message(FATAL_ERROR "vbs ${ARGN}: expected exit ${expected_code}, got ${code}\nstdout=[${out}]\nstderr=[${err}]")
|
|
endif()
|
|
endfunction()
|
|
|
|
set(help "Usage: vbs [--version]\n\nVoidBuildSystem bootstrap: help and version only.\nNative build, test, compdb, deps and watch commands are planned and unavailable.\n\nFlags:\n --version, -V show bootstrap version\n --help, -h show this help\n")
|
|
check_process(0 "${help}" "")
|
|
check_process(0 "${help}" "" --help)
|
|
check_process(0 "${help}" "" -h)
|
|
check_process(0 "vbs ${VBS_VERSION} (bootstrap)\n" "" --version)
|
|
check_process(0 "vbs ${VBS_VERSION} (bootstrap)\n" "" -V)
|
|
check_process(2 "" "vbs: unknown option: --invalid\n" --invalid)
|
|
check_process(2 "" "vbs: unknown option: --invalid\n" --version --invalid)
|
|
check_process(2 "" "vbs: unexpected positional argument: invalid\n" invalid)
|
|
check_process(2 "" "vbs: --help must be used alone\n" --help --invalid)
|
|
foreach(command IN ITEMS build test compdb deps watch)
|
|
check_process(2 "" "vbs: native command '${command}' is not implemented in this bootstrap\n" "${command}")
|
|
endforeach()
|
|
check_process(2 "" "vbs: native command 'build' is not implemented in this bootstrap\n" build --profile debug)
|
|
check_process(2 "" "vbs: native command 'compdb' is not implemented in this bootstrap\n" compdb watch)
|
|
message(STATUS "16 CLI process contracts verified")
|