Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 1 | From 3a942cfd7d2e92667313e189930f7d1733cf40d4 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 18 Mar 2021 00:59:20 -0700 |
| 4 | Subject: [PATCH 09/10] Prevent running check tests on host if cross compiling |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 5 | |
| 6 | This patch enables running the 'make check' tests on the target |
| 7 | in a cross-compiled environment. If not cross-compiling, then 'make |
| 8 | check' builds and executes the tests; no change from this patch. |
| 9 | In a cross-compiling environment, the make variable CROSS_COMPILE is |
| 10 | set which bypasses assiging tests to the makekfile variable TESTS. |
| 11 | Since TESTS is empty, the 'make check' process never tries to run the |
| 12 | tests on the hosts. On the target, the tests must be run manually. |
| 13 | |
| 14 | Also, in the libutil++ tests, a makefile variable SRCDIR is passed into |
| 15 | the 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 |
| 18 | makefile takes the path of SRCDIR from the build environment and not |
| 19 | from an expression based on the host path 'topdir'. |
| 20 | |
| 21 | Upstream-Status: Pending |
| 22 | |
| 23 | Signed-off-by: Dave Lerner <dave.lerner@windriver.com> |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 24 | Signed-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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 33 | |
| 34 | diff --git a/configure.ac b/configure.ac |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 35 | index 520b18ed..108a84e4 100644 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 36 | --- a/configure.ac |
| 37 | +++ b/configure.ac |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 38 | @@ -386,6 +386,7 @@ AC_ARG_ENABLE(account-check, |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 39 | 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) |
| 46 | diff --git a/libdb/tests/Makefile.am b/libdb/tests/Makefile.am |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 47 | index 8a69003f..c933baf6 100644 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 48 | --- 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 |
| 57 | diff --git a/libop/tests/Makefile.am b/libop/tests/Makefile.am |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 58 | index 8a79eb5d..6b90e997 100644 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 59 | --- 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 |
| 68 | diff --git a/libregex/tests/Makefile.am b/libregex/tests/Makefile.am |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 69 | index 6f19838f..43e84946 100644 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 70 | --- 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 |
| 79 | diff --git a/libutil++/tests/Makefile.am b/libutil++/tests/Makefile.am |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 80 | index 51af0313..dd63fbe2 100644 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 81 | --- 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 |
| 100 | diff --git a/libutil/tests/Makefile.am b/libutil/tests/Makefile.am |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 101 | index dfcd6eca..d8b51892 100644 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 102 | --- 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 Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame] | 111 | -- |
| 112 | 2.31.0 |
| 113 | |