aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-01-03 02:39:59 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-01-06 18:47:33 +0100
commitcd312bb82c8693ffeb9b143e5361567657a7cede (patch)
tree39b6e764593576f1a8631e1f8a8eb459af4e1847
parent11a7b775f53e5cdcc845e3746945e2910f78f202 (diff)
downloadblogc-cd312bb82c8693ffeb9b143e5361567657a7cede.tar.gz
blogc-cd312bb82c8693ffeb9b143e5361567657a7cede.tar.bz2
blogc-cd312bb82c8693ffeb9b143e5361567657a7cede.zip
build: travis: fix osx support
This commit fixes builds of blogc and helper tools on osx, and enables travis tests on it. This also includes some general improvements for travis, and disable tests that require mocked functions if the linker does not supports `-wrap` ldflag
-rw-r--r--.travis.yml22
-rw-r--r--.travis/targets/distcheck.sh1
-rw-r--r--Makefile.am105
-rw-r--r--configure.ac17
4 files changed, 81 insertions, 64 deletions
diff --git a/.travis.yml b/.travis.yml
index c148698..80136d3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
-dist: trusty
sudo: required
language: c
+compiler: gcc
addons:
apt:
@@ -11,10 +11,6 @@ addons:
- rpm
- valgrind
-compiler:
- - clang
- - gcc
-
env:
- TARGET=valgrind
- TARGET=distcheck
@@ -25,23 +21,23 @@ env:
- TARGET=win64
matrix:
- exclude:
- - compiler: clang
- env: TARGET=dist-srpm
- - compiler: clang
- env: TARGET=github-lambda
+ include:
- compiler: clang
- env: TARGET=make-embedded
+ env: TARGET=valgrind
- compiler: clang
- env: TARGET=win32
+ env: TARGET=distcheck
- compiler: clang
- env: TARGET=win64
+ env: TARGET=distcheck
+ os: osx
install: gem install ronn
before_script:
- git fetch --unshallow
- ./autogen.sh
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install cmocka; fi
+ - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install xz; fi
script:
- ./.travis/build.sh
diff --git a/.travis/targets/distcheck.sh b/.travis/targets/distcheck.sh
index 06a0ba3..104893b 100644
--- a/.travis/targets/distcheck.sh
+++ b/.travis/targets/distcheck.sh
@@ -5,7 +5,6 @@ build() {
--disable-silent-rules \
--enable-ronn \
--enable-tests \
- --enable-valgrind \
--enable-git-receiver \
--enable-make \
--enable-runserver
diff --git a/Makefile.am b/Makefile.am
index 8cd56e5..2937817 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -452,17 +452,21 @@ if USE_CMOCKA
check_PROGRAMS += \
tests/blogc/check_content_parser \
tests/blogc/check_datetime_parser \
- tests/blogc/check_loader \
tests/blogc/check_renderer \
tests/blogc/check_source_parser \
tests/blogc/check_template_parser \
tests/common/check_config_parser \
tests/common/check_error \
- tests/common/check_stdin \
tests/common/check_utf8 \
tests/common/check_utils \
$(NULL)
+if USE_LD_WRAP
+check_PROGRAMS += \
+ tests/blogc/check_loader \
+ tests/common/check_stdin \
+ $(NULL)
+
tests_blogc_check_loader_SOURCES = \
tests/blogc/check_loader.c \
$(NULL)
@@ -482,6 +486,25 @@ tests_blogc_check_loader_LDADD = \
libblogc_common.la \
$(NULL)
+tests_common_check_stdin_SOURCES = \
+ tests/common/check_stdin.c \
+ $(NULL)
+
+tests_common_check_stdin_CFLAGS = \
+ $(CMOCKA_CFLAGS) \
+ $(NULL)
+
+tests_common_check_stdin_LDFLAGS = \
+ -no-install \
+ -Wl,--wrap=fgetc \
+ $(NULL)
+
+tests_common_check_stdin_LDADD = \
+ $(CMOCKA_LIBS) \
+ libblogc_common.la \
+ $(NULL)
+endif
+
tests_blogc_check_content_parser_SOURCES = \
tests/blogc/check_content_parser.c \
$(NULL)
@@ -606,24 +629,6 @@ tests_common_check_error_LDADD = \
libblogc_common.la \
$(NULL)
-tests_common_check_stdin_SOURCES = \
- tests/common/check_stdin.c \
- $(NULL)
-
-tests_common_check_stdin_CFLAGS = \
- $(CMOCKA_CFLAGS) \
- $(NULL)
-
-tests_common_check_stdin_LDFLAGS = \
- -no-install \
- -Wl,--wrap=fgetc \
- $(NULL)
-
-tests_common_check_stdin_LDADD = \
- $(CMOCKA_LIBS) \
- libblogc_common.la \
- $(NULL)
-
tests_common_check_utf8_SOURCES = \
tests/common/check_utf8.c \
$(NULL)
@@ -659,6 +664,7 @@ tests_common_check_utils_LDADD = \
$(NULL)
if BUILD_RUNSERVER
+if USE_LD_WRAP
check_PROGRAMS += \
tests/blogc-runserver/check_httpd_utils \
tests/blogc-runserver/check_mime \
@@ -702,46 +708,52 @@ tests_blogc_runserver_check_mime_LDADD = \
libblogc_common.la \
$(NULL)
endif
+endif
if BUILD_GIT_RECEIVER
check_PROGRAMS += \
tests/blogc-git-receiver/check_pre_receive_parser \
- tests/blogc-git-receiver/check_post_receive \
tests/blogc-git-receiver/check_shell_command_parser \
$(NULL)
-tests_blogc_git_receiver_check_pre_receive_parser_SOURCES = \
- tests/blogc-git-receiver/check_pre_receive_parser.c \
+if USE_LD_WRAP
+check_PROGRAMS += \
+ tests/blogc-git-receiver/check_post_receive \
$(NULL)
-tests_blogc_git_receiver_check_pre_receive_parser_CFLAGS = \
+tests_blogc_git_receiver_check_post_receive_SOURCES = \
+ tests/blogc-git-receiver/check_post_receive.c \
+ $(NULL)
+
+tests_blogc_git_receiver_check_post_receive_CFLAGS = \
$(CMOCKA_CFLAGS) \
$(NULL)
-tests_blogc_git_receiver_check_pre_receive_parser_LDFLAGS = \
+tests_blogc_git_receiver_check_post_receive_LDFLAGS = \
-no-install \
+ -Wl,--wrap=realpath \
$(NULL)
-tests_blogc_git_receiver_check_pre_receive_parser_LDADD = \
+tests_blogc_git_receiver_check_post_receive_LDADD = \
$(CMOCKA_LIBS) \
libblogc_git_receiver.la \
libblogc_common.la \
$(NULL)
+endif
-tests_blogc_git_receiver_check_post_receive_SOURCES = \
- tests/blogc-git-receiver/check_post_receive.c \
+tests_blogc_git_receiver_check_pre_receive_parser_SOURCES = \
+ tests/blogc-git-receiver/check_pre_receive_parser.c \
$(NULL)
-tests_blogc_git_receiver_check_post_receive_CFLAGS = \
+tests_blogc_git_receiver_check_pre_receive_parser_CFLAGS = \
$(CMOCKA_CFLAGS) \
$(NULL)
-tests_blogc_git_receiver_check_post_receive_LDFLAGS = \
+tests_blogc_git_receiver_check_pre_receive_parser_LDFLAGS = \
-no-install \
- -Wl,--wrap=realpath \
$(NULL)
-tests_blogc_git_receiver_check_post_receive_LDADD = \
+tests_blogc_git_receiver_check_pre_receive_parser_LDADD = \
$(CMOCKA_LIBS) \
libblogc_git_receiver.la \
libblogc_common.la \
@@ -769,43 +781,48 @@ endif
if BUILD_MAKE_LIB
check_PROGRAMS += \
tests/blogc-make/check_atom \
- tests/blogc-make/check_exec \
tests/blogc-make/check_rules \
tests/blogc-make/check_settings \
$(NULL)
-tests_blogc_make_check_atom_SOURCES = \
- tests/blogc-make/check_atom.c \
+if USE_LD_WRAP
+check_PROGRAMS += \
+ tests/blogc-make/check_exec \
$(NULL)
-tests_blogc_make_check_atom_CFLAGS = \
+tests_blogc_make_check_exec_SOURCES = \
+ tests/blogc-make/check_exec.c \
+ $(NULL)
+
+tests_blogc_make_check_exec_CFLAGS = \
$(CMOCKA_CFLAGS) \
$(NULL)
-tests_blogc_make_check_atom_LDFLAGS = \
+tests_blogc_make_check_exec_LDFLAGS = \
-no-install \
+ -Wl,--wrap=access \
$(NULL)
-tests_blogc_make_check_atom_LDADD = \
+tests_blogc_make_check_exec_LDADD = \
$(CMOCKA_LIBS) \
libblogc_make.la \
libblogc_common.la \
$(NULL)
+endif
-tests_blogc_make_check_exec_SOURCES = \
- tests/blogc-make/check_exec.c \
+tests_blogc_make_check_atom_SOURCES = \
+ tests/blogc-make/check_atom.c \
$(NULL)
-tests_blogc_make_check_exec_CFLAGS = \
+tests_blogc_make_check_atom_CFLAGS = \
$(CMOCKA_CFLAGS) \
$(NULL)
-tests_blogc_make_check_exec_LDFLAGS = \
+tests_blogc_make_check_atom_LDFLAGS = \
-no-install \
- -Wl,--wrap=access \
$(NULL)
-tests_blogc_make_check_exec_LDADD = \
+tests_blogc_make_check_atom_LDADD = \
$(CMOCKA_LIBS) \
libblogc_make.la \
libblogc_common.la \
diff --git a/configure.ac b/configure.ac
index dec5c3d..9e6d7eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,6 +144,7 @@ AC_ARG_ENABLE([tests], AS_HELP_STRING([--disable-tests],
[disable unit tests, ignoring presence of cmocka]))
AS_IF([test "x$enable_tests" != "xno"], [
PKG_CHECK_MODULES([CMOCKA], [cmocka], [
+ have_cmocka=yes
AC_MSG_CHECKING([whether the linker supports -wrap])
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,-wrap,exit"
@@ -154,13 +155,16 @@ AS_IF([test "x$enable_tests" != "xno"], [
[exit(1);]
])
], [
- have_cmocka=yes
+ have_ld_wrap=yes
], [
- have_cmocka=no
+ have_ld_wrap=no
], [
- have_cmocka=no
+ have_ld_wrap=no
+ ])
+ AC_MSG_RESULT([$have_ld_wrap])
+ AS_IF([test "x$have_ld_wrap" = "xyes"],, [
+ AC_MSG_WARN([linker does not supports -wrap. tests requiring it will be disabled])
])
- AC_MSG_RESULT([$have_cmocka])
LDFLAGS="$save_LDFLAGS"
], [
have_cmocka=no
@@ -169,9 +173,9 @@ AS_IF([test "x$enable_tests" != "xno"], [
have_tests=no
TESTS="disabled"
AS_IF([test "x$enable_tests" = "xyes"], [
- AC_MSG_ERROR([tests requested but cmocka was not found or -wrap is not supported by your linker])
+ AC_MSG_ERROR([tests requested but cmocka was not found])
], [
- AC_MSG_WARN([cmocka was not found or -wrap is not supported by your linker, disabling tests])
+ AC_MSG_WARN([cmocka was not found, disabling tests])
])
])
@@ -211,6 +215,7 @@ AS_IF([test "x$enable_tests" != "xno"], [
])
AM_CONDITIONAL([BUILD_TESTS], [test "x$have_tests" = "xyes"])
AM_CONDITIONAL([USE_CMOCKA], [test "x$have_cmocka" = "xyes"])
+AM_CONDITIONAL([USE_LD_WRAP], [test "x$have_ld_wrap" = "xyes"])
AM_CONDITIONAL([USE_BGR_DEPS], [test "x$have_bgr_deps" = "xyes"])
BASH="$ac_cv_path_bash"
AC_SUBST(BASH)