tests: put lua scripting unit tests behind flag

Signed-off-by: Donald Lee <dlqs@gmx.com>
This commit is contained in:
Donald Lee 2021-06-23 00:31:02 +08:00
parent 4b827e08a1
commit 555f7625a8
4 changed files with 44 additions and 12 deletions

View File

@ -289,6 +289,8 @@ if test "$enable_clang_coverage" = "yes"; then
])
fi
AM_CONDITIONAL([SCRIPTING], [test "$enable_scripting" = "yes"])
if test "$enable_scripting" = "yes"; then
AX_PROG_LUA([5.3], [5.4], [], [
AC_MSG_ERROR([Lua 5.3 is required to build with Lua support. No other version is supported.])
@ -299,7 +301,9 @@ if test "$enable_scripting" = "yes"; then
AX_LUA_LIBS([
AC_DEFINE([HAVE_SCRIPTING], [1], [Have support for scripting])
LIBS="$LIBS $LUA_LIB"
SCRIPTING=true
], [
SCRIPTING=false
AC_MSG_ERROR([Lua 5.3 libraries are required to build with Lua support. No other version is supported.])
])
fi

View File

@ -1,8 +1,14 @@
import frrtest
import pytest
if 'S["SCRIPTING_TRUE"]=""\n' not in open("../config.status").readlines():
class TestFrrlua:
@pytest.mark.skipif(True, reason="Test unsupported")
def test_exit_cleanly(self):
pass
else:
class TestFrrlua(frrtest.TestMultiOut):
program = "./test_frrlua"
class TestFrrlua(frrtest.TestMultiOut):
program = "./test_frrlua"
TestFrrlua.exit_cleanly()
TestFrrlua.exit_cleanly()

View File

@ -1,8 +1,14 @@
import frrtest
import pytest
if 'S["SCRIPTING_TRUE"]=""\n' not in open("../config.status").readlines():
class TestFrrscript:
@pytest.mark.skipif(True, reason="Test unsupported")
def test_exit_cleanly(self):
pass
else:
class TestFrrscript(frrtest.TestMultiOut):
program = "./test_frrscript"
class TestFrrscript(frrtest.TestMultiOut):
program = "./test_frrscript"
TestFrrscript.exit_cleanly()
TestFrrscript.exit_cleanly()

View File

@ -59,6 +59,15 @@ TESTS_ZEBRA =
IGNORE_ZEBRA = --ignore=zebra/
endif
if SCRIPTING
TESTS_SCRIPTING = \
tests/lib/test_frrlua \
tests/lib/test_frrscript \
#end
else
TESTS_SCRIPTING =
endif
clippy_scan += \
tests/lib/cli/test_cli.c \
tests/ospf6d/test_lsdb.c \
@ -70,8 +79,6 @@ check_PROGRAMS = \
tests/lib/test_atomlist \
tests/lib/test_buffer \
tests/lib/test_checksum \
tests/lib/test_frrlua \
tests/lib/test_frrscript \
tests/lib/test_heavy_thread \
tests/lib/test_heavy_wq \
tests/lib/test_heavy \
@ -106,6 +113,7 @@ check_PROGRAMS = \
$(TESTS_OSPFD) \
$(TESTS_OSPF6D) \
$(TESTS_ZEBRA) \
$(TESTS_SCRIPTING) \
# end
if GRPC
@ -291,6 +299,7 @@ tests_lib_test_checksum_CFLAGS = $(TESTS_CFLAGS)
tests_lib_test_checksum_CPPFLAGS = $(TESTS_CPPFLAGS)
tests_lib_test_checksum_LDADD = $(ALL_TESTS_LDADD)
tests_lib_test_checksum_SOURCES = tests/lib/test_checksum.c
if SCRIPTING
tests_lib_test_frrlua_CFLAGS = $(TESTS_CFLAGS)
tests_lib_test_frrlua_CPPFLAGS = $(TESTS_CPPFLAGS)
tests_lib_test_frrlua_LDADD = $(ALL_TESTS_LDADD)
@ -299,6 +308,7 @@ tests_lib_test_frrscript_CFLAGS = $(TESTS_CFLAGS)
tests_lib_test_frrscript_CPPFLAGS = $(TESTS_CPPFLAGS)
tests_lib_test_frrscript_LDADD = $(ALL_TESTS_LDADD)
tests_lib_test_frrscript_SOURCES = tests/lib/test_frrscript.c
endif
tests_lib_test_graph_CFLAGS = $(TESTS_CFLAGS)
tests_lib_test_graph_CPPFLAGS = $(TESTS_CPPFLAGS)
tests_lib_test_graph_LDADD = $(ALL_TESTS_LDADD)
@ -448,8 +458,6 @@ EXTRA_DIST += \
tests/lib/northbound/test_oper_data.refout \
tests/lib/test_assert.py \
tests/lib/test_atomlist.py \
tests/lib/test_frrscript.py \
tests/lib/test_frrlua.py \
tests/lib/test_nexthop_iter.py \
tests/lib/test_nexthop.py \
tests/lib/test_ntop.py \
@ -476,6 +484,14 @@ EXTRA_DIST += \
tests/zebra/test_lm_plugin.refout \
# end
if SCRIPTING
EXTRA_DIST += \
tests/lib/test_frrscript.py \
tests/lib/test_frrlua.py \
#end
endif
.PHONY: tests/tests.xml
tests/tests.xml: $(check_PROGRAMS)
( cd tests; $(PYTHON) ../$(srcdir)/tests/runtests.py --junitxml=tests.xml -v ../$(srcdir)/tests $(IGNORE_BGPD) $(IGNORE_ISISD) $(IGNORE_OSPF6D); )