From 6e5fc2bf9b18cd492fe994dacb39182f601e9b86 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 22 Apr 2025 23:01:46 +0100 Subject: [PATCH 1/3] test: Reintroduce Windows support in `system_tests/run_command` test --- src/test/system_tests.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/test/system_tests.cpp b/src/test/system_tests.cpp index a5d9be07d52..dec4d418290 100644 --- a/src/test/system_tests.cpp +++ b/src/test/system_tests.cpp @@ -25,7 +25,11 @@ BOOST_AUTO_TEST_CASE(run_command) BOOST_CHECK(result.isNull()); } { +#ifdef WIN32 + const UniValue result = RunCommandParseJSON("cmd.exe /c echo {\"success\": true}"); +#else const UniValue result = RunCommandParseJSON("echo {\"success\": true}"); +#endif BOOST_CHECK(result.isObject()); const UniValue& success = result.find_value("success"); BOOST_CHECK(!success.isNull()); @@ -33,12 +37,20 @@ BOOST_AUTO_TEST_CASE(run_command) } { // An invalid command is handled by cpp-subprocess +#ifdef WIN32 + const std::string expected{"CreateProcess failed: "}; +#else const std::string expected{"execve failed: "}; +#endif BOOST_CHECK_EXCEPTION(RunCommandParseJSON("invalid_command"), subprocess::CalledProcessError, HasReason(expected)); } { // Return non-zero exit code, no output to stderr +#ifdef WIN32 + const std::string command{"cmd.exe /c exit 1"}; +#else const std::string command{"false"}; +#endif BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, [&](const std::runtime_error& e) { const std::string what{e.what()}; BOOST_CHECK(what.find(strprintf("RunCommandParseJSON error: process(%s) returned 1: \n", command)) != std::string::npos); @@ -47,7 +59,11 @@ BOOST_AUTO_TEST_CASE(run_command) } { // Return non-zero exit code, with error message for stderr +#ifdef WIN32 + const std::string command{"cmd.exe /c \"echo err 1>&2 && exit 1\""}; +#else const std::string command{"sh -c 'echo err 1>&2 && false'"}; +#endif const std::string expected{"err"}; BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, [&](const std::runtime_error& e) { const std::string what(e.what()); @@ -58,17 +74,23 @@ BOOST_AUTO_TEST_CASE(run_command) } { // Unable to parse JSON +#ifdef WIN32 + const std::string command{"cmd.exe /c echo {"}; +#else const std::string command{"echo {"}; +#endif BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, HasReason("Unable to parse JSON: {")); } - // Test std::in +#ifndef WIN32 { + // Test stdin const UniValue result = RunCommandParseJSON("cat", "{\"success\": true}"); BOOST_CHECK(result.isObject()); const UniValue& success = result.find_value("success"); BOOST_CHECK(!success.isNull()); BOOST_CHECK_EQUAL(success.get_bool(), true); } +#endif } #endif // ENABLE_EXTERNAL_SIGNER From 719fa9f4ef6886c7c3be3b33d249b16f4e36a7e9 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 23 Apr 2025 21:17:30 +0100 Subject: [PATCH 2/3] build: Re-enable external signer support for Windows --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99490f742a6..bb711eace95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,7 @@ if(WITH_USDT) find_package(USDT MODULE REQUIRED) endif() -cmake_dependent_option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." ON "NOT WIN32" OFF) +option(ENABLE_EXTERNAL_SIGNER "Enable external signer support." ON) cmake_dependent_option(WITH_QRENCODE "Enable QR code support." ON "BUILD_GUI" OFF) if(WITH_QRENCODE) From 3a18075aedd7cff6f06b5fe10966d618b6378701 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Wed, 8 May 2024 11:09:49 +0100 Subject: [PATCH 3/3] ci: Drop `-DENABLE_EXTERNAL_SIGNER=ON` configure option This option is now enabled by default. --- ci/test/03_test_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test/03_test_script.sh b/ci/test/03_test_script.sh index a71565ba98e..3394c50b8bd 100755 --- a/ci/test/03_test_script.sh +++ b/ci/test/03_test_script.sh @@ -118,7 +118,7 @@ BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build-$HOST} mkdir -p "${BASE_BUILD_DIR}" cd "${BASE_BUILD_DIR}" -BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DENABLE_EXTERNAL_SIGNER=ON -DCMAKE_INSTALL_PREFIX=$BASE_OUTDIR" +BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_INSTALL_PREFIX=$BASE_OUTDIR" if [[ "${RUN_TIDY}" == "true" ]]; then BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"