Convert selected Python qlref tests to inline expectations#21967
Conversation
.qlref files to explicit query: format
.qlref files to explicit query: format|
Rerun has been triggered, but no failed runs found |
aa3982d to
4d2e16e
Compare
There was a problem hiding this comment.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
0156cfb to
0c2df7c
Compare
0c2df7c to
f48d715
Compare
Rerun has been triggered: 5 restarted 🚀 |
yoff
left a comment
There was a problem hiding this comment.
It would be nice if the GitHUb platform would allow us toexpress that the diff here falls in two categories:
- adding
query:andpostprocess: utils/test/InlineExpectationsTestQuery.qlaround the content of.qlref-files - adding
# $ Alert|Source|Sinklines to.expected-files.
Verifying this manually will immediately allow me to conclude that this is a safe PR to merge. Before I go through the remaining many files, though, I have a few questions:
- Why do we sometimes get
Alert[query-name]and sometimes justAlert? - Why do we sometimes not add the postprocessing directive?
- Why do we get QL alerts for "not using inline expectation tests"?
|
Note that I am currently working on undoing the changes in this PR which affects queries which import
|
95802b1 to
451fc2e
Compare
| | xsltInjection.py:50:24:50:32 | ControlFlowNode for xslt_root | xsltInjection.py:3:26:3:32 | ControlFlowNode for ImportMember | xsltInjection.py:50:24:50:32 | ControlFlowNode for xslt_root | This XSLT query depends on $@. | xsltInjection.py:3:26:3:32 | ControlFlowNode for ImportMember | user-provided value | | ||
| testFailures | ||
| | xslt.py:14:29:14:37 | ControlFlowNode for xslt_root | Unexpected result: Alert | | ||
| | xsltInjection.py:12:28:12:36 | ControlFlowNode for xslt_root | Unexpected result: Alert | |
There was a problem hiding this comment.
Thanks for spotting that. It had put # Not OK # $ Alert instead of # $ Alert # Not OK.
| python/ql/test/2/query-tests/Summary/LinesOfCode.qlref | ||
| python/ql/test/2/query-tests/Summary/LinesOfUserCode.qlref | ||
| python/ql/test/3/query-tests/Summary/LinesOfCode.qlref | ||
| python/ql/test/3/query-tests/Summary/LinesOfUserCode.qlref |
There was a problem hiding this comment.
Did you intend to include this?
There was a problem hiding this comment.
Thanks for spotting that. I've deleted it now.
BazookaMusic
left a comment
There was a problem hiding this comment.
Looks good from what I could see. Reviewing all alerts manually is a bit unrealistic with a PR this size, but it looks good after spending reasonable time looking at it
This updates the Python qlref-to-inline-expectation migration by converting a focused set of standard
problemandpath-problemtests that can be represented cleanly without changing test semantics. The converted cases cover exception queries, overriding-signature queries, and the local threat-model SQL injection test.Converted standard Python query tests
postprocess: utils/test/InlineExpectationsTestQuery.qlto:python/ql/test/query-tests/Exceptions/general/IllegalExceptionHandlerType.qlrefpython/ql/test/query-tests/Exceptions/general/IllegalRaise.qlrefpython/ql/test/query-tests/Exceptions/general/NotImplementedIsNotAnException.qlrefpython/ql/test/query-tests/Functions/overriding/IncorrectlyOverriddenMethod.qlrefpython/ql/test/query-tests/Functions/overriding/IncorrectlySpecifiedOverriddenMethod.qlrefpython/ql/test/query-tests/Functions/overriding/WrongNameForArgumentInCall.qlrefpython/ql/test/query-tests/Functions/overriding/WrongNumberArgumentsInCall.qlrefpython/ql/test/query-tests/Security/CWE-089-SqlInjection-local-threat-model/SqlInjection.qlrefby preservingPrettyPrintModels.qland appendingInlineExpectationsTestQuery.ql.Annotated source at result locations
# $ Alert[...]markers in:python/ql/test/query-tests/Exceptions/general/exceptions_test.pypython/ql/test/query-tests/Exceptions/general/pypy_test.pypython/ql/test/query-tests/Functions/overriding/test.pypython/ql/test/query-tests/Security/CWE-089-SqlInjection-local-threat-model/test.pyPreserved existing test ownership boundaries
.expectedfiles untouched.Excluded behavior-sensitive cases from this slice
Example of the migrated style:
Original prompt
Created from VS Code.