aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authormerge-script <fanquake@gmail.com>2024-04-10 12:03:06 +0200
committermerge-script <fanquake@gmail.com>2024-04-10 12:03:06 +0200
commit0a9cfd175259391ec29b0dfe87578d46b508611e (patch)
treed54759a5acc2ea8675de083bb8c79a59ea40b838 /src/test
parente31956980e16ad3d619022e572bdf55a4eae8716 (diff)
parentd5a715536e497c160a2520f81334aab6c7490213 (diff)
Merge bitcoin/bitcoin#28981: Replace Boost.Process with cpp-subprocess
d5a715536e497c160a2520f81334aab6c7490213 build: remove boost::process dependency for building external signer support (Sebastian Falbesoner) 70434b1c443d9251a880d0193af771f574c40617 external_signer: replace boost::process with cpp-subprocess (Sebastian Falbesoner) cc8b9875b104c31f0a5b5e4195a8278ec55f35f7 Add `cpp-subprocess` header-only library (Hennadii Stepanov) Pull request description: Closes https://github.com/bitcoin/bitcoin/issues/24907. This PR is based on **theStack**'s [work](https://github.com/bitcoin/bitcoin/issues/24907#issuecomment-1466087049). The `subprocess.hpp` header has been sourced from the [upstream repo](https://github.com/arun11299/cpp-subprocess) with the only modification being the removal of convenience functions, which are not utilized in our codebase. Windows-related changes will be addressed in subsequent follow-ups. ACKs for top commit: achow101: reACK d5a715536e497c160a2520f81334aab6c7490213 Sjors: re-tACK d5a715536e497c160a2520f81334aab6c7490213 theStack: Light re-ACK d5a715536e497c160a2520f81334aab6c7490213 fanquake: ACK d5a715536e497c160a2520f81334aab6c7490213 - with the expectation that this code is going to be maintained as our own. Next PRs should: Tree-SHA512: d7fb6fecc3f5792496204190afb7d85b3e207b858fb1a75efe483c05260843b81b27d14b299323bb667c990e87a07197059afea3796cf218ed8b614086bd3611
Diffstat (limited to 'src/test')
-rw-r--r--src/test/system_tests.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/test/system_tests.cpp b/src/test/system_tests.cpp
index 90fce9adf9..8aab2b565c 100644
--- a/src/test/system_tests.cpp
+++ b/src/test/system_tests.cpp
@@ -11,7 +11,7 @@
#include <univalue.h>
#ifdef ENABLE_EXTERNAL_SIGNER
-#include <boost/process.hpp>
+#include <util/subprocess.hpp>
#endif // ENABLE_EXTERNAL_SIGNER
#include <boost/test/unit_test.hpp>
@@ -34,20 +34,16 @@ BOOST_AUTO_TEST_CASE(run_command)
BOOST_CHECK(result.isNull());
}
{
- const UniValue result = RunCommandParseJSON("echo \"{\"success\": true}\"");
+ const UniValue result = RunCommandParseJSON("echo {\"success\": true}");
BOOST_CHECK(result.isObject());
const UniValue& success = result.find_value("success");
BOOST_CHECK(!success.isNull());
BOOST_CHECK_EQUAL(success.get_bool(), true);
}
{
- // An invalid command is handled by Boost
- const int expected_error{2};
- BOOST_CHECK_EXCEPTION(RunCommandParseJSON("invalid_command"), boost::process::process_error, [&](const boost::process::process_error& e) {
- BOOST_CHECK(std::string(e.what()).find("RunCommandParseJSON error:") == std::string::npos);
- BOOST_CHECK_EQUAL(e.code().value(), expected_error);
- return true;
- });
+ // An invalid command is handled by cpp-subprocess
+ const std::string expected{"execve failed: "};
+ BOOST_CHECK_EXCEPTION(RunCommandParseJSON("invalid_command"), subprocess::CalledProcessError, HasReason(expected));
}
{
// Return non-zero exit code, no output to stderr