Skip to content

Commit

Permalink
Supplement 'query-type: graph' with actual query metadata
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hmakholm committed Oct 22, 2024
1 parent 16fe7a2 commit f233a5a
Show file tree
Hide file tree
Showing 19 changed files with 76 additions and 19 deletions.
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/basic_blocks/bb_cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/basic_blocks/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/c++_exceptions/graphable.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/constexpr_if/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/destructors/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/lambdas/cfg/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/pointsto/basic/sets.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp
import semmle.code.cpp.pointsto.PointsTo

Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/sub_basic_blocks/cut.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import sbb_test

class CutCall extends SubBasicBlockCutNode {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/sub_basic_blocks/no_cut.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import sbb_test

// Note: no instance of `SubBasicBlockCutNode`
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/virtual_functions/cfg/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/library-tests/vla/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/successor-tests/break_labels/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/successor-tests/conditional_destructors/cfg.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/successor-tests/pruning/graphable.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
5 changes: 4 additions & 1 deletion cpp/ql/test/successor-tests/returnstmt/graphable.ql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// query-type: graph
/**
* query-type: graph
* @kind graph-equivalence-test
*/
import cpp

class DestructorCallEnhanced extends DestructorCall {
Expand Down

0 comments on commit f233a5a

Please sign in to comment.