aboutsummaryrefslogtreecommitdiff
path: root/src/test/system_tests.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-12-15 13:59:08 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-12-15 14:09:30 +0200
commit0aad33db6410ed36fa0f4b96245cacbae7897d2e (patch)
tree30ab2e626051bb29c8ec40f86644102a8b89ec60 /src/test/system_tests.cpp
parent507c009c1ee68a4c3ad100f765bf854307d5bf39 (diff)
downloadbitcoin-0aad33db6410ed36fa0f4b96245cacbae7897d2e.tar.xz
test: Fix "false" subtest in system_tests for Windows
Diffstat (limited to 'src/test/system_tests.cpp')
-rw-r--r--src/test/system_tests.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/test/system_tests.cpp b/src/test/system_tests.cpp
index 32aee2bce5..3cb86de94d 100644
--- a/src/test/system_tests.cpp
+++ b/src/test/system_tests.cpp
@@ -37,12 +37,6 @@ bool checkMessage(const std::runtime_error& ex)
return true;
}
-bool checkMessageFalse(const std::runtime_error& ex)
-{
- BOOST_CHECK_EQUAL(ex.what(), std::string("RunCommandParseJSON error: process(false) returned 1: \n"));
- return true;
-}
-
bool checkMessageStdErr(const std::runtime_error& ex)
{
const std::string what(ex.what());
@@ -73,7 +67,15 @@ BOOST_AUTO_TEST_CASE(run_command)
}
{
// Return non-zero exit code, no output to stderr
- BOOST_CHECK_EXCEPTION(RunCommandParseJSON("false"), std::runtime_error, checkMessageFalse);
+#ifdef WIN32
+ const std::string command{"cmd.exe /c call"};
+#else
+ const std::string command{"false"};
+#endif
+ BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, [&](const std::runtime_error& e) {
+ BOOST_CHECK(std::string(e.what()).find(strprintf("RunCommandParseJSON error: process(%s) returned 1: \n", command)) != std::string::npos);
+ return true;
+ });
}
{
// Return non-zero exit code, with error message for stderr