summaryrefslogtreecommitdiffstats
path: root/tests/libzebra.tests/testcommands.exp
diff options
context:
space:
mode:
authorChristian Franke <chris@opensourcerouting.org>2013-09-30 12:27:50 +0000
committerDavid Lamparter <equinox@opensourcerouting.org>2014-04-01 17:38:29 +0200
commit8f399b0e4fff2344d75ebf709e1ce55f15269db2 (patch)
treee9a2384156a90267a846b03c51435618b2427b1c /tests/libzebra.tests/testcommands.exp
parent2b00515a9b639fd1e057f3ebf10ded2dde920764 (diff)
downloadquagga-8f399b0e4fff2344d75ebf709e1ce55f15269db2.tar.bz2
quagga-8f399b0e4fff2344d75ebf709e1ce55f15269db2.tar.xz
tests: add a test program for lib/command.c
Signed-off-by: Christian Franke <chris@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tests/libzebra.tests/testcommands.exp')
-rw-r--r--tests/libzebra.tests/testcommands.exp23
1 files changed, 23 insertions, 0 deletions
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"
+}