Testing: dump state after test failure#19170
Closed
smowton wants to merge 7 commits intogithub:mainfrom
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request adds state-dumping commands to help diagnose test failures.
- Added calls to dump process tree and network state after test failure
- Invokes pstree and netstat commands in the test cleanup block
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
| _env={"CODEQL_EXTRACTOR_JAVA_OPTION_BUILDLESS_CLASSPATH_FROM_BUILD_FILES": "true"}, | ||
| ) | ||
| finally: | ||
| subprocess.call(["pstree"]) |
There was a problem hiding this comment.
Consider capturing and logging the output of pstree instead of just calling it, to ensure the state information is preserved for debugging purposes.
Suggested change
| subprocess.call(["pstree"]) | |
| pstree_output = subprocess.check_output(["pstree"]).decode("utf-8") | |
| logging.info("pstree output:\n%s", pstree_output) |
| ) | ||
| finally: | ||
| subprocess.call(["pstree"]) | ||
| subprocess.call(["netstat", "-a", "-n", "-p"]) |
There was a problem hiding this comment.
Consider capturing and logging the output of netstat so that the network state is clearly recorded for debugging after a test failure.
Suggested change
| subprocess.call(["netstat", "-a", "-n", "-p"]) | |
| netstat_output = subprocess.check_output(["netstat", "-a", "-n", "-p"], text=True) | |
| logging.info("Netstat output:\n%s", netstat_output) |
fb44746 to
2e976d1
Compare
6efd35b to
2538c34
Compare
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.
No description provided.