[ovs-dev] [PATCH ovn v3 5/5] expr: Support string fields in expr_to_matches().

Ben Pfaff blp at nicira.com
Wed Apr 15 22:03:24 UTC 2015


On Thu, Apr 09, 2015 at 03:02:17PM -0400, Russell Bryant wrote:
> On 04/01/2015 12:52 AM, Ben Pfaff wrote:
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> >  ovn/expr.c       | 115 ++++++++++++++++++++++++++++++++++++++++++-------------
> >  ovn/expr.h       |   6 ++-
> >  tests/test-ovn.c |   6 +--
> >  3 files changed, 95 insertions(+), 32 deletions(-)
> 
> > diff --git a/tests/test-ovn.c b/tests/test-ovn.c
> > index aef4e45..8048e08 100644
> > --- a/tests/test-ovn.c
> > +++ b/tests/test-ovn.c
> > @@ -130,8 +130,8 @@ create_symtab(struct shash *symtab)
> >  {
> >      shash_init(symtab);
> >  
> > -    expr_symtab_add_string(symtab, "inport", NULL);
> > -    expr_symtab_add_string(symtab, "outport", NULL);
> > +    expr_symtab_add_string(symtab, "inport", MFF_IN_PORT, NULL);
> > +    expr_symtab_add_string(symtab, "outport", MFF_ACTSET_OUTPUT, NULL);
> >  
> >      expr_symtab_add_field(symtab, "xreg0", MFF_XREG0, NULL, false);
> >      expr_symtab_add_field(symtab, "xreg1", MFF_XREG1, NULL, false);
> > @@ -858,7 +858,7 @@ test_tree_shape_exhaustively(struct expr *expr, struct shash *symtab,
> >              struct test_rule *test_rule;
> >              uint32_t n_conjs;
> >  
> > -            n_conjs = expr_to_matches(modified, &matches);
> > +            n_conjs = expr_to_matches(modified, NULL, &matches);
> >  
> >              classifier_init(&cls, NULL);
> >              HMAP_FOR_EACH (m, hmap_node, &matches) {
> > 
> 
> How about a test case that includes a map of port names to
> expr_to_matches() ?

Yeah, I knew I should have done that, but writing the exhaustive tests
left me exhausted.

I wrote a few tests, though not exhaustive ones, and did find and fix a
bug.  Here's an incremental diff.  The bug fix is the change to
add_disjunction().

I'll reassess the overall patch series a little later; I guess I'll be
sending out at least one more version of this patch.

Thanks,

Ben.



More information about the dev mailing list