tests: implement context filtering tests
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 27 Mar 2013 19:28:01 +0000 (15:28 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 27 Mar 2013 19:28:01 +0000 (15:28 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/regression/tools/filtering/test_invalid_filter
tests/regression/tools/filtering/test_valid_filter

index 9e8a3c6f61fc917bb8cec6226bb064ceaf4760e5..5e096a5b389382be48cc9f5e3953a1a4fcb483e2 100755 (executable)
@@ -24,7 +24,7 @@ SESSION_NAME="filter-invalid"
 EVENT_NAME="bogus"
 ENABLE_EVENT_STDERR="/tmp/invalid-filters-stderr"
 TRACE_PATH=$(mktemp -d)
-NUM_TESTS=119
+NUM_TESTS=143
 
 source $TESTDIR/utils/utils.sh
 
@@ -118,7 +118,7 @@ INVALID_FILTERS=(
                "!a.f.d"
                "asdf.asdfsd.sadf < 4"
                "asdfasdf->asdfasdf < 2"
-               # String can't be root node
+               # String can\'t be root node
                "\"somestring\""
                # Unary op on string not allowed
                "!\"somestring\""
@@ -133,6 +133,16 @@ INVALID_FILTERS=(
                # Nesting of binary operator not allowed
                "1 | (1 | (1 | 1))"
                "1 > (1 > (1 > 1))"
+               # Exactly one chaining level under \$ctx allowed
+               "\$ctx.vtid.blah == 0"
+               "0 == \$ctx.vtid.blah"
+               "\$ctx.44 == 0"
+               "0 == \$ctx.44"
+               "\$ctx == 0"
+               "0 == \$ctx"
+               # Only \$ctx is supported for now
+               "\$global.value == 0"
+               "0 == \$global.value"
                )
 
 start_lttng_sessiond
index 5587fdec2eb895e0d5a24112975877086052acff..7170eb57c94775d6f2bcdbb926770eb00c7caa7c 100755 (executable)
@@ -25,7 +25,7 @@ STATS_BIN="babelstats.pl"
 SESSION_NAME="valid_filter"
 EVENT_NAME="tp:tptest"
 NR_ITER=100
-NUM_TESTS=198
+NUM_TESTS=338
 
 source $TESTDIR/utils/utils.sh
 
@@ -144,6 +144,32 @@ function validator_intfield_gt
        return $status
 }
 
+function validator_has_no_event
+{
+       stats="$1"
+       status=0
+
+       validate_min_max "$stats" "intfield" "0" "99"
+       status=$(($status|$?))
+
+       if [ $status -eq 0 ]; then
+               return 1
+       else
+               return 0
+       fi
+}
+
+function validator_has_events
+{
+       stats="$1"
+       status=0
+
+       validate_min_max "$stats" "intfield" "0" "99"
+       status=$(($status|$?))
+
+       return $status
+}
+
 function validator_intfield_ge
 {
        stats="$1"
@@ -351,6 +377,26 @@ FILTERS=("intfield"                                                     #1
         "stringfield2 == \"\\\*\""                                     #26
         "1.0 || intfield || 1.0"                                       #27
         "1 < intfield"                                                 #28
+        "\$ctx.vtid == 0"                                              #29
+        "\$ctx.vtid != 0"                                              #30
+        "0 == \$ctx.vtid"                                              #31
+        "0 != \$ctx.vtid"                                              #32
+        "\$ctx.vpid == 0"                                              #33
+        "\$ctx.vpid != 0"                                              #34
+        "0 == \$ctx.vpid"                                              #35
+        "0 != \$ctx.vpid"                                              #36
+        "\$ctx.procname != \"$BIN_NAME\""                              #37
+        "\$ctx.procname == \"$BIN_NAME\""                              #38
+        "\"$BIN_NAME\" != \$ctx.procname"                              #39
+        "\"$BIN_NAME\" == \$ctx.procname"                              #40
+        "\$ctx.procname != \"$BIN_NAME*\""                             #41
+        "\$ctx.procname == \"$BIN_NAME*\""                             #42
+        "\"$BIN_NAME*\" != \$ctx.procname"                             #43
+        "\"$BIN_NAME*\" == \$ctx.procname"                             #44
+        "\$ctx.procname != \"*\""                                      #45
+        "\$ctx.procname == \"*\""                                      #46
+        "\"*\" != \$ctx.procname"                                      #47
+        "\"*\" == \$ctx.procname"                                      #48
 )
 
 VALIDATOR=("validator_intfield"                     #1
@@ -381,6 +427,26 @@ VALIDATOR=("validator_intfield"                     #1
           "validator_true_statement"               #26
           "validator_true_statement"               #27
           "validator_intfield_gt"                  #28
+          "validator_has_no_event"                 #29
+          "validator_has_events"                   #30
+          "validator_has_no_event"                 #31
+          "validator_has_events"                   #32
+          "validator_has_no_event"                 #33
+          "validator_has_events"                   #34
+          "validator_has_no_event"                 #35
+          "validator_has_events"                   #36
+          "validator_has_no_event"                 #36
+          "validator_has_events"                   #37
+          "validator_has_no_event"                 #38
+          "validator_has_events"                   #39
+          "validator_has_no_event"                 #41
+          "validator_has_events"                   #42
+          "validator_has_no_event"                 #43
+          "validator_has_events"                   #44
+          "validator_has_no_event"                 #45
+          "validator_has_events"                   #46
+          "validator_has_no_event"                 #47
+          "validator_has_events"                   #48
 )
 
 FILTER_COUNT=${#FILTERS[@]}
This page took 0.027579 seconds and 4 git commands to generate.