[cmake] Run src/ tests (#675)

This commit is contained in:
Ebrahim Byagowi 2018-01-04 10:11:34 +03:30 committed by GitHub
parent f8daeef4c4
commit 5ed26fc5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 12 deletions

View File

@ -52,15 +52,14 @@ jobs:
- run: ninja -Cbuild test - run: ninja -Cbuild test
- run: ninja -Cbuild install - run: ninja -Cbuild install
distdir: distcheck:
docker: docker:
- image: dockcross/base - image: dockcross/base
steps: steps:
- checkout - checkout
- run: apt update && apt install -y pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev - run: apt update && apt install -y pkg-config ragel gtk-doc-tools libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev
- run: ./autogen.sh && make distdir - run: ./autogen.sh && make distcheck
- run: cd harfbuzz-* && ./configure && make && make check && make install && make clean - run: make distdir && cd harfbuzz-* && cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GLIB=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && ninja -Cbuild install
- run: cd harfbuzz-* && cmake -DHB_HAVE_FREETYPE=ON -DHB_HAVE_GLIB=ON -DHB_BUILD_UTILS=ON -Bbuild -H. -GNinja && ninja -Cbuild && ninja -Cbuild test && ninja -Cbuild install
psvita: psvita:
docker: docker:
@ -144,7 +143,7 @@ workflows:
- archlinux - archlinux
- freebsd9 - freebsd9
- base - base
- distdir - distcheck
- psvita - psvita
- android-arm - android-arm
- browser-asmjs - browser-asmjs

View File

@ -427,6 +427,7 @@ if (HB_HAVE_GOBJECT)
) )
endif () endif ()
## Atomic ops availability detection ## Atomic ops availability detection
file(WRITE "${PROJECT_BINARY_DIR}/try_compile_intel_atomic_primitives.c" file(WRITE "${PROJECT_BINARY_DIR}/try_compile_intel_atomic_primitives.c"
" void memory_barrier (void) { __sync_synchronize (); } " void memory_barrier (void) { __sync_synchronize (); }
@ -463,6 +464,7 @@ endif ()
add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers}) add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers})
target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS}) target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS})
## Define harfbuzz-gobject library ## Define harfbuzz-gobject library
if (HB_HAVE_GOBJECT) if (HB_HAVE_GOBJECT)
add_library(harfbuzz-gobject add_library(harfbuzz-gobject
@ -599,6 +601,7 @@ if (HB_HAVE_INTROSPECTION)
) )
endif () endif ()
## Additional framework build configs ## Additional framework build configs
if (BUILD_FRAMEWORK) if (BUILD_FRAMEWORK)
set (CMAKE_MACOSX_RPATH ON) set (CMAKE_MACOSX_RPATH ON)
@ -696,6 +699,32 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
endif () endif ()
endif () endif ()
## Tests
if (UNIX)
if (BUILD_SHARED_LIBS)
add_test(NAME check-static-inits.sh
COMMAND ${PROJECT_SOURCE_DIR}/src/check-static-inits.sh
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles/harfbuzz.dir/src # hack
)
# does some "make" stuff inside
# add_test(NAME check-defs.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-defs.sh)
add_test(NAME check-libstdc++.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-libstdc++.sh)
add_test(NAME check-symbols.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-symbols.sh)
else ()
message(WARN "You can enable BUILD_SHARED_LIBS for more tests.")
endif ()
# disabled as it doesn't work anyway
if (OFF AND IN_HB_DIST)
add_test(NAME check-c-linkage-decls.sh COMMAND ./check-c-linkage-decls.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
add_test(NAME check-header-guards.sh COMMAND ./check-header-guards.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
endif ()
add_test(NAME check-externs.sh COMMAND ./check-externs.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
add_test(NAME check-includes.sh COMMAND ./check-includes.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src)
endif ()
# Needs to come last so that variables defined above are passed to # Needs to come last so that variables defined above are passed to
# subdirectories. # subdirectories.
add_subdirectory(test) add_subdirectory(test)

View File

@ -324,6 +324,7 @@ test_ot_tag_LDADD = libharfbuzz.la $(HBLIBS)
TESTS = $(dist_check_SCRIPTS) $(check_PROGRAMS) TESTS = $(dist_check_SCRIPTS) $(check_PROGRAMS)
TESTS_ENVIRONMENT = \ TESTS_ENVIRONMENT = \
srcdir="$(srcdir)" \ srcdir="$(srcdir)" \
libs=".libs" \
MAKE="$(MAKE) $(AM_MAKEFLAGS)" \ MAKE="$(MAKE) $(AM_MAKEFLAGS)" \
HBSOURCES="$(HBSOURCES)" \ HBSOURCES="$(HBSOURCES)" \
HBHEADERS="$(HBHEADERS) $(HBNODISTHEADERS)" \ HBHEADERS="$(HBHEADERS) $(HBNODISTHEADERS)" \

View File

@ -4,6 +4,7 @@ LC_ALL=C
export LC_ALL export LC_ALL
test -z "$srcdir" && srcdir=. test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
test -z "$MAKE" && MAKE=make test -z "$MAKE" && MAKE=make
stat=0 stat=0
@ -19,7 +20,7 @@ $MAKE $defs > /dev/null
tested=false tested=false
for def in $defs; do for def in $defs; do
lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'` lib=`echo "$def" | sed 's/[.]def$//;s@.*/@@'`
so=.libs/lib${lib}.so so=$libs/lib${lib}.so
EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| llvm_' | cut -d' ' -f3`" EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| llvm_' | cut -d' ' -f3`"

View File

@ -4,6 +4,7 @@ LC_ALL=C
export LC_ALL export LC_ALL
test -z "$srcdir" && srcdir=. test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
stat=0 stat=0
@ -16,7 +17,7 @@ fi
tested=false tested=false
for suffix in so dylib; do for suffix in so dylib; do
so=.libs/libharfbuzz.$suffix so=$libs/libharfbuzz.$suffix
if ! test -f "$so"; then continue; fi if ! test -f "$so"; then continue; fi
echo "Checking that we are not linking to libstdc++ or libc++" echo "Checking that we are not linking to libstdc++ or libc++"

View File

@ -4,6 +4,7 @@ LC_ALL=C
export LC_ALL export LC_ALL
test -z "$srcdir" && srcdir=. test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
stat=0 stat=0
@ -14,7 +15,7 @@ else
exit 77 exit 77
fi fi
OBJS=.libs/*.o OBJS=$libs/*.o
if test "x`echo $OBJS`" = "x$OBJS" 2>/dev/null >/dev/null; then if test "x`echo $OBJS`" = "x$OBJS" 2>/dev/null >/dev/null; then
echo "check-static-inits.sh: object files not found; skipping test" echo "check-static-inits.sh: object files not found; skipping test"
exit 77 exit 77

View File

@ -4,6 +4,7 @@ LC_ALL=C
export LC_ALL export LC_ALL
test -z "$srcdir" && srcdir=. test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
stat=0 stat=0
@ -17,7 +18,7 @@ fi
echo "Checking that we are not exposing internal symbols" echo "Checking that we are not exposing internal symbols"
tested=false tested=false
for suffix in so dylib; do for suffix in so dylib; do
so=.libs/libharfbuzz.$suffix so=$libs/libharfbuzz.$suffix
if ! test -f "$so"; then continue; fi if ! test -f "$so"; then continue; fi
EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| ___gcov_flush\>\| llvm_\| _llvm_' | cut -d' ' -f3`" EXPORTED_SYMBOLS="`nm "$so" | grep ' [BCDGINRSTVW] .' | grep -v ' _fini\>\| _init\>\| _fdata\>\| _ftext\>\| _fbss\>\| __bss_start\>\| __bss_start__\>\| __bss_end__\>\| _edata\>\| _end\>\| _bss_end__\>\| __end__\>\| __gcov_flush\>\| ___gcov_flush\>\| llvm_\| _llvm_' | cut -d' ' -f3`"