Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Prevent running check tests on host if cross compiling |
| 2 | |
| 3 | This patch enables running the 'make check' tests on the target |
| 4 | in a cross-compiled environment. If not cross-compiling, then 'make |
| 5 | check' builds and executes the tests; no change from this patch. |
| 6 | In a cross-compiling environment, the make variable CROSS_COMPILE is |
| 7 | set which bypasses assiging tests to the makekfile variable TESTS. |
| 8 | Since TESTS is empty, the 'make check' process never tries to run the |
| 9 | tests on the hosts. On the target, the tests must be run manually. |
| 10 | |
| 11 | Also, in the libutil++ tests, a makefile variable SRCDIR is passed into |
| 12 | the compilation phase, pointing to the runtime location of the test |
| 13 | 'file-manip-tests'. The mechanism used for a host test, based on |
| 14 | 'topdir' doesn't work. Instead, if CROSS_COMPILE is set, the |
| 15 | makefile takes the path of SRCDIR from the build environment and not |
| 16 | from an expression based on the host path 'topdir'. |
| 17 | |
| 18 | Upstream-Status: Pending |
| 19 | |
| 20 | Signed-off-by: Dave Lerner <dave.lerner@windriver.com> |
| 21 | |
| 22 | diff --git a/configure.ac b/configure.ac |
| 23 | index 41ece64..ce5a16f 100644 |
| 24 | --- a/configure.ac |
| 25 | +++ b/configure.ac |
| 26 | @@ -392,6 +392,7 @@ AC_ARG_ENABLE(account-check, |
| 27 | enable_account_check=$enableval, enable_account_check=yes) |
| 28 | |
| 29 | AM_CONDITIONAL(CHECK_ACCOUNT, test "x$enable_account_check" = "xyes") |
| 30 | +AM_CONDITIONAL(CROSS_COMPILE, test "x$cross_compiling" = "xyes") |
| 31 | |
| 32 | AC_SUBST(OP_CFLAGS) |
| 33 | AC_SUBST(OP_CXXFLAGS) |
| 34 | diff --git a/libdb/tests/Makefile.am b/libdb/tests/Makefile.am |
| 35 | index 8a69003..d820090 100644 |
| 36 | --- a/libdb/tests/Makefile.am |
| 37 | +++ b/libdb/tests/Makefile.am |
| 38 | @@ -13,4 +13,6 @@ check_PROGRAMS = db_test |
| 39 | db_test_SOURCES = db_test.c |
| 40 | db_test_LDADD = ../libodb.a ../../libutil/libutil.a |
| 41 | |
| 42 | +if ! CROSS_COMPILE |
| 43 | TESTS = ${check_PROGRAMS} |
| 44 | +endif |
| 45 | diff --git a/libop/tests/Makefile.am b/libop/tests/Makefile.am |
| 46 | index 8a79eb5..6d417c4 100644 |
| 47 | --- a/libop/tests/Makefile.am |
| 48 | +++ b/libop/tests/Makefile.am |
| 49 | @@ -33,4 +33,6 @@ load_events_files_tests_LDADD = ${COMMON_LIBS} |
| 50 | mangle_tests_SOURCES = mangle_tests.c |
| 51 | mangle_tests_LDADD = ${COMMON_LIBS} |
| 52 | |
| 53 | +if ! CROSS_COMPILE |
| 54 | TESTS = ${check_PROGRAMS} utf8_checker.sh |
| 55 | +endif |
| 56 | diff --git a/libregex/tests/Makefile.am b/libregex/tests/Makefile.am |
| 57 | index 6f19838..1d176f9 100644 |
| 58 | --- a/libregex/tests/Makefile.am |
| 59 | +++ b/libregex/tests/Makefile.am |
| 60 | @@ -18,4 +18,6 @@ java_test_LDADD = \ |
| 61 | |
| 62 | EXTRA_DIST = mangled-name.in |
| 63 | |
| 64 | +if ! CROSS_COMPILE |
| 65 | TESTS = ${check_PROGRAMS} |
| 66 | +endif |
| 67 | diff --git a/libutil++/tests/Makefile.am b/libutil++/tests/Makefile.am |
| 68 | index 51af031..a01ea2d 100644 |
| 69 | --- a/libutil++/tests/Makefile.am |
| 70 | +++ b/libutil++/tests/Makefile.am |
| 71 | @@ -1,7 +1,9 @@ |
| 72 | |
| 73 | REALPATH= readlink -f |
| 74 | |
| 75 | +if ! CROSS_COMPILE |
| 76 | SRCDIR := $(shell $(REALPATH) $(topdir)/libutil++/tests/ ) |
| 77 | +endif |
| 78 | |
| 79 | AM_CPPFLAGS = \ |
| 80 | -I ${top_srcdir}/libutil++ -D SRCDIR="\"$(SRCDIR)/\"" @OP_CPPFLAGS@ |
| 81 | @@ -46,4 +48,6 @@ cached_value_tests_LDADD = ${COMMON_LIBS} |
| 82 | utility_tests_SOURCES = utility_tests.cpp |
| 83 | utility_tests_LDADD = ${COMMON_LIBS} |
| 84 | |
| 85 | +if ! CROSS_COMPILE |
| 86 | TESTS = ${check_PROGRAMS} |
| 87 | +endif |
| 88 | diff --git a/libutil/tests/Makefile.am b/libutil/tests/Makefile.am |
| 89 | index dfcd6ec..e8831b5 100644 |
| 90 | --- a/libutil/tests/Makefile.am |
| 91 | +++ b/libutil/tests/Makefile.am |
| 92 | @@ -12,4 +12,6 @@ file_tests_LDADD = ../libutil.a |
| 93 | string_tests_SOURCES = string_tests.c |
| 94 | string_tests_LDADD = ../libutil.a |
| 95 | |
| 96 | +if ! CROSS_COMPILE |
| 97 | TESTS = ${check_PROGRAMS} |
| 98 | +endif |