]> git.proxmox.com Git - mirror_frr.git/commitdiff
[tests] Add empty-path and sequence+1ASN test data to aspath_test.c
authorpaul <paul>
Wed, 23 Nov 2005 02:48:14 +0000 (02:48 +0000)
committerpaul <paul>
Wed, 23 Nov 2005 02:48:14 +0000 (02:48 +0000)
2005-11-23 Paul Jakma <paul.jakma@sun.com>

* aspath_test.c: Add an empty aspath to test segments, and to
  compare tests.
  Add a segment identical to seq1, but with one extra asn.
  Fix bogus free of stream in make_aspath for case where
  no stream was allocated (empty path data).

tests/ChangeLog
tests/aspath_test.c

index 1264bf0ad3f297d7b73a73ad7953d25b7872886c..2ac5a51753fbd8f18820da272ec175ced7600fdf 100644 (file)
@@ -1,3 +1,11 @@
+2005-11-23 Paul Jakma <paul.jakma@sun.com>
+
+       * aspath_test.c: Add an empty aspath to test segments, and to
+         compare tests.
+         Add a segment identical to seq1, but with one extra asn.
+         Fix bogus free of stream in make_aspath for case where
+         no stream was allocated (empty path data).
+
 2005-10-11 Paul Jakma <paul.jakma@sun.com>
 
        * test-privs.c: Privileges unit test.
index f025cb7771cadc46a31b32e4eb663c13b0543c4c..de67990b00461b1c7075ac05f5091f200db24a2f 100644 (file)
@@ -286,6 +286,22 @@ static struct test_segment {
       "8466 3 52737 4096 34285 8466 3 52737 4096 34285",
       250, 0, NOT_ALL_PRIVATE, 4096, 4, 8466 },
   },
+  { /* 15 */ 
+    "seq1extra",
+    "seq(8466,3,52737,4096,3456)",
+    { 0x2,0x5, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00, 0x0d,0x80 },
+    12,
+    { "8466 3 52737 4096 3456",
+      "8466 3 52737 4096 3456",
+      5, 0, NOT_ALL_PRIVATE, 4096, 4, 8466 },
+  },
+  { /* 16 */
+    "empty",
+    "<empty>",
+    {},
+    0,
+    { "", "", 0, 0, 0, 0, 0, 0 },
+  },
   { NULL, NULL, {0}, 0, { NULL, 0, 0 } }
 };
 
@@ -445,6 +461,8 @@ struct compare_tests
   { 0, 1, CMP_RES_NO, CMP_RES_NO },
   { 0, 2, CMP_RES_YES, CMP_RES_NO },
   { 0, 11, CMP_RES_YES, CMP_RES_NO },
+  { 0, 15, CMP_RES_YES, CMP_RES_NO },
+  { 0, 16, CMP_RES_NO, CMP_RES_NO },
   { 1, 11, CMP_RES_NO, CMP_RES_NO },
   { 6, 7, CMP_RES_NO, CMP_RES_YES },
   { 6, 8, CMP_RES_NO, CMP_RES_NO },
@@ -477,7 +495,9 @@ make_aspath (const u_char *data, size_t len)
       stream_put (s, data, len);
     }
   as = aspath_parse (s, len);
-  stream_free (s);
+  
+  if (s)
+    stream_free (s);
   
   return as;
 }