[nft PATCH] tests: shell: Extend get element test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Despite the recent fixes, the test still fails. While trying to address
the remaining issues, I found more potentially problematic inputs so
extend the test by those.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
Hi,

A bit of context illustrating why I think the code needs more than just
"more fixes": AFAIU, for each input element (which may be part of a
range or not), code asks the kernel for whether the element exists, then
get_set_decompose() is called to find the corresponding range. This
approach has a critical problem though: Given a set with elements 10 and
20-30, asking for 10 and 20 will return the same two elements as asking
for 10-20 does. Though in the first case, we should return 10 and 20-30
while in the latter case we should return nothing.
---
 tests/shell/testcases/sets/0034get_element_0 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/shell/testcases/sets/0034get_element_0 b/tests/shell/testcases/sets/0034get_element_0
index 2bfb527b8080f..b1f14476d90d6 100755
--- a/tests/shell/testcases/sets/0034get_element_0
+++ b/tests/shell/testcases/sets/0034get_element_0
@@ -27,10 +27,17 @@ check 15-18 ""
 
 # multiple single elements, ranges smaller than present
 check "10, 40" "10, 40"
+check "22-24, 26-28" 20-30
 check 21-29 20-30
 
+# mixed single elements and ranges
+check "10, 20" "10, 20-30"
+check "10, 22" "10, 20-30"
+check "10, 22-24" "10, 20-30"
+
 # non-existing ranges matching elements
 check 10-40 ""
+check 10-20 ""
 check 10-25 ""
 check 25-55 ""
 
-- 
2.19.0




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux