From: christian.babeux@efficios.com (Christian Babeux)
Subject: [lttng-dev] [PATCH lttng-tools] Tests: Add filtering tests for uncovered cases
Date: Wed, 31 Oct 2012 09:00:45 -0400 [thread overview]
Message-ID: <1351688445-18551-1-git-send-email-christian.babeux@efficios.com> (raw)
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 at efficios.com>
---
tests/tools/filtering/invalid-filters | 15 +++++++++++++++
tests/tools/filtering/valid-filters | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/tests/tools/filtering/invalid-filters b/tests/tools/filtering/invalid-filters
index d0777e5..b653705 100755
--- a/tests/tools/filtering/invalid-filters
+++ b/tests/tools/filtering/invalid-filters
@@ -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
diff --git a/tests/tools/filtering/valid-filters b/tests/tools/filtering/valid-filters
index b48b6ed..d32a60d 100755
--- a/tests/tools/filtering/valid-filters
+++ b/tests/tools/filtering/valid-filters
@@ -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[@]}
--
1.8.0
reply other threads:[~2012-10-31 13:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351688445-18551-1-git-send-email-christian.babeux@efficios.com \
--to=christian.babeux@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox