Execute @inspectFile helpers without a shell (posix_spawn/CreateProcess), add tests and multithread stress example#99
Open
Easton97-Jens wants to merge 2 commits intoV3/testfrom
Conversation
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.
Motivation
@inspectFilewhich previously relied on a shell and make helper execution deterministic and cross-platform./bin/sh, correctly captures helper stdout/stderr, and inspects exit status to determine a match.Description
InspectFile::evaluateto execute helper programs directly usingposix_spawnwith file actions and pipes on POSIX, andCreateProcessWwith pipe handling on Windows, and to validate output and exit code before returning a match.stringToWideandquoteWindowsArgand platform-specific logic for argument quoting and stdout capture.examples/multithreadprogram to acceptrules,threads, anditerationsas arguments, track completed threads withstd::atomic, measure elapsed time and (on POSIX) open file descriptors before/after, and includedinspectfilehelper/rules files inEXTRA_DIST.test/test-cases/regression/issue-3489-inspectfile-posix.json, helper scriptstest/test-cases/data/inspectfile-posix-helper.sh,inspectfile-not-executable.txt, a multithread stress scripttest/stress/inspectfile_multithread_stress.sh, and exampleinspectfile_rules.confandinspectfile_helper.sh.Testing
test/test-cases/regression/issue-3489-inspectfile-posix.jsonwith the test harness and it passed.test/stress/inspectfile_multithread_stress.shagainst the builtexamples/multithread/multithreadbinary and it completed reportingstress-test: okand the expectedcompleted_threads=marker.Codex Task