9 #ifdef ENABLE_EXTERNAL_SIGNER 10 #include <boost/process.hpp> 11 #endif // ENABLE_EXTERNAL_SIGNER 13 #include <boost/test/unit_test.hpp> 24 #ifdef ENABLE_EXTERNAL_SIGNER 30 auto hntdll = GetModuleHandleA(
"ntdll.dll");
32 const bool wine_runtime = GetProcAddress(hntdll,
"wine_get_version");
53 const int expected_error{wine_runtime ? 6 : 2};
55 const int expected_error{2};
57 BOOST_CHECK_EXCEPTION(
RunCommandParseJSON(
"invalid_command"), boost::process::process_error, [&](
const boost::process::process_error& e) {
58 BOOST_CHECK(std::string(e.what()).find(
"RunCommandParseJSON error:") == std::string::npos);
66 const std::string
command{
"cmd.exe /c exit 1"};
68 const std::string
command{
"false"};
71 const std::string what{e.what()};
79 const std::string
command{
"cmd.exe /c dir nosuchfile"};
80 const std::string expected{wine_runtime ?
"File not found." :
"File Not Found"};
82 const std::string
command{
"ls nosuchfile"};
83 const std::string expected{
"No such file or directory"};
86 const std::string what(e.what());
88 BOOST_CHECK(what.find(expected) != std::string::npos);
106 #endif // ENABLE_EXTERNAL_SIGNER
const UniValue & find_value(std::string_view key) const
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
BOOST_AUTO_TEST_CASE(dummy)
UniValue RunCommandParseJSON(const std::string &str_command, const std::string &str_std_in)
Execute a command which returns JSON, and parse the result.
#define BOOST_CHECK(expr)