blob: e47882c9f3b88ab6c5298039addca83491d37dfb [file] [log] [blame]
Andrew Geissler32b11992021-03-31 13:37:05 -05001From 3a942cfd7d2e92667313e189930f7d1733cf40d4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 18 Mar 2021 00:59:20 -0700
4Subject: [PATCH 09/10] Prevent running check tests on host if cross compiling
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005
6This patch enables running the 'make check' tests on the target
7in a cross-compiled environment. If not cross-compiling, then 'make
8 check' builds and executes the tests; no change from this patch.
9In a cross-compiling environment, the make variable CROSS_COMPILE is
10set which bypasses assiging tests to the makekfile variable TESTS.
11Since TESTS is empty, the 'make check' process never tries to run the
12tests on the hosts. On the target, the tests must be run manually.
13
14Also, in the libutil++ tests, a makefile variable SRCDIR is passed into
15the compilation phase, pointing to the runtime location of the test
16'file-manip-tests'. The mechanism used for a host test, based on
17'topdir' doesn't work. Instead, if CROSS_COMPILE is set, the
18makefile takes the path of SRCDIR from the build environment and not
19from an expression based on the host path 'topdir'.
20
21Upstream-Status: Pending
22
23Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Andrew Geissler32b11992021-03-31 13:37:05 -050024Signed-off-by: Khem Raj <raj.khem@gmail.com>
25---
26 configure.ac | 1 +
27 libdb/tests/Makefile.am | 2 ++
28 libop/tests/Makefile.am | 2 ++
29 libregex/tests/Makefile.am | 2 ++
30 libutil++/tests/Makefile.am | 4 ++++
31 libutil/tests/Makefile.am | 2 ++
32 6 files changed, 13 insertions(+)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033
34diff --git a/configure.ac b/configure.ac
Andrew Geissler32b11992021-03-31 13:37:05 -050035index 520b18ed..108a84e4 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050036--- a/configure.ac
37+++ b/configure.ac
Andrew Geissler32b11992021-03-31 13:37:05 -050038@@ -386,6 +386,7 @@ AC_ARG_ENABLE(account-check,
Brad Bishopd7bf8c12018-02-25 22:55:05 -050039 enable_account_check=$enableval, enable_account_check=yes)
40
41 AM_CONDITIONAL(CHECK_ACCOUNT, test "x$enable_account_check" = "xyes")
42+AM_CONDITIONAL(CROSS_COMPILE, test "x$cross_compiling" = "xyes")
43
44 AC_SUBST(OP_CFLAGS)
45 AC_SUBST(OP_CXXFLAGS)
46diff --git a/libdb/tests/Makefile.am b/libdb/tests/Makefile.am
Andrew Geissler32b11992021-03-31 13:37:05 -050047index 8a69003f..c933baf6 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048--- a/libdb/tests/Makefile.am
49+++ b/libdb/tests/Makefile.am
50@@ -13,4 +13,6 @@ check_PROGRAMS = db_test
51 db_test_SOURCES = db_test.c
52 db_test_LDADD = ../libodb.a ../../libutil/libutil.a
53
54+if ! CROSS_COMPILE
55 TESTS = ${check_PROGRAMS}
56+endif
57diff --git a/libop/tests/Makefile.am b/libop/tests/Makefile.am
Andrew Geissler32b11992021-03-31 13:37:05 -050058index 8a79eb5d..6b90e997 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050059--- a/libop/tests/Makefile.am
60+++ b/libop/tests/Makefile.am
61@@ -33,4 +33,6 @@ load_events_files_tests_LDADD = ${COMMON_LIBS}
62 mangle_tests_SOURCES = mangle_tests.c
63 mangle_tests_LDADD = ${COMMON_LIBS}
64
65+if ! CROSS_COMPILE
66 TESTS = ${check_PROGRAMS} utf8_checker.sh
67+endif
68diff --git a/libregex/tests/Makefile.am b/libregex/tests/Makefile.am
Andrew Geissler32b11992021-03-31 13:37:05 -050069index 6f19838f..43e84946 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050070--- a/libregex/tests/Makefile.am
71+++ b/libregex/tests/Makefile.am
72@@ -18,4 +18,6 @@ java_test_LDADD = \
73
74 EXTRA_DIST = mangled-name.in
75
76+if ! CROSS_COMPILE
77 TESTS = ${check_PROGRAMS}
78+endif
79diff --git a/libutil++/tests/Makefile.am b/libutil++/tests/Makefile.am
Andrew Geissler32b11992021-03-31 13:37:05 -050080index 51af0313..dd63fbe2 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050081--- a/libutil++/tests/Makefile.am
82+++ b/libutil++/tests/Makefile.am
83@@ -1,7 +1,9 @@
84
85 REALPATH= readlink -f
86
87+if ! CROSS_COMPILE
88 SRCDIR := $(shell $(REALPATH) $(topdir)/libutil++/tests/ )
89+endif
90
91 AM_CPPFLAGS = \
92 -I ${top_srcdir}/libutil++ -D SRCDIR="\"$(SRCDIR)/\"" @OP_CPPFLAGS@
93@@ -46,4 +48,6 @@ cached_value_tests_LDADD = ${COMMON_LIBS}
94 utility_tests_SOURCES = utility_tests.cpp
95 utility_tests_LDADD = ${COMMON_LIBS}
96
97+if ! CROSS_COMPILE
98 TESTS = ${check_PROGRAMS}
99+endif
100diff --git a/libutil/tests/Makefile.am b/libutil/tests/Makefile.am
Andrew Geissler32b11992021-03-31 13:37:05 -0500101index dfcd6eca..d8b51892 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500102--- a/libutil/tests/Makefile.am
103+++ b/libutil/tests/Makefile.am
104@@ -12,4 +12,6 @@ file_tests_LDADD = ../libutil.a
105 string_tests_SOURCES = string_tests.c
106 string_tests_LDADD = ../libutil.a
107
108+if ! CROSS_COMPILE
109 TESTS = ${check_PROGRAMS}
110+endif
Andrew Geissler32b11992021-03-31 13:37:05 -0500111--
1122.31.0
113