Skip to content

Commit f233a5a

Browse files
committed
Supplement 'query-type: graph' with actual query metadata
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.
1 parent 16fe7a2 commit f233a5a

File tree

19 files changed

+76
-19
lines changed

19 files changed

+76
-19
lines changed

cpp/ql/test/library-tests/basic_blocks/bb_cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/library-tests/basic_blocks/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/library-tests/c++_exceptions/graphable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/library-tests/constexpr_if/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/library-tests/destructors/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/library-tests/lambdas/cfg/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/library-tests/pointsto/basic/sets.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36
import semmle.code.cpp.pointsto.PointsTo
47

cpp/ql/test/library-tests/sub_basic_blocks/cut.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import sbb_test
36

47
class CutCall extends SubBasicBlockCutNode {

cpp/ql/test/library-tests/sub_basic_blocks/no_cut.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import sbb_test
36

47
// Note: no instance of `SubBasicBlockCutNode`

cpp/ql/test/library-tests/virtual_functions/cfg/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/library-tests/vla/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/break_labels/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/conditional_destructors/cfg.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/exceptionhandler/ellipsisexceptionhandler/graphable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/exceptionhandler/exceptionhandler/graphable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/pruning/graphable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/returnstmt/graphable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/stackvariables/stackvariables/graphable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

cpp/ql/test/successor-tests/switchstmt/switchbody/graphable.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// query-type: graph
1+
/**
2+
* query-type: graph
3+
* @kind graph-equivalence-test
4+
*/
25
import cpp
36

47
class DestructorCallEnhanced extends DestructorCall {

0 commit comments

Comments
 (0)