Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ if(TARGET evmone-cli)
${PREFIX}/run_bad_rev PROPERTIES PASS_REGULAR_EXPRESSION
"unknown revision: NoSuchRev")

# A subcommand's own name among another's arguments is an argument. CLI11 would otherwise
# take it as a second command and run that one instead, exiting 0 with the wrong work done:
# the dispatch tries run first, so a trailing "run" hijacked every other subcommand.
add_test(NAME ${PREFIX}/one_command_per_invocation COMMAND evmone-cli
t8n --state.fork Cancun run 6000)
set_tests_properties(
${PREFIX}/one_command_per_invocation PROPERTIES
PASS_REGULAR_EXPRESSION "arguments were not expected"
FAIL_REGULAR_EXPRESSION "Result: *success")
Comment thread
chfast marked this conversation as resolved.

add_test(NAME ${PREFIX}/one_command_per_invocation_reversed COMMAND evmone-cli
run 6000 t8n)
set_tests_properties(
${PREFIX}/one_command_per_invocation_reversed PROPERTIES
PASS_REGULAR_EXPRESSION "argument was not expected: t8n"
FAIL_REGULAR_EXPRESSION "Result: *success")

# A PASS_REGULAR_EXPRESSION makes CTest ignore the exit code, so run them again for that alone.
add_test(NAME ${PREFIX}/one_command_per_invocation_exit_code COMMAND evmone-cli
t8n --state.fork Cancun run 6000)
set_tests_properties(
${PREFIX}/one_command_per_invocation_exit_code PROPERTIES WILL_FAIL TRUE)

add_test(NAME ${PREFIX}/one_command_per_invocation_reversed_exit_code COMMAND evmone-cli
run 6000 t8n)
set_tests_properties(
${PREFIX}/one_command_per_invocation_reversed_exit_code PROPERTIES WILL_FAIL TRUE)

add_test(NAME ${PREFIX}/version COMMAND evmone-cli --version)
set_tests_properties(
${PREFIX}/version PROPERTIES PASS_REGULAR_EXPRESSION "evmone")
Expand Down
2 changes: 2 additions & 0 deletions test/integration/blockchaintest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ set_tests_properties(
${PREFIX}/stops_at_one_test PROPERTIES
PASS_REGULAR_EXPRESSION
"a_stops_early:.*block validity.*b_still_runs:.*post state root"
# Every failure repeats the test name, so a second one means it did not stop.
FAIL_REGULAR_EXPRESSION "a_stops_early:.*a_stops_early:"
)

# --collect-only lists what would run instead of running it, and --ignore drops a path from that
Expand Down
1 change: 1 addition & 0 deletions tools/evmone/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ int main(int argc, const char* const* argv) noexcept
VM vm{evmc_create_evmone()};

CLI::App app{"evmone EVM tool"};
app.require_subcommand(0, 1); // Forbid multiple subcommands: run would hijack the rest.
app.set_version_flag(
"--version", [&vm] { return std::string{vm.name()} + " " + vm.version(); });
app.add_flag("--trace", trace, "Enable execution trace");
Expand Down