Tests: Add filtering tests for uncovered cases
authorChristian Babeux <christian.babeux@efficios.com>
Wed, 31 Oct 2012 13:00:45 +0000 (09:00 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 2 Nov 2012 15:17:02 +0000 (11:17 -0400)
While investigating the code coverage of the filtering feature, a couple
of possible tests cases were uncovered:

Error tests:
* Strings can't be IR root node
* Unary ! not allowed on string type
* Comparison with string type not allowed
* Logical operator not allowed with string types
* Nesting of binary operator not allowed

Valid tests:
* Cover all left/right operands permutations with
  fields ref. and numeric values.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/tools/filtering/invalid-filters
tests/tools/filtering/valid-filters

index d0777e583f89767efdfb040650477fcd6e3608a9..b6537055cae7a9dae3d7bed6109daf7058c4a111 100755 (executable)
@@ -118,6 +118,21 @@ INVALID_FILTERS=(
                "!a.f.d"
                "asdf.asdfsd.sadf < 4"
                "asdfasdf->asdfasdf < 2"
+               # String can't be root node
+               "\"somestring\""
+               # Unary op on string not allowed
+               "!\"somestring\""
+               # Comparison with string type not allowed
+               "\"somestring\" > 42"
+               "\"somestring\" > 42.0"
+               "42 > \"somestring\""
+               "42.0 > \"somestring\""
+               # Logical operator with string type not allowed
+               "\"somestring\" || 1"
+               "1 || \"somestring\""
+               # Nesting of binary operator not allowed
+               "1 | (1 | (1 | 1))"
+               "1 > (1 > (1 > 1))"
                )
 
 start_lttng_sessiond
index b48b6ed854b96d22f9aaffc599cff3015882c3d1..d32a60d58498aaa9804c501d8d78decfff4464b4 100755 (executable)
@@ -361,6 +361,8 @@ FILTERS=("intfield"                                                     #1
         "intfield < 0x2"                                               #24
         "intfield < 02"                                                #25
         "stringfield2 == \"\\\*\""                                     #26
+        "1.0 || intfield || 1.0"                                       #27
+        "1 < intfield"                                                 #28
 )
 
 VALIDATOR=("validator_intfield"                     #1
@@ -389,6 +391,8 @@ VALIDATOR=("validator_intfield"                     #1
           "validator_intfield_lt"                  #24
           "validator_intfield_lt"                  #25
           "validator_true_statement"               #26
+          "validator_true_statement"               #27
+          "validator_intfield_gt"                  #28
 )
 
 FILTER_COUNT=${#FILTERS[@]}
This page took 0.026572 seconds and 4 git commands to generate.