Java: Address testFailures in inline expectations tests#22077
Open
geoffw0 wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR cleans up long-standing inline-expectations mismatches in the Java experimental “quantum” query tests by updating inline annotations so that the postprocess-generated testFailures result set is empty, allowing the testFailures section to be removed from the .expected files.
Changes:
- Updated inline expectation markers (
// $ Source[...],// $ Alert[...],// $ SPURIOUS: ...) to correctly match the emitted results, including query-scoped tags where multiple.qlreftests share the same Java source file. - Removed stale
testFailuressections from affected.expectedfiles now that the annotations align with the actual query results. - Adjusted alert/source marker placement to the correct lines for matching (for example, moving an
Alertmarker to the line where the problem is actually reported).
Show a summary per file
| File | Description |
|---|---|
| java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownKDFIterationCount/WeakKDFIterationCount.expected | Removes obsolete testFailures section after annotation alignment. |
| java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownKDFIterationCount/UnknownKDFIterationCount.expected | Removes obsolete testFailures section and normalizes expected output after annotation alignment. |
| java/ql/test/experimental/query-tests/quantum/examples/WeakOrUnknownKDFIterationCount/Test.java | Updates inline markers to be query-scoped and places Alert on the correct line. |
| java/ql/test/experimental/query-tests/quantum/examples/InsecureOrUnknownNonceSource/InsecureIVorNonceSource.java | Adds a query-scoped Source marker for the static-IV case to match the path-problem source. |
| java/ql/test/experimental/query-tests/quantum/examples/InsecureOrUnknownNonceSource/InsecureIVorNonceSource.expected | Removes obsolete testFailures section after annotation alignment. |
| java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacUse.java | Scopes Source/Alert markers per query and marks known false positives as SPURIOUS. |
| java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacOrderMacOnEncryptPlaintext.expected | Removes obsolete testFailures section after annotation alignment. |
| java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacOrderDecryptToMac.expected | Removes obsolete testFailures section after annotation alignment. |
| java/ql/test/experimental/query-tests/quantum/examples/BadMacUse/BadMacOrderDecryptThenMac.expected | Removes obsolete testFailures section after annotation alignment. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 0
- Review effort level: Low
Contributor
|
Looks good to me. I'll give @github/ps-codeql a week to review before I approve, in case they have more insight from having written these tests. |
Contributor
Author
|
Sounds good to me. @github/ps-codeql I'm happy to answer your questions. |
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.
Address testFailures in inline expectations tests. Annotations should always be updated so that the
testFailuressection of the.expectedfile is empty.These particular
testFailureshave been around for a while and have evolved a bit as changes were made. My interpretation is that we just got into a bad habit of not updating the annotations, or perhaps didn't understand how to do so correctly where several queries are run on the same test source (which can be fiddly). i.e. I don't think we've uncovered any surprising issues here.