forked from Mirror/frr
tests: add DejaGNU framework
DejaGNU seems to be the 'standard' GNU test framework (which by itself doesn't say much), but it seems relatively usable and the "remote system" capabilities might come in handy for virtualisation-based tests for kernel interactions or something. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
f2b53dac4c
commit
f281ab9752
|
@ -85,6 +85,7 @@ for cfg in ${CONFIGS:-$defconfigs}; do
|
||||||
cd "$bdir"
|
cd "$bdir"
|
||||||
../sdist/configure $args
|
../sdist/configure $args
|
||||||
make -j5
|
make -j5
|
||||||
|
make check
|
||||||
make DESTDIR="$TEMP/inst_$cfg" install
|
make DESTDIR="$TEMP/inst_$cfg" install
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
|
16
configure.ac
16
configure.ac
|
@ -1619,6 +1619,18 @@ fi
|
||||||
AC_SUBST(PICFLAGS)
|
AC_SUBST(PICFLAGS)
|
||||||
AC_SUBST(PILDFLAGS)
|
AC_SUBST(PILDFLAGS)
|
||||||
|
|
||||||
|
dnl -------
|
||||||
|
dnl DejaGNU
|
||||||
|
dnl -------
|
||||||
|
if test x"$DEJAGNU" = x
|
||||||
|
then
|
||||||
|
DEJAGNU="\$(top_srcdir)/tests/global-conf.exp"
|
||||||
|
fi
|
||||||
|
RUNTESTDEFAULTFLAGS="-x --tool \$\$tool"
|
||||||
|
|
||||||
|
AC_SUBST(DEJAGNU)
|
||||||
|
AC_SUBST(RUNTESTDEFAULTFLAGS)
|
||||||
|
|
||||||
dnl ------------------------------
|
dnl ------------------------------
|
||||||
dnl set paths for state directory
|
dnl set paths for state directory
|
||||||
dnl ------------------------------
|
dnl ------------------------------
|
||||||
|
@ -1691,8 +1703,8 @@ AC_MSG_RESULT($ac_cv_htonl_works)
|
||||||
AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
|
AC_CONFIG_FILES([Makefile lib/Makefile zebra/Makefile ripd/Makefile
|
||||||
ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
|
ripngd/Makefile bgpd/Makefile ospfd/Makefile watchquagga/Makefile
|
||||||
ospf6d/Makefile isisd/Makefile babeld/Makefile vtysh/Makefile
|
ospf6d/Makefile isisd/Makefile babeld/Makefile vtysh/Makefile
|
||||||
doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
|
doc/Makefile ospfclient/Makefile tests/Makefile m4/Makefile
|
||||||
redhat/Makefile
|
redhat/Makefile
|
||||||
pkgsrc/Makefile
|
pkgsrc/Makefile
|
||||||
redhat/quagga.spec
|
redhat/quagga.spec
|
||||||
lib/version.h
|
lib/version.h
|
||||||
|
|
5
tests/.gitignore
vendored
5
tests/.gitignore
vendored
|
@ -10,6 +10,10 @@ TAGS
|
||||||
*.lo
|
*.lo
|
||||||
*.la
|
*.la
|
||||||
*.libs
|
*.libs
|
||||||
|
*.bak
|
||||||
|
*.log
|
||||||
|
*.sum
|
||||||
|
*.xml
|
||||||
.arch-inventory
|
.arch-inventory
|
||||||
.arch-ids
|
.arch-ids
|
||||||
aspathtest
|
aspathtest
|
||||||
|
@ -27,3 +31,4 @@ testmemory
|
||||||
testprivs
|
testprivs
|
||||||
testsig
|
testsig
|
||||||
teststream
|
teststream
|
||||||
|
site.exp
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
|
AUTOMAKE_OPTIONS = dejagnu
|
||||||
|
export DEJAGNU
|
||||||
|
|
||||||
|
SUBDIRS =
|
||||||
|
|
||||||
|
EXTRA_DIST = \
|
||||||
|
config/unix.exp \
|
||||||
|
global-conf.exp
|
||||||
|
|
||||||
|
DEJATOOL =
|
||||||
|
|
||||||
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
|
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
|
||||||
DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\"
|
DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||||
|
|
||||||
|
|
104
tests/config/unix.exp
Normal file
104
tests/config/unix.exp
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
|
||||||
|
# every test should always be run and always return some status.
|
||||||
|
# so, if we lose sync with a multi-test program, aborted will be used
|
||||||
|
# to flag the remainder of the tests as untested.
|
||||||
|
#set aborted 0
|
||||||
|
|
||||||
|
# only match with color codes since "failed" / "OK" might otherwise
|
||||||
|
# be part of the output...
|
||||||
|
#set color 1
|
||||||
|
|
||||||
|
set config_h [open "../config.h" "r"]
|
||||||
|
set config_h_text [read $config_h]
|
||||||
|
close $config_h
|
||||||
|
set i [string first "#define HAVE_IPV6" $config_h_text]
|
||||||
|
if { $i >= 0 } {
|
||||||
|
set have_ipv6 1
|
||||||
|
} else {
|
||||||
|
set have_ipv6 0
|
||||||
|
}
|
||||||
|
send_user "IPv6 enabled: $have_ipv6\n"
|
||||||
|
set xfail 0
|
||||||
|
|
||||||
|
proc onetest { test_name note start } {
|
||||||
|
global aborted
|
||||||
|
global testprefix
|
||||||
|
global verbose
|
||||||
|
global color
|
||||||
|
global xfail
|
||||||
|
|
||||||
|
if { $aborted > 0 } {
|
||||||
|
untested "$testprefix$test_name"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $verbose > 0 } {
|
||||||
|
send_user "$testprefix$test_name$note\n"
|
||||||
|
}
|
||||||
|
expect {
|
||||||
|
"$start" { }
|
||||||
|
|
||||||
|
eof { unresolved "$testprefix$test_name"; set aborted 1; }
|
||||||
|
timeout { unresolved "$testprefix$test_name"; set aborted 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $aborted > 0 } {
|
||||||
|
send_user "sync failed: $testprefix$test_name$note -- $testprefix aborted!\n"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $color } {
|
||||||
|
set pat "(32mOK|31mfailed)"
|
||||||
|
} else {
|
||||||
|
set pat "(OK|failed)"
|
||||||
|
}
|
||||||
|
expect {
|
||||||
|
# need this because otherwise expect will skip over a "failed" and
|
||||||
|
# grab the next "OK" (or the other way around)
|
||||||
|
-re "$pat" {
|
||||||
|
if { "$expect_out(0,string)" == "32mOK" || "$expect_out(0,string)" == "OK" } {
|
||||||
|
pass "$testprefix$test_name"
|
||||||
|
} else {
|
||||||
|
if { $xfail } {
|
||||||
|
xfail "$testprefix$test_name"
|
||||||
|
} else {
|
||||||
|
fail "$testprefix$test_name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
eof { unresolved "$testprefix$test_name"; set aborted 1; }
|
||||||
|
timeout { unresolved "$testprefix$test_name"; set aborted 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if { $aborted > 0 } {
|
||||||
|
send_user "failed: $testprefix$test_name$note -- $testprefix aborted!\n"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc headerline { line } {
|
||||||
|
global aborted
|
||||||
|
if { $aborted > 0 } { return; }
|
||||||
|
expect {
|
||||||
|
$line { return; }
|
||||||
|
eof { send_user "numbering mismatch!\n"; set aborted 1; }
|
||||||
|
timeout { send_user "numbering mismatch!\n"; set aborted 1; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc simpletest { start } {
|
||||||
|
onetest "$start" "" "$start"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc simpletest_nov6 { start } {
|
||||||
|
global have_ipv6
|
||||||
|
global xfail
|
||||||
|
|
||||||
|
set xfail [expr 1-$have_ipv6]
|
||||||
|
onetest "$start" "" "$start"
|
||||||
|
set xfail 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
0
tests/global-conf.exp
Normal file
0
tests/global-conf.exp
Normal file
Loading…
Reference in a new issue