tests/classifier: Make test work in big-endian systems.
authorJarno Rajahalme <jrajahalme@nicira.com>
Mon, 8 Dec 2014 18:10:07 +0000 (10:10 -0800)
committerJarno Rajahalme <jrajahalme@nicira.com>
Mon, 8 Dec 2014 18:10:07 +0000 (10:10 -0800)
Change a test so that the result will be the same in both
little-endian and big-endian systems by editing the test case so that
only one bit differs.

Reported-by: Mijo Safradin <mijo@linux.vnet.ibm.com>
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/classifier.c
tests/classifier.at

index fe43bd1..1985efe 100644 (file)
@@ -1336,7 +1336,8 @@ miniflow_and_mask_matches_flow_wc(const struct miniflow *flow,
             /* Only unwildcard if none of the differing bits is already
              * exact-matched. */
             if (!(flow_u32_value(&wc->masks, idx) & diff)) {
-                /* Keep one bit of the difference. */
+                /* Keep one bit of the difference.  The selected bit may be
+                 * different in big-endian v.s. little-endian systems. */
                 *flow_u32_lvalue(&wc->masks, idx) |= rightmost_1bit(diff);
             }
             return false;
index 4d23be5..eb97022 100644 (file)
@@ -43,9 +43,9 @@ AT_CHECK([tail -2 stdout], [0],
   [Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
 Datapath actions: 1
 ])
-AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
+AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=11.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
 AT_CHECK([tail -2 stdout], [0],
-  [Megaflow: recirc_id=0,ip,in_port=1,nw_dst=0.0.0.0/2.0.0.0,nw_frag=no
+  [Megaflow: recirc_id=0,ip,in_port=1,nw_dst=1.0.0.0/1.0.0.0,nw_frag=no
 Datapath actions: drop
 ])
 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])