diff mbox series

[meta-oe,V1] fontconfig: Add ptest support

Message ID 1692082337-2941-1-git-send-email-qiutt@fujitsu.com
State New
Headers show
Series [meta-oe,V1] fontconfig: Add ptest support | expand

Commit Message

qiutt@fujitsu.com Aug. 15, 2023, 6:52 a.m. UTC
From: QiuTingting <qiutt@fujitsu.com>

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

Signed-off-by: QiuTingting <qiutt@fujitsu.com>
---
 .../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
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 6250cf081e..5eb07b99c0 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -20,6 +20,7 @@  PTESTS_FAST = "\
     expect \
     findutils \
     flex \
+    fontconfig \
     gawk \
     gdbm \
     gdk-pixbuf \
diff --git a/meta/recipes-graphics/fontconfig/fontconfig/ptest.patch b/meta/recipes-graphics/fontconfig/fontconfig/ptest.patch
new file mode 100644
index 0000000000..9033e2c5a1
--- /dev/null
+++ b/meta/recipes-graphics/fontconfig/fontconfig/ptest.patch
@@ -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 <qiutt@fujitsu.com>
+
+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
diff --git a/meta/recipes-graphics/fontconfig/fontconfig/run-ptest b/meta/recipes-graphics/fontconfig/fontconfig/run-ptest
new file mode 100644
index 0000000000..67d6c6823d
--- /dev/null
+++ b/meta/recipes-graphics/fontconfig/fontconfig/run-ptest
@@ -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
+
diff --git a/meta/recipes-graphics/fontconfig/fontconfig_2.14.2.bb b/meta/recipes-graphics/fontconfig/fontconfig_2.14.2.bb
index a3d29ddbae..df74de3df4 100644
--- a/meta/recipes-graphics/fontconfig/fontconfig_2.14.2.bb
+++ b/meta/recipes-graphics/fontconfig/fontconfig_2.14.2.bb
@@ -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"