Skip to content

Commit ae48a22

Browse files
committed
test: fixing failing system_tests/run_command under some Locales
the run_command test under system_tests fails if the locale is anything other than English ones because results such as "No such file or directory" will be different under Non-English locales. On the old version, a `ls nonexistingfile` was used to generate the error output which is not ideal. In the current version we are using a Python one-liner to generate a non 0 zero return value and "err" on stderr and check the expected value against this. fixes #30608
1 parent 5abb9b1 commit ae48a22

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/test/system_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ BOOST_AUTO_TEST_CASE(run_command)
5454
}
5555
{
5656
// Return non-zero exit code, with error message for stderr
57-
const std::string command{"ls nosuchfile"};
58-
const std::string expected{"No such file or directory"};
57+
const std::string command{"python3 -c 'import sys; print(\"err\", file=sys.stderr); sys.exit(2)'"};
58+
const std::string expected{"err"};
5959
BOOST_CHECK_EXCEPTION(RunCommandParseJSON(command), std::runtime_error, [&](const std::runtime_error& e) {
6060
const std::string what(e.what());
6161
BOOST_CHECK(what.find(strprintf("RunCommandParseJSON error: process(%s) returned", command)) != std::string::npos);

0 commit comments

Comments
 (0)