aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorStanislaw Kardach <skardach@marvell.com>2020-06-03 10:03:53 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2020-09-11 14:21:10 +0300
commit75b0ae3867ed9462abe8d0d3718518514c366c1c (patch)
tree7b96f17ac4cccc5830371a6bf68cb2c118868d0d /helper
parentb5dea97bbf5a4bbf70e500cfcf2764d3ec1bfddb (diff)
build: simplify remote target testing
It is often beneficial to run "make check" on a remote target platform. However in order to run it, a full build-system has to be present which may not be efficient or possible for embedded platforms. Alternatively autotools offer a mechanism which may be used: LOG_COMPILER environment variable. If specified, all test invocations are prepended with its contents. This allows injecting a wrapper script which will ensure the test is run remotely (i.e. through ssh). Prior to that the binaries have to be transported to the remote system. This cannot be done in the script itself as it has no knowledge on the dependencies of the test program, only its path. Test could be relying on some files stored in srcdir or builddir. An issue exists that if ODP is built in out-of-tree method (builddir != srcdir), only the compiled test programs are copied to the builddir. scripts and script data files remain in srcdir and wrapper script is called with an absolute path to the script located in srcdir. This would require to copy the srcdir to exactly the same path on the target as on build host. This may alias with some paths already there. To prevent this from happening add make target wrappers which copy scripts and script data to build directory which allows the autotools test harness to produce a proper wrapper script invocation with a relative path and allows to only copy the builddir to the target to a strictly controlled location. Signed-off-by: Stanislaw Kardach <skardach@marvell.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r--helper/test/Makefile.am20
1 files changed, 20 insertions, 0 deletions
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am
index b030ddf4a..6e5229fbb 100644
--- a/helper/test/Makefile.am
+++ b/helper/test/Makefile.am
@@ -40,3 +40,23 @@ table_SOURCES = table.c
iplookuptable_SOURCES = iplookuptable.c
version_SOURCES = version.c
debug_SOURCES = debug.c
+
+# If building out-of-tree, make check will not copy the scripts and data to the
+# $(builddir) assuming that all commands are run locally. However this prevents
+# running tests on a remote target using LOG_COMPILER.
+# So copy all script and data files explicitly here.
+all-local:
+ if [ "x$(srcdir)" != "x$(builddir)" ]; then \
+ for f in $(dist_check_SCRIPTS); do \
+ if [ -e $(srcdir)/$$f ]; then \
+ mkdir -p $(builddir)/$$(dirname $$f); \
+ cp $(srcdir)/$$f $(builddir)/$$f; \
+ fi \
+ done \
+ fi
+clean-local:
+ if [ "x$(srcdir)" != "x$(builddir)" ]; then \
+ for f in $(dist_check_SCRIPTS); do \
+ rm -f $(builddir)/$$f; \
+ done \
+ fi