summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2013-02-26 17:53:30 +0100
committerDavid Lamparter <equinox@diac24.net>2013-04-14 16:01:11 +0200
commit5bb7e4d12b3a3015208fad5ee0f3c055b704c8c4 (patch)
tree715ef4c4c267687d86e0c8fb7a494c31038c32bd
parentf281ab9752393fcc7cbb54c50edb66f25c2a31fb (diff)
tests: DejaGNU bgpd
this just wraps the existing test programs in expect wrappers that make their results usable to DejaGNU. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rwxr-xr-xconfigure.ac1
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/bgpd.tests/Makefile.am7
-rw-r--r--tests/bgpd.tests/aspathtest.exp76
-rw-r--r--tests/bgpd.tests/ecommtest.exp13
-rw-r--r--tests/bgpd.tests/testbgpcap.exp51
-rw-r--r--tests/bgpd.tests/testbgpmpath.exp12
-rw-r--r--tests/bgpd.tests/testbgpmpattr.exp31
-rw-r--r--tests/lib/bgpd.exp0
9 files changed, 195 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 582f3572..32a59d97 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1704,6 +1704,7 @@ AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
ospf6d/Makefile isisd/Makefile babeld/Makefile vtysh/Makefile
doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
+ tests/bgpd.tests/Makefile
redhat/Makefile
pkgsrc/Makefile
redhat/quagga.spec
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 14f7bef1..153922b9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,14 +1,14 @@
AUTOMAKE_OPTIONS = dejagnu
export DEJAGNU
+DEJATOOL =
-SUBDIRS =
+SUBDIRS = bgpd.tests
EXTRA_DIST = \
config/unix.exp \
+ lib/bgpd.exp \
global-conf.exp
-DEJATOOL =
-
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\"
@@ -17,6 +17,7 @@ AM_LDFLAGS = $(PILDFLAGS)
if BGPD
TESTS_BGPD = aspathtest testbgpcap ecommtest testbgpmpattr testbgpmpath
+DEJATOOL += bgpd
else
TESTS_BGPD =
endif
diff --git a/tests/bgpd.tests/Makefile.am b/tests/bgpd.tests/Makefile.am
new file mode 100644
index 00000000..5900186c
--- /dev/null
+++ b/tests/bgpd.tests/Makefile.am
@@ -0,0 +1,7 @@
+EXTRA_DIST = \
+ aspathtest.exp \
+ ecommtest.exp \
+ testbgpcap.exp \
+ testbgpmpath.exp \
+ testbgpmpattr.exp
+
diff --git a/tests/bgpd.tests/aspathtest.exp b/tests/bgpd.tests/aspathtest.exp
new file mode 100644
index 00000000..dfecec78
--- /dev/null
+++ b/tests/bgpd.tests/aspathtest.exp
@@ -0,0 +1,76 @@
+set timeout 10
+set testprefix "aspathtest "
+set aborted 0
+set color 1
+
+spawn "./aspathtest"
+
+# proc onetest { test_name note start } {
+# proc headerline { line } {
+
+set parserno 0
+proc parsertest { test_name } {
+ global parserno
+ headerline "test $parserno"
+ onetest "parse $test_name" " ($parserno)" "$test_name:"
+ onetest "parse $test_name +empty_prepend" " (#$parserno)" "empty prepend $test_name:"
+ incr parserno 1
+}
+set attrno 0
+proc attrtest { test_name } {
+ global attrno
+ headerline "aspath_attr test $attrno"
+ onetest "attr $test_name" " (#$attrno)" "$test_name"
+ incr attrno 1
+}
+
+
+parsertest "seq1"
+parsertest "seq2"
+parsertest "seq3"
+parsertest "seqset"
+parsertest "seqset2"
+parsertest "multi"
+parsertest "confed"
+parsertest "confed2"
+parsertest "confset"
+parsertest "confmulti"
+parsertest "seq4"
+parsertest "tripleseq1"
+parsertest "someprivate"
+parsertest "allprivate"
+parsertest "long"
+parsertest "seq1extra"
+parsertest "empty"
+parsertest "redundantset"
+parsertest "reconcile_lead_asp"
+parsertest "reconcile_new_asp"
+parsertest "reconcile_confed"
+parsertest "reconcile_start_trans"
+parsertest "reconcile_start_trans4"
+parsertest "reconcile_start_trans_error"
+parsertest "redundantset2"
+parsertest "zero-size overflow"
+parsertest "zero-size overflow + valid segment"
+parsertest "invalid segment type"
+
+for {set i 0} {$i < 10} {incr i 1} { onetest "prepend $i" "" "prepend test $i"; }
+for {set i 0} {$i < 5} {incr i 1} { onetest "aggregate $i" "" "aggregate test $i"; }
+for {set i 0} {$i < 5} {incr i 1} { onetest "reconcile $i" "" "reconcile test $i"; }
+for {set i 0} {$i < 22} {incr i 1} { onetest "compare $i" "" "left cmp "; }
+
+onetest "empty_get" "" "empty_get_test"
+attrtest "basic test"
+attrtest "length too short"
+attrtest "length too long"
+attrtest "incorrect flag"
+attrtest "as4_path, with as2 format data"
+attrtest "as4, with incorrect attr length"
+attrtest "basic 4-byte as-path"
+attrtest "4b AS_PATH: too short"
+attrtest "4b AS_PATH: too long"
+attrtest "4b AS_PATH: too long2"
+attrtest "4b AS_PATH: bad flags"
+attrtest "4b AS4_PATH w/o AS_PATH"
+attrtest "4b AS4_PATH: confed"
+
diff --git a/tests/bgpd.tests/ecommtest.exp b/tests/bgpd.tests/ecommtest.exp
new file mode 100644
index 00000000..074952fa
--- /dev/null
+++ b/tests/bgpd.tests/ecommtest.exp
@@ -0,0 +1,13 @@
+set timeout 10
+set testprefix "ecommtest "
+set aborted 0
+set color 0
+
+spawn "./ecommtest"
+
+# proc simpletest { start } {
+
+simpletest "ipaddr"
+simpletest "ipaddr-so"
+simpletest "asn"
+simpletest "asn4"
diff --git a/tests/bgpd.tests/testbgpcap.exp b/tests/bgpd.tests/testbgpcap.exp
new file mode 100644
index 00000000..1bbdfd12
--- /dev/null
+++ b/tests/bgpd.tests/testbgpcap.exp
@@ -0,0 +1,51 @@
+set timeout 10
+set testprefix "testbgpcap "
+set aborted 0
+set color 1
+
+spawn "./testbgpcap"
+
+# proc simpletest { start } {
+
+simpletest "MP4: MP IP/Uni"
+simpletest_nov6 "MPv6: MP IPv6/Uni"
+simpletest "MP2: MP IP/Multicast"
+simpletest_nov6 "MP3: MP IP6/MPLS-labeled VPN"
+simpletest_nov6 "MP5: MP IP6/MPLS-VPN"
+simpletest "MP6: MP IP4/MPLS-laveled VPN"
+simpletest "MP8: MP unknown AFI/SAFI"
+simpletest "MP-short: MP IP4/Unicast, length too short (< minimum)"
+simpletest "MP-overflow: MP IP4/Unicast, length too long"
+simpletest "caphdr: capability header, and no more"
+simpletest "nodata: header, no data but length says there is"
+simpletest "padded: valid, with padding"
+simpletest "minsize: violates minsize requirement"
+simpletest "ORF: ORF, simple, single entry, single tuple"
+simpletest "ORF-many: ORF, multi entry/tuple"
+simpletest "ORFlo: ORF, multi entry/tuple, hdr length too short"
+simpletest "ORFlu: ORF, multi entry/tuple, length too long"
+simpletest "ORFnu: ORF, multi entry/tuple, entry number too long"
+simpletest "ORFno: ORF, multi entry/tuple, entry number too short"
+simpletest "ORFpad: ORF, multi entry/tuple, padded to align"
+simpletest "AS4: AS4 capability"
+simpletest "GR: GR capability"
+simpletest "GR-short: GR capability, but header length too short"
+simpletest "GR-long: GR capability, but header length too long"
+simpletest "GR-trunc: GR capability, but truncated"
+simpletest "GR-empty: GR capability, but empty."
+simpletest "MP-empty: MP capability, but empty."
+simpletest "ORF-empty: ORF capability, but empty."
+simpletest "AS4-empty: AS4 capability, but empty."
+simpletest "dyn-empty: Dynamic capability, but empty."
+simpletest "dyn-old: Dynamic capability (deprecated version)"
+simpletest "Cap-singlets: One capability per Optional-Param"
+simpletest "Cap-series: Series of capability, one Optional-Param"
+simpletest "AS4more: AS4 capability after other caps (singlets)"
+simpletest "AS4series: AS4 capability, in series of capabilities"
+simpletest "AS4real: AS4 capability, in series of capabilities"
+simpletest "AS4real2: AS4 capability, in series of capabilities"
+simpletest "DynCap: Dynamic Capability Message, IP/Multicast"
+simpletest "DynCapLong: Dynamic Capability Message, IP/Multicast, truncated"
+simpletest "DynCapPadded: Dynamic Capability Message, IP/Multicast, padded"
+simpletest "DynCapMPCpadded: Dynamic Capability Message, IP/Multicast, cap data padded"
+simpletest "DynCapMPCoverflow: Dynamic Capability Message, IP/Multicast, cap data != length"
diff --git a/tests/bgpd.tests/testbgpmpath.exp b/tests/bgpd.tests/testbgpmpath.exp
new file mode 100644
index 00000000..96a51e39
--- /dev/null
+++ b/tests/bgpd.tests/testbgpmpath.exp
@@ -0,0 +1,12 @@
+set timeout 10
+set testprefix "testbgpmpath "
+set aborted 0
+set color 1
+
+spawn "./testbgpmpath"
+
+# proc simpletest { start } {
+
+simpletest "bgp maximum-paths config"
+simpletest "bgp_mp_list"
+simpletest "bgp_info_mpath_update"
diff --git a/tests/bgpd.tests/testbgpmpattr.exp b/tests/bgpd.tests/testbgpmpattr.exp
new file mode 100644
index 00000000..93355ad7
--- /dev/null
+++ b/tests/bgpd.tests/testbgpmpattr.exp
@@ -0,0 +1,31 @@
+set timeout 10
+set testprefix "testbgpmpattr "
+set aborted 0
+set color 1
+
+spawn "./testbgpmpattr"
+
+# proc simpletest { start } {
+
+simpletest_nov6 "IPv6: IPV6 MP Reach, global nexthop, 1 NLRI"
+simpletest_nov6 "IPv6-2: IPV6 MP Reach, global nexthop, 2 NLRIs"
+simpletest_nov6 "IPv6-default: IPV6 MP Reach, global nexthop, 2 NLRIs + default"
+simpletest_nov6 "IPv6-lnh: IPV6 MP Reach, global+local nexthops, 2 NLRIs + default"
+simpletest "IPv6-nhlen: IPV6 MP Reach, inappropriate nexthop length"
+simpletest "IPv6-nhlen2: IPV6 MP Reach, invalid nexthop length"
+simpletest "IPv6-nhlen3: IPV6 MP Reach, nexthop length overflow"
+simpletest "IPv6-nhlen4: IPV6 MP Reach, nexthop length short"
+simpletest "IPv6-nlri: IPV6 MP Reach, NLRI bitlen overflow"
+simpletest "IPv4: IPv4 MP Reach, 2 NLRIs + default"
+simpletest "IPv4-nhlen: IPv4 MP Reach, nexthop lenth overflow"
+simpletest "IPv4-nlrilen: IPv4 MP Reach, nlri lenth overflow"
+simpletest "IPv4-MLVPN: IPv4/MPLS-labeled VPN MP Reach, RD, Nexthop, 3 NLRIs"
+simpletest "IPv6-bug: IPv6, global nexthop, 1 default NLRI"
+simpletest_nov6 "IPv6-unreach: IPV6 MP Unreach, 1 NLRI"
+simpletest_nov6 "IPv6-unreach2: IPV6 MP Unreach, 2 NLRIs"
+simpletest_nov6 "IPv6-unreach-default: IPV6 MP Unreach, 2 NLRIs + default"
+simpletest "IPv6-unreach-nlri: IPV6 MP Unreach, NLRI bitlen overflow"
+simpletest "IPv4-unreach: IPv4 MP Unreach, 2 NLRIs + default"
+simpletest "IPv4-unreach-nlrilen: IPv4 MP Unreach, nlri length overflow"
+simpletest "IPv4-unreach-MLVPN: IPv4/MPLS-labeled VPN MP Unreach, RD, 3 NLRIs"
+
diff --git a/tests/lib/bgpd.exp b/tests/lib/bgpd.exp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/lib/bgpd.exp