Title: Bitcoin Core: Unit Test Failure: system_tests.cpp Line 48: run_command) Post by: TKC on April 04, 2021, 07:19:17 PM I cloned the Bitcoin Core and did the build. But, I am experiencing a Unit Test Failure in system_tests.cpp, Line 48 BOOST_AUTO_TEST(run_command).
First, my environment: Hardware: Intel i7-8550U @1.80GHz 2001 Mhz, 4 Cores, 8 Logical Processors, x64. OS: Windows 10 Home Toolchain: Visual Studios 2019 v142, Configuration: Release, Platform x64. The build completes without errors, but I do get the following message: Quote C:\Users\name\source\repos\bitcoin-first\build_msvc\test_bitcoin\test_bitcoin.vcxproj : warning : Wildcards in project items are not supported in VC projects and can cause unexpected behavior, instability and performance degradation in the Visual Studio IDE. Please refer to https://aka.ms/cpp/projectwildcards for supported options. Running test_bitcoin, all tests pass except run_command from source system_tests.cpp line 48. I get the following error: Quote struct boost::process::process_error: CreateProcess failed: The system cannot find the file specified. VS Test Explorer gives additionally: Quote unknown location(0): exception in "run_command": struct boost::process::process_error: CreateProcess failed: The system cannot find the file specified. system_tests.cpp(52): last checkpoint: The relevant code from system_tests.cpp (Please disregard any spacing syntax issues after the line numbers. I manually added them in and they are not at issue): Code:
Line 58 is failing. Based on this https://stackoverflow.com/questions/47028660/boost-createprocess-failed, I commented out line 58 and added the following Line 57: Code: 57 const UniValue result = RunCommandParseJSON("cmd.exe /c echo '{\"success\": true}'"); Running again the system_tests.cpp gets me past the CreateProcess failure, but produces the following failure in system_tests.cpp line 48, run_command(): Quote class std::runtime_error: Unable to parse JSON: '{"success": true}'. VS Test Explorer additionally states: Quote unknown location(0): exception in "run_command": class std::runtime_error: Unable to parse JSON: '{"success": true}' system_tests.cpp(52): last checkpoint: I'm having a hard time believing the test is incorrect--I've found nothing about this failure. Instead, I suspect I didn’t correctly set some switch or option or configuration somewhere. Any comments or help would be greatly appreciated. Title: Re: Bitcoin Core: Unit Test Failure: system_tests.cpp Line 48: run_command) Post by: NotATether on April 05, 2021, 07:44:41 AM Code: 57 const UniValue result = RunCommandParseJSON("cmd.exe /c echo '{\"success\": true}'"); Running again the system_tests.cpp gets me past the CreateProcess failure, but produces the following failure in system_tests.cpp line 48, run_command(): Quote class std::runtime_error: Unable to parse JSON: '{"success": true}'. Have you tried quoting "true" in the above JSON? I don't think Boost knows about Boolean true and false (C++ std doesn't have a JSON parser anyway last time I checked), and Core itself does quote true and false as strings in its RPC calls. The other Visual Studio warning is harmless and is related to using * notation to select all the files in one line of the vcxproj. Title: Re: Bitcoin Core: Unit Test Failure: system_tests.cpp Line 48: run_command) Post by: TKC on April 05, 2021, 02:26:00 PM Code: 57 const UniValue result = RunCommandParseJSON("cmd.exe /c echo '{\"success\": true}'"); Running again the system_tests.cpp gets me past the CreateProcess failure, but produces the following failure in system_tests.cpp line 48, run_command(): Quote class std::runtime_error: Unable to parse JSON: '{"success": true}'. Have you tried quoting "true" in the above JSON? I don't think Boost knows about Boolean true and false (C++ std doesn't have a JSON parser anyway last time I checked), and Core itself does quote true and false as strings in its RPC calls. The other Visual Studio warning is harmless and is related to using * notation to select all the files in one line of the vcxproj. Thank you for your suggestion. I did try the "true" and received the same, "Unable to parse JSON: '{"success": "true"}'. When I get to the UniValue::Read, I am passing the string '{"success": "true"}' to it. It seems as this this string is the one not able to be parsed. I'm definitely interested if you have other suggestions or could point me in the right direction. I'm having a hard time thinking the code is wrong. Instead, I'm thinking that some setting is not correct. |