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

Andy Zhou azhou at ovn.org
Tue Oct 11 19:33:22 UTC 2016


Without this fix, the added test will core dump.

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

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;
-- 
1.9.1




More information about the dev mailing list