Parcourir la source

fixed unit tests after changing memp stats

goldsimon il y a 9 ans
Parent
commit
288fc8ede3
4 fichiers modifiés avec 35 ajouts et 35 suppressions
  1. 2 2
      test/unit/core/test_pbuf.c
  2. 4 4
      test/unit/tcp/tcp_helper.c
  3. 15 15
      test/unit/tcp/test_tcp.c
  4. 14 14
      test/unit/tcp/test_tcp_oos.c

+ 2 - 2
test/unit/core/test_pbuf.c

@@ -46,7 +46,7 @@ START_TEST(test_pbuf_copy_zero_pbuf)
   LWIP_UNUSED_ARG(_i);
 
   fail_unless(lwip_stats.mem.used == 0);
-  fail_unless(lwip_stats.memp[MEMP_PBUF_POOL].used == 0);
+  fail_unless(MEMP_STATS_GET(used, MEMP_PBUF_POOL) == 0);
 
   p1 = pbuf_alloc(PBUF_RAW, 1024, PBUF_RAM);
   fail_unless(p1 != NULL);
@@ -70,7 +70,7 @@ START_TEST(test_pbuf_copy_zero_pbuf)
   fail_unless(lwip_stats.mem.used == 0);
 
   fail_unless(lwip_stats.mem.used == 0);
-  fail_unless(lwip_stats.memp[MEMP_PBUF_POOL].used == 0);
+  fail_unless(MEMP_STATS_GET(used, MEMP_PBUF_POOL) == 0);
 }
 END_TEST
 

+ 4 - 4
test/unit/tcp/tcp_helper.c

@@ -31,10 +31,10 @@ tcp_remove_all(void)
   tcp_remove(tcp_listen_pcbs.pcbs);
   tcp_remove(tcp_active_pcbs);
   tcp_remove(tcp_tw_pcbs);
-  fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
-  fail_unless(lwip_stats.memp[MEMP_TCP_PCB_LISTEN].used == 0);
-  fail_unless(lwip_stats.memp[MEMP_TCP_SEG].used == 0);
-  fail_unless(lwip_stats.memp[MEMP_PBUF_POOL].used == 0);
+  fail_unless(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
+  fail_unless(MEMP_STATS_GET(used, MEMP_TCP_PCB_LISTEN) == 0);
+  fail_unless(MEMP_STATS_GET(used, MEMP_TCP_SEG) == 0);
+  fail_unless(MEMP_STATS_GET(used, MEMP_PBUF_POOL) == 0);
 }
 
 /** Create a TCP segment usable for passing to tcp_input */

+ 15 - 15
test/unit/tcp/test_tcp.c

@@ -60,14 +60,14 @@ START_TEST(test_tcp_new_abort)
   struct tcp_pcb* pcb;
   LWIP_UNUSED_ARG(_i);
 
-  fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  fail_unless(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 
   pcb = tcp_new();
   fail_unless(pcb != NULL);
   if (pcb != NULL) {
-    fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+    fail_unless(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
     tcp_abort(pcb);
-    fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+    fail_unless(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
   }
 }
 END_TEST
@@ -117,9 +117,9 @@ START_TEST(test_tcp_recv_inseq)
   }
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 END_TEST
 
@@ -185,9 +185,9 @@ START_TEST(test_tcp_malformed_header)
   }
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 END_TEST
 
@@ -358,9 +358,9 @@ START_TEST(test_tcp_fast_retx_recover)
   }
 #endif
   /* make sure the pcb is freed */
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 END_TEST
 
@@ -470,9 +470,9 @@ START_TEST(test_tcp_fast_rexmit_wraparound)
   check_seqnos(pcb->unacked, 5, &seqnos[1]);
 
   /* make sure the pcb is freed */
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 END_TEST
 
@@ -560,9 +560,9 @@ START_TEST(test_tcp_rto_rexmit_wraparound)
   check_seqnos(pcb->unacked, 6, seqnos);
 
   /* make sure the pcb is freed */
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 END_TEST
 
@@ -705,9 +705,9 @@ static void test_tcp_tx_full_window_lost(u8_t zero_window_probe_from_unsent)
   }
 
   /* make sure the pcb is freed */
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT_RET(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT_RET(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 
 START_TEST(test_tcp_tx_full_window_lost_from_unsent)

+ 14 - 14
test/unit/tcp/test_tcp_oos.c

@@ -272,9 +272,9 @@ START_TEST(test_tcp_recv_ooseq_FIN_OOSEQ)
   }
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 END_TEST
 
@@ -448,9 +448,9 @@ START_TEST(test_tcp_recv_ooseq_FIN_INSEQ)
   }
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 END_TEST
 
@@ -542,9 +542,9 @@ START_TEST(test_tcp_recv_ooseq_overrun_rxwin)
   EXPECT(pcb->ooseq == NULL);
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 #endif /* !TCP_OOSEQ_MAX_BYTES && !TCP_OOSEQ_MAX_PBUFS */
   LWIP_UNUSED_ARG(_i);
 }
@@ -635,9 +635,9 @@ START_TEST(test_tcp_recv_ooseq_overrun_rxwin_edge)
   EXPECT(pcb->ooseq == NULL);
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 #endif /* !TCP_OOSEQ_MAX_BYTES && !TCP_OOSEQ_MAX_PBUFS */
   LWIP_UNUSED_ARG(_i);
 }
@@ -716,9 +716,9 @@ START_TEST(test_tcp_recv_ooseq_max_bytes)
   EXPECT_OOSEQ(datalen2 == ((i-1) * TCP_MSS));
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 #endif /* TCP_OOSEQ_MAX_BYTES && (TCP_OOSEQ_MAX_BYTES < (TCP_WND + 1)) && (PBUF_POOL_BUFSIZE >= (TCP_MSS + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN)) */
   LWIP_UNUSED_ARG(_i);
 }
@@ -797,9 +797,9 @@ START_TEST(test_tcp_recv_ooseq_max_pbufs)
   EXPECT_OOSEQ(datalen2 == (i-1));
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 #endif /* TCP_OOSEQ_MAX_PBUFS && (TCP_OOSEQ_MAX_BYTES < (TCP_WND + 1)) && (PBUF_POOL_BUFSIZE >= (TCP_MSS + PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN)) */
   LWIP_UNUSED_ARG(_i);
 }
@@ -985,9 +985,9 @@ static void test_tcp_recv_ooseq_double_FINs(int delay_packet)
   EXPECT(pcb->ooseq == NULL);
 
   /* make sure the pcb is freed */
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 1);
   tcp_abort(pcb);
-  EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0);
+  EXPECT(MEMP_STATS_GET(used, MEMP_TCP_PCB) == 0);
 }
 
 /** create multiple segments and pass them to tcp_input with the first segment missing