Improve tests (#679)

This commit is contained in:
Ebrahim Byagowi 2018-01-05 12:42:20 +03:30 committed by GitHub
parent 293e443529
commit 72bec1cd09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 62 additions and 22 deletions

View File

@ -59,7 +59,7 @@ jobs:
- 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 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
- run: make distdir && cd harfbuzz-* && cmake -DDHB_CHECK=ON -Bbuild -H. -GNinja && ninja -Cbuild && CTEST_OUTPUT_ON_FAILURE=1 ninja -Cbuild test && ninja -Cbuild install
psvita:
docker:

View File

@ -61,6 +61,25 @@ if (HB_HAVE_INTROSPECTION)
set (HB_HAVE_GLIB ON)
endif ()
option(HB_CHECK OFF "Do a configuration suitable for testing (shared library and enable all options)")
if (HB_CHECK)
set (BUILD_SHARED_LIBS ON)
set (HB_BUILD_UTILS ON)
set (HB_BUILTIN_UCDN ON)
set (HB_HAVE_ICU)
set (HB_HAVE_GLIB ON)
#set (HB_HAVE_GOBJECT ON)
#set (HB_HAVE_INTROSPECTION ON)
set (HB_HAVE_FREETYPE ON)
set (HB_HAVE_GRAPHITE2 ON)
if (WIN32)
set (HB_HAVE_UNISCRIBE ON)
set (HB_HAVE_DIRECTWRITE ON)
elseif (APPLE)
set (HB_HAVE_CORETEXT ON)
endif ()
endif ()
include_directories(AFTER
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
@ -71,6 +90,9 @@ add_definitions(-DHAVE_FALLBACK)
if (BUILD_SHARED_LIBS)
add_definitions(-DHAVE_ATEXIT)
if (APPLE)
set (CMAKE_MACOSX_RPATH ON)
endif ()
endif ()
if (MSVC)
@ -710,23 +732,31 @@ if (UNIX AND CMAKE_GENERATOR STREQUAL "Ninja")
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)
#add_test(NAME check-defs.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-defs.sh)
#set_tests_properties(check-defs.sh PROPERTIES ENVIRONMENT "libs=.")
# broken on cmake builds right now :(
#add_test(NAME check-symbols.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-symbols.sh)
#add_test(NAME check-libstdc++.sh COMMAND ${PROJECT_SOURCE_DIR}/src/check-libstdc++.sh)
#set_tests_properties(check-symbols.sh check-libstdc++.sh PROPERTIES ENVIRONMENT "libs=.")
if (NOT APPLE)
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 # ugly hack
)
set_tests_properties(check-static-inits.sh PROPERTIES ENVIRONMENT "libs=.")
endif ()
else ()
message(WARN "You can enable BUILD_SHARED_LIBS for more tests.")
message(WARN "Enable BUILD_SHARED_LIBS for more tests.")
endif ()
# disabled as it doesn't work anyway
if (OFF AND IN_HB_DIST)
if (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 ()

View File

@ -42,5 +42,7 @@ echo "running autoreconf --force --install --verbose"
autoreconf --force --install --verbose || exit $?
cd $olddir
echo "running configure $@"
test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
test -n "$NOCONFIGURE" || {
echo "running configure $@"
"$srcdir/configure" "$@"
}

View File

@ -134,7 +134,7 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = harfbuzz.pc
EXTRA_DIST += harfbuzz.pc.in
FUZZING_CPPFLAGS= \
FUZZING_CPPFLAGS = \
-DHB_NDEBUG \
-DHB_MAX_NESTING_LEVEL=3 \
-DHB_SANITIZE_MAX_EDITS=3 \
@ -324,7 +324,6 @@ 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,7 +4,7 @@ LC_ALL=C
export LC_ALL
test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
test -z "$libs" && libs=.libs
test -z "$MAKE" && MAKE=make
stat=0

View File

@ -6,7 +6,7 @@ export LC_ALL
test -z "$srcdir" && srcdir=.
stat=0
test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h'`
test "x$HBHEADERS" = x && HBHEADERS=`cd "$srcdir"; find . -maxdepth 1 -name 'hb*.h' ! -name 'hb-gobject-structs.h'`
test "x$HBSOURCES" = x && HBSOURCES=`cd "$srcdir"; find . -maxdepth 1 -name 'hb-*.cc' -or -name 'hb-*.hh'`
for x in $HBHEADERS $HBSOURCES; do

View File

@ -4,7 +4,7 @@ LC_ALL=C
export LC_ALL
test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
test -z "$libs" && libs=.libs
stat=0

View File

@ -4,7 +4,7 @@ LC_ALL=C
export LC_ALL
test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
test -z "$libs" && libs=.libs
stat=0

View File

@ -4,7 +4,7 @@ LC_ALL=C
export LC_ALL
test -z "$srcdir" && srcdir=.
test -z "$libs" && libs=.
test -z "$libs" && libs=.libs
stat=0

View File

@ -1,8 +1,17 @@
if (HB_HAVE_GLIB)
if (HB_CHECK)
file (READ "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am" MAKEFILEAM)
extract_make_variable (hb_fuzzer_SOURCES ${MAKEFILEAM})
# TODO: enable these two
#extract_make_variable (FUZZING_CPPFLAGS ${MAKEFILEAM}) # extracting regex fail
#add_executable (hb-fuzzer # it should be run only after ragel execution
# ${project_sources} ${project_extra_sources} ${project_headers}
# ${hb_fuzzer_SOURCES})
add_executable (hb-fuzzer ${hb_fuzzer_SOURCES})
target_link_libraries (hb-fuzzer harfbuzz)
target_compile_definitions(hb-fuzzer PUBLIC ${FUZZING_CPPFLAGS})
add_test (NAME hb-fuzzer
COMMAND python run-fuzzer-tests.py $<TARGET_FILE:hb-fuzzer>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})