Skip to contentSkip to conversation

fontconfig: Add ptest support

PATCH New [email protected] 1 participant 1 message Aug 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fontconfig: Add ptest support

From: QiuTingting <[email protected]>

Add ptest support for fontconfig.
It is taking around 13s to execute with kvm, so added it to PTESTS_FAST. It contains 12 cases.
test-bz106618, test-bz106632, test-bz131804, test-bz1744377, test-bz89617, test-bz96676, test-crbug1004254, test-family-matching, test-issue107, test-issue180, test-name-parse, test-pthread

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 .../fontconfig/fontconfig/ptest.patch         | 28 +++++++++++++++++++
 .../fontconfig/fontconfig/run-ptest           | 14 ++++++++++
 .../fontconfig/fontconfig_2.14.2.bb           | 16 ++++++++++-
 4 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/fontconfig/fontconfig/ptest.patch
 create mode 100644 meta/recipes-graphics/fontconfig/fontconfig/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 6250cf081e..5eb07b99c0 100644
@@ -20,6 +20,7 @@ PTESTS_FAST = "\
     expect \
     findutils \
     flex \
+    fontconfig \
     gawk \
     gdbm \
     gdk-pixbuf \
meta/recipes-graphics/fontconfig/fontconfig/ptest.patch new file +28 -0
new file mode 100644
index 0000000000..9033e2c5a1
@@ -0,0 +1,28 @@
+Fix compile problem for ptest
+
+Change SRCDIR and FONTFILE in test/Makefile.am for ptest.
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Qiu Tingting <[email protected]>
+
+diff -rNu a/test/Makefile.am b/test/Makefile.am
+--- a/test/Makefile.am	2023-08-03 15:10:50.830916551 +0800
++++ b/test/Makefile.am	2023-08-03 16:16:10.178859661 +0800
+@@ -76,7 +76,7 @@
+ endif
+ check_PROGRAMS += test-bz89617
+ test_bz89617_CFLAGS = \
+-	-DSRCDIR="\"$(abs_srcdir)\""
++	-DSRCDIR="\"/usr/lib/fontconfig/ptest/test/\""
+ 
+ test_bz89617_LDADD = $(top_builddir)/src/libfontconfig.la
+ TESTS += test-bz89617
+@@ -117,7 +117,7 @@
+ 	-I$(top_builddir)/src				\
+ 	-I$(top_srcdir)					\
+ 	-I$(top_srcdir)/src				\
+-	-DFONTFILE='"$(abs_top_srcdir)/test/4x6.pcf"'	\
++	-DFONTFILE='"/usr/lib/fontconfig/ptest/test/4x6.pcf"'	\
+ 	-DHAVE_CONFIG_H					\
+ 	$(NULL)
+ test_bz106632_LDADD = $(top_builddir)/src/libfontconfig.la
meta/recipes-graphics/fontconfig/fontconfig/run-ptest new file +14 -0
new file mode 100644
index 0000000000..67d6c6823d
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+WORKDIR=@PTEST_PATH@/test/
+PROG=@PTEST_PATH@/test-driver
+LOGDIR=@PTEST_PATH@/logs/
+
+rm -rf ${LOGDIR}
+mkdir -p ${LOGDIR}
+cd ${WORKDIR}
+for file in `ls ${WORKDIR} | grep test | grep -v json`
+do
+    ${PROG} --test-name ${file} --log-file ${LOGDIR}${file}.log --trs-file ${LOGDIR}${file}.trs ${WORKDIR}${file}
+done
+
meta/recipes-graphics/fontconfig/fontconfig_2.14.2.bb +15 -1
index a3d29ddbae..df74de3df4 100644
@@ -22,6 +22,8 @@ DEPENDS = "expat freetype zlib gperf-native util-linux"
 
 SRC_URI = "http://fontconfig.org/release/fontconfig-${PV}.tar.gz \
            file://revert-static-pkgconfig.patch \
+           file://run-ptest \
+           file://ptest.patch \
            "
 
 SRC_URI[sha256sum] = "3ba2dd92158718acec5caaf1a716043b5aa055c27b081d914af3ccb40dce8a55"
@@ -56,7 +58,19 @@ RREPLACES:fontconfig-utils = "libfontconfig-utils"
 RCONFLICTS:fontconfig-utils = "libfontconfig-utils"
 DEBIAN_NOAUTONAME:fontconfig-utils = "1"
 
-inherit autotools pkgconfig relative_symlinks gettext
+inherit autotools pkgconfig relative_symlinks gettext ptest
+
+do_install_ptest() {
+    install ${S}/test-driver ${D}${PTEST_PATH}/
+
+    install -d ${D}${PTEST_PATH}/test/
+    find ${B}/test/.libs/ -type f -not -name "test-migration" \
+        -exec install {} ${D}${PTEST_PATH}/test/ \;
+    install ${S}/test/*.pcf ${D}${PTEST_PATH}/test
+
+    # update PTEST_PATH in run-ptest
+    sed -i "s#@PTEST_PATH@#${PTEST_PATH}#g" ${D}${PTEST_PATH}/run-ptest
+}
 
 FONTCONFIG_CACHE_DIR ?= "${localstatedir}/cache/fontconfig"
 
Signature · 1 line
2.25.1