summaryrefslogtreecommitdiff
path: root/tests/test-classifier.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-05-11 14:06:48 -0700
committerBen Pfaff <blp@nicira.com>2011-05-11 14:06:48 -0700
commit08944c1db1ab2707e28deab838dc0937bf8de8ae (patch)
tree132ca0dae0ffcea779b509017447e2729755b516 /tests/test-classifier.c
parentc084ce1d3f3147d757087502bc2ccd7400d0691f (diff)
downloadopenvswitch-08944c1db1ab2707e28deab838dc0937bf8de8ae.tar.gz
ofproto: Make rule construction and destruction more symmetric.
Before, ->rule_construct() both created the rule and inserted into the flow table, but ->rule_destruct() only destroyed the rule. This makes ->rule_destruct() also remove the rule from the flow table.
Diffstat (limited to 'tests/test-classifier.c')
-rw-r--r--tests/test-classifier.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test-classifier.c b/tests/test-classifier.c
index bb75dba1a..1cfd5cf6e 100644
--- a/tests/test-classifier.c
+++ b/tests/test-classifier.c
@@ -526,7 +526,7 @@ test_single_rule(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
tcls_init(&tcls);
tcls_rule = tcls_insert(&tcls, rule);
- assert(!classifier_insert(&cls, &rule->cls_rule));
+ classifier_insert(&cls, &rule->cls_rule);
check_tables(&cls, 1, 1, 0);
compare_classifiers(&cls, &tcls);
@@ -562,7 +562,7 @@ test_rule_replacement(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
classifier_init(&cls);
tcls_init(&tcls);
tcls_insert(&tcls, rule1);
- assert(!classifier_insert(&cls, &rule1->cls_rule));
+ classifier_insert(&cls, &rule1->cls_rule);
check_tables(&cls, 1, 1, 0);
compare_classifiers(&cls, &tcls);
tcls_destroy(&tcls);
@@ -570,7 +570,7 @@ test_rule_replacement(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
tcls_init(&tcls);
tcls_insert(&tcls, rule2);
assert(test_rule_from_cls_rule(
- classifier_insert(&cls, &rule2->cls_rule)) == rule1);
+ classifier_replace(&cls, &rule2->cls_rule)) == rule1);
free(rule1);
check_tables(&cls, 1, 1, 0);
compare_classifiers(&cls, &tcls);
@@ -681,7 +681,7 @@ test_many_rules_in_one_list (int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
tcls_rules[j] = tcls_insert(&tcls, rules[j]);
displaced_rule = test_rule_from_cls_rule(
- classifier_insert(&cls, &rules[j]->cls_rule));
+ classifier_replace(&cls, &rules[j]->cls_rule));
if (pri_rules[pris[j]] >= 0) {
int k = pri_rules[pris[j]];
assert(displaced_rule != NULL);
@@ -781,7 +781,7 @@ test_many_rules_in_one_table(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
rules[i] = make_rule(wcf, priority, value_pats[i]);
tcls_rules[i] = tcls_insert(&tcls, rules[i]);
- assert(!classifier_insert(&cls, &rules[i]->cls_rule));
+ classifier_insert(&cls, &rules[i]->cls_rule);
check_tables(&cls, 1, i + 1, 0);
compare_classifiers(&cls, &tcls);
@@ -839,7 +839,7 @@ test_many_rules_in_n_tables(int n_tables)
int value_pat = rand() & ((1u << CLS_N_FIELDS) - 1);
rule = make_rule(wcf, priority, value_pat);
tcls_insert(&tcls, rule);
- assert(!classifier_insert(&cls, &rule->cls_rule));
+ classifier_insert(&cls, &rule->cls_rule);
check_tables(&cls, -1, i + 1, -1);
compare_classifiers(&cls, &tcls);
}