[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 install
distdir:
distcheck:
docker:
- image: dockcross/base
steps:
- 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: ./autogen.sh && make distdir
- run: cd harfbuzz-* && ./configure && make && make check && make install && make clean
- 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
- run: ./autogen.sh && make distcheck
- 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
psvita:
docker:
@ -144,7 +143,7 @@ workflows:
- archlinux
- freebsd9
- base
- distdir
- distcheck
- psvita
- android-arm
- browser-asmjs

View File

@ -64,7 +64,7 @@ endif ()
include_directories(AFTER
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
)
)
add_definitions(-DHAVE_OT)
add_definitions(-DHAVE_FALLBACK)
@ -427,6 +427,7 @@ if (HB_HAVE_GOBJECT)
)
endif ()
## Atomic ops availability detection
file(WRITE "${PROJECT_BINARY_DIR}/try_compile_intel_atomic_primitives.c"
" void memory_barrier (void) { __sync_synchronize (); }
@ -463,6 +464,7 @@ endif ()
add_library(harfbuzz ${project_sources} ${project_extra_sources} ${project_headers})
target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS})
## Define harfbuzz-gobject library
if (HB_HAVE_GOBJECT)
add_library(harfbuzz-gobject
@ -535,7 +537,7 @@ if (HB_HAVE_INTROSPECTION)
${hb_gobject_gen_headers}
${hb_gobject_sources}
${hb_gobject_headers}
)
)
if (WIN32)
# Nasty issue: We need to make drive letters lower case,
# otherwise g-ir-scanner won't like it and give us a bunch
@ -599,6 +601,7 @@ if (HB_HAVE_INTROSPECTION)
)
endif ()
## Additional framework build configs
if (BUILD_FRAMEWORK)
set (CMAKE_MACOSX_RPATH ON)
@ -687,7 +690,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
install(FILES "${hb_libpath}/HarfBuzz-0.0.gir"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gir-1.0
)
)
install(FILES "${hb_libpath}/HarfBuzz-0.0.typelib"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/girepository-1.0
@ -696,6 +699,32 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
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
# subdirectories.
add_subdirectory(test)

View File

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

View File

@ -4,6 +4,7 @@ LC_ALL=C
export LC_ALL
test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
test -z "$MAKE" && MAKE=make
stat=0
@ -19,7 +20,7 @@ $MAKE $defs > /dev/null
tested=false
for def in $defs; do
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`"

View File

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

View File

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

View File

@ -4,6 +4,7 @@ LC_ALL=C
export LC_ALL
test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
stat=0
@ -17,7 +18,7 @@ fi
echo "Checking that we are not exposing internal symbols"
tested=false
for suffix in so dylib; do
so=.libs/libharfbuzz.$suffix
so=$libs/libharfbuzz.$suffix
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`"