Repository navigation
Conversation
[Medium impact] The PR appears safe to merge.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test/runjsontests.pybuilds thejsontestrunnercommand as one string and runs it throughos.popen, so the shell splits and re-parses the executable path and options. A path that contains a space, or a quote character, is broken up. This change passes the command as an argument list tosubprocess.Popen, with no shell.What changes in
test/runjsontests.py:getStatusOutputtakes an argument list and usessubprocess.Popen. It returns the process return code (0 means success) and the decoded output. Its only caller isrunAllTests, which only tests the value as true or false, so success and failure are still told apart the same way.--parse-only,--strict,--json-writer, input path) is built as a list instead of a quoted string.OSErroris printed to stderr and counted as a failed test, so the run continues and reports the failure like before instead of stopping with a traceback.A new
test/test_runjsontests.py(9unittestcases) covers arguments with spaces and quotes, exit status and output, the option combinations, the valgrind prefix, and the missing/non-executable cases. It is registered insrc/jsontestrunner/CMakeLists.txt(jsoncpp_runner_arguments) and inmeson.build(runner_arguments).Checked on Linux (Ubuntu 22.04, Python 3.10.12, GCC 11.4, CMake 3.22.1) at base 93acc7b:
runner_argumentspass.Not checked: Windows, macOS, Python 2 (the runner code keeps Python 2 syntax, but the new tests use Python 3 modules), and a real
valgrindrun (the valgrind prefix is only checked with a mock).clang-formatwas not run because no C++ file is touched. No C++ source or header changes.