Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supplement 'query-type: graph' with actual query metadata #17823

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

hmakholm
Copy link
Contributor

A number of CPP library tests contain // query-type: graph annotations that make the test driver compare the output from the test query in a special mode. (This feature is not used by other languages).

It's somewhat awkward in the implementation of codeql test run that this annotation is not an ordinary item of query metadata -- essentially it means that every test query has to be opened and read an extra time to look for this annotation. I'd like to move towards using ordinary query metadata for this, since the QL compiler already parses it anyway.

(It seems unlikely that there exist any test outside this repository that uses // query-type: graph).

For the time being, give the annotation in both old and new syntaxes, until a CLI that recognizes both has been released.

@hmakholm hmakholm added the C++ label Oct 22, 2024
@hmakholm hmakholm requested a review from a team as a code owner October 22, 2024 18:32
Copy link
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the auto-formatter is not quite happy, otherwise this LGTM. You might want to check that none of our internal tests use query-type. And if you're really paranoid you might also want to check https://github.com/github/codeql-coding-standards.

A number of CPP library tests contain `// query-type: graph`
annotations that make the test driver compare the output
from the test query in a special mode. (This feature is
not used by other languages).

It's somewhat awkward in the implementation of `codeql test run`
that this annotation is not an ordinary item of query metadata --
essentially it means that _every_ test query has to be opened
and read an extra time to look for this annotation. I'd like
to move towards using ordinary query metadata for this, since
the QL compiler already parses it anyway.

For the time being, give the annotation in both old and new
syntaxes, until a CLI that recognizes both has been released.
@hmakholm hmakholm force-pushed the hmakholm/pr/graph-equivalence-test branch from f233a5a to 3d8d340 Compare October 22, 2024 18:38
@hmakholm
Copy link
Contributor Author

hmakholm commented Oct 22, 2024

Ran the autoformatter.

I grepped through all .ql files in the internal repo, and all files in codeql-coding-standards.

The only files that even contain the string query-kind: are the ones changed here, and an internal test that I'm updating in the internal companion PR.

@hmakholm hmakholm merged commit 665354e into main Oct 22, 2024
10 checks passed
@hmakholm hmakholm deleted the hmakholm/pr/graph-equivalence-test branch October 22, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants