From 5b2ee104c2c660f29d5e59097ebce9fe95529b14 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Mon, 8 May 2023 18:38:40 +0200 Subject: [PATCH] tests: Fix out of tree build for lua scripting test_frrscript is run from the `tests` directory and expects the sample lua script `script1.lua` to be present in the `lib` directory. When the package is built out of tree (which always happens when a debian package is built), and scripting is enabled, test fails because the lua file is not present in the `tests/lib/` subdir of the _build_ directory. Fix this by adding `script1.lua` as an extra dependency for `test_frrscript`, and a recipe that copies the file from the source tree to the build tree (note: it needs to be marked ".PHONY" because otherwise `make` thinks that it already exists, in the source tree). After this commit, the following command starts to work: dpkg-buildpackage --build-profiles=pkg.frr.lua -b -uc Signed-off-by: Eugene Crosser --- tests/lib/subdir.am | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/lib/subdir.am b/tests/lib/subdir.am index e950d0120d..c3a1a3e2c0 100644 --- a/tests/lib/subdir.am +++ b/tests/lib/subdir.am @@ -15,8 +15,14 @@ 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 +EXTRA_tests_lib_test_frrscript_DEPENDENCIES = copy_script EXTRA_DIST += tests/lib/test_frrscript.py tests/lib/script1.lua +# For out-of-tree build, lua script needs to be in the build dir, rather than +# just available somewhere in the VPATH +copy_script: tests/lib/script1.lua + test -e tests/lib/script1.lua || \ + $(INSTALL_SCRIPT) $< tests/lib/script1.lua ############################################################################## GRPC_TESTS_LDADD = staticd/libstatic.a grpc/libfrrgrpc_pb.la -lgrpc++ -lprotobuf $(ALL_TESTS_LDADD) $(LIBYANG_LIBS) -lm