diff mbox

[ovs-dev] ovn-test: Fix 'test-ovn composition' crash

Message ID 1476214402-58060-1-git-send-email-azhou@ovn.org
State Accepted
Headers show

Commit Message

Andy Zhou Oct. 11, 2016, 7:33 p.m. UTC
Without this fix, the added test will core dump.

Signed-off-by: Andy Zhou <azhou@ovn.org>
---
 tests/ovn.at     | 4 ++++
 tests/test-ovn.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Ben Pfaff Oct. 19, 2016, 7:58 p.m. UTC | #1
On Tue, Oct 11, 2016 at 12:33:22PM -0700, Andy Zhou wrote:
> Without this fix, the added test will core dump.
> 
> Signed-off-by: Andy Zhou <azhou@ovn.org>

Thanks!

Acked-by: Ben Pfaff <blp@ovn.org>
Andy Zhou Oct. 20, 2016, 8 p.m. UTC | #2
On Wed, Oct 19, 2016 at 12:58 PM, Ben Pfaff <blp@ovn.org> wrote:

> On Tue, Oct 11, 2016 at 12:33:22PM -0700, Andy Zhou wrote:
> > Without this fix, the added test will core dump.
> >
> > Signed-off-by: Andy Zhou <azhou@ovn.org>
>
> Thanks!
>
> Acked-by: Ben Pfaff <blp@ovn.org>
>

Thanks for the review. Pushed to master and branch-2.6.
diff mbox

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index caf9f98..1f65e75 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -175,6 +175,10 @@  ct_state = NXM_NX_CT_STATE
 ]])
 AT_CLEANUP
 
+AT_SETUP([ovn -- compsition])
+AT_CHECK([ovstest test-ovn composition 2], [0], [ignore])
+AT_CLEANUP
+
 AT_SETUP([ovn -- expression parser])
 dnl For lines without =>, input and expected output are identical.
 dnl For lines with =>, input precedes => and expected output follows =>.
diff --git a/tests/test-ovn.c b/tests/test-ovn.c
index 637ac7d..2e82a6f 100644
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -452,11 +452,11 @@  next_composition(unsigned int *state, int s[], int sn)
             j++;
         } else {
             j--;
-            s[j] = s[j + 1];
-            s[j - 1]++;
             if (!j) {
                 return 0;
             }
+            s[j] = s[j + 1];
+            s[j - 1]++;
         }
     }
     return j + 1;