summaryrefslogtreecommitdiff
path: root/tests/libzebra.tests
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2013-11-15 19:23:33 +0100
committerChristian Franke <chris@opensourcerouting.org>2014-01-08 00:49:41 +0100
commitd30eb038466ae3d14862df08bf58ee80c00bf311 (patch)
treee91b4a26fdcefae87e0c1c26d63331ef95bae747 /tests/libzebra.tests
parent54bd777005ffd9851b6fe07de78ab728f4b0f4cc (diff)
tests: add a test program for lib/command.c
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Diffstat (limited to 'tests/libzebra.tests')
-rw-r--r--tests/libzebra.tests/Makefile.am1
-rw-r--r--tests/libzebra.tests/testcommands.exp23
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/libzebra.tests/Makefile.am b/tests/libzebra.tests/Makefile.am
index 14138a08..a1ffea3d 100644
--- a/tests/libzebra.tests/Makefile.am
+++ b/tests/libzebra.tests/Makefile.am
@@ -1,3 +1,4 @@
EXTRA_DIST = \
tabletest.exp \
+ testcommands.exp \
testnexthopiter.exp
diff --git a/tests/libzebra.tests/testcommands.exp b/tests/libzebra.tests/testcommands.exp
new file mode 100644
index 00000000..f760c6d7
--- /dev/null
+++ b/tests/libzebra.tests/testcommands.exp
@@ -0,0 +1,23 @@
+set timeout 30
+set test_name "testcommands"
+
+spawn sh -c "./testcommands -e 0 < testcommands.in | diff -au - testcommands.out"
+
+expect {
+ eof {
+ }
+ timeout {
+ exp_close
+ fail "$test_name: timeout"
+ }
+}
+
+catch wait result
+set os_error [lindex $result 2]
+set exit_status [lindex $result 3]
+
+if { $os_error == 0 && $exit_status == 0 } {
+ pass "$test_name"
+} else {
+ fail "$test_name"
+}