#
# tests
#

#
# *sigh* - there is no way to get CPPFLAGS or CFLAGS for a group of files :(
#

TESTS_CPPFLAGS = $(AM_CPPFLAGS) \
	-I$(top_srcdir)/tests/helpers/c \
	-I$(top_builddir)/tests/helpers/c \
	# end
TESTS_CFLAGS = \
	$(AC_CFLAGS) \
	$(LIBYANG_CFLAGS) \
	$(SAN_FLAGS) \
	# end
# note no -Werror

TESTS_CXXFLAGS = \
	$(AC_CXXFLAGS) \
	$(LIBYANG_CFLAGS) \
	$(SAN_FLAGS) \
	# end
# note no -Werror

ALL_TESTS_LDADD = lib/libfrr.la $(LIBCAP)

EXTRA_DIST += \
	tests/runtests.py \
	tests/helpers/python/frrsix.py \
	tests/helpers/python/frrtest.py \
	# end

check_PROGRAMS =
PYTEST_IGNORE =

.PHONY: tests/tests.xml
tests/tests.xml: $(check_PROGRAMS)
	( cd tests; $(PYTHON) ../$(srcdir)/tests/runtests.py --junitxml=tests.xml -v ../$(srcdir)/tests $(PYTEST_IGNORE); )
check: tests/tests.xml

clean-local: clean-tests
.PHONY: clean-tests
clean-tests:
	-rm -f tests/tests.xml


# CHEAT SHEET:
#
### conditional (if needed) - ONLY for "check_PROGRAMS +=" line!
# if DAEMON
# check_PROGRAMS += tests/daemon/test_foo
# endif
### CFLAGS/CPPFLAGS/LDADD as usual, extend on top of TESTS_XYZFLAGS
# tests_daemon_test_foo_CFLAGS = $(TESTS_CFLAGS)
# tests_daemon_test_foo_CPPFLAGS = $(TESTS_CPPFLAGS)
# tests_daemon_test_foo_LDADD = $(ALL_TESTS_LDADD)
# tests_daemon_test_foo_SOURCES = tests/daemon/test_foo.c
### don't forget "nodist_" for autogenerated source files, & add to CLEANFILES
# nodist_tests_daemon_test_foo_SOURCES = tests/daemon/test_foo_autogen.c
# CLEANFILES += tests/daemon/test_foo_autogen.c
### clippy_scan works normally
# clippy_scan += tests/daemon/test_foo.c
### header files for tests go into "noinst_HEADERS"
# noinst_HEADERS += tests/daemon/foo.h
### all python scripts & auxiliary files are added into EXTRA_DIST
# EXTRA_DIST += tests/daemon/test_foo.py
#

include tests/bgpd/subdir.am
include tests/isisd/subdir.am
include tests/ospfd/subdir.am
include tests/ospf6d/subdir.am
include tests/zebra/subdir.am
include tests/lib/subdir.am
