summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2013-01-24 01:39:14 +0100
committerDavid Lamparter <equinox@diac24.net>2013-04-14 16:01:19 +0200
commitc69905b673812ce6ec2a12960727a27b9b8d6426 (patch)
tree2b7608b8d16bedfafbf734d5a0e8ff26646107f1 /tests
parenttests: DejaGNU bgpd (diff)
downloadfrr-c69905b673812ce6ec2a12960727a27b9b8d6426.tar.xz
frr-c69905b673812ce6ec2a12960727a27b9b8d6426.zip
tests: DejaGNU libzebra
Wrap the few libzebra test programs we have up for DejaGNU. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/config/unix.exp18
-rw-r--r--tests/lib/libzebra.exp0
-rw-r--r--tests/libzebra.tests/Makefile.am2
-rw-r--r--tests/libzebra.tests/tabletest.exp9
-rw-r--r--tests/libzebra.tests/teststream.exp28
6 files changed, 62 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 153922b9f..93c06b031 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,12 +1,15 @@
AUTOMAKE_OPTIONS = dejagnu
export DEJAGNU
-DEJATOOL =
+DEJATOOL = libzebra
-SUBDIRS = bgpd.tests
+SUBDIRS = \
+ bgpd.tests \
+ libzebra.tests
EXTRA_DIST = \
config/unix.exp \
lib/bgpd.exp \
+ lib/libzebra.exp \
global-conf.exp
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
diff --git a/tests/config/unix.exp b/tests/config/unix.exp
index 25ea97f4c..b41f072cc 100644
--- a/tests/config/unix.exp
+++ b/tests/config/unix.exp
@@ -20,6 +20,24 @@ if { $i >= 0 } {
send_user "IPv6 enabled: $have_ipv6\n"
set xfail 0
+proc onesimple { test_name match } {
+ global verbose
+ global aborted
+ global testprefix
+ if { $aborted > 0 } {
+ untested "$testprefix$test_name"
+ return
+ }
+ if { $verbose > 0 } {
+ send_user "$testprefix$test_name$note\n"
+ }
+ expect {
+ "$match" { pass "$testprefix$test_name"; }
+ eof { fail "$testprefix$test_name"; set aborted 1; }
+ timeout { unresolved "$testprefix$test_name"; set aborted 1; }
+ }
+}
+
proc onetest { test_name note start } {
global aborted
global testprefix
diff --git a/tests/lib/libzebra.exp b/tests/lib/libzebra.exp
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/lib/libzebra.exp
diff --git a/tests/libzebra.tests/Makefile.am b/tests/libzebra.tests/Makefile.am
new file mode 100644
index 000000000..0d29e287c
--- /dev/null
+++ b/tests/libzebra.tests/Makefile.am
@@ -0,0 +1,2 @@
+EXTRA_DIST = \
+ tabletest.exp
diff --git a/tests/libzebra.tests/tabletest.exp b/tests/libzebra.tests/tabletest.exp
new file mode 100644
index 000000000..5838d4fc7
--- /dev/null
+++ b/tests/libzebra.tests/tabletest.exp
@@ -0,0 +1,9 @@
+set timeout 10
+set testprefix "tabletest "
+set aborted 0
+
+spawn "./tabletest"
+
+for {set i 0} {$i < 6} {incr i 1} { onesimple "cmp $i" "Verifying cmp"; }
+for {set i 0} {$i < 11} {incr i 1} { onesimple "succ $i" "Verifying successor"; }
+onesimple "pause" "Verified pausing"
diff --git a/tests/libzebra.tests/teststream.exp b/tests/libzebra.tests/teststream.exp
new file mode 100644
index 000000000..ca602e305
--- /dev/null
+++ b/tests/libzebra.tests/teststream.exp
@@ -0,0 +1,28 @@
+set timeout 10
+spawn "./teststream"
+
+expect {
+ "endp: 15, readable: 15, writeable: 1009" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+expect {
+ "0xef 0xbe 0xef 0xde 0xad 0xbe 0xef 0xde 0xad 0xbe 0xef 0xde 0xad 0xbe 0xef" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+expect {
+ "endp: 15, readable: 15, writeable: 0" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+expect {
+ "0xef 0xbe 0xef 0xde 0xad 0xbe 0xef 0xde 0xad 0xbe 0xef 0xde 0xad 0xbe 0xef" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+expect {
+ "c: 0xef" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+expect {
+ "w: 0xbeef" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+expect {
+ "l: 0xdeadbeef" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+expect {
+ "q: 0xdeadbeefdeadbeef" { }
+ eof { fail "teststream"; exit; } timeout { fail "teststream"; exit; } }
+pass "teststream"