freerdp3: add ptest support

The execution takes under 10s.

Sample output:

root@qemux86-64:~# ptest-runner
START: ptest-runner
2025-12-23T11:36
BEGIN: /usr/lib/freerdp3/ptest
PASS: TestSynchInit
PASS: TestSynchEvent
PASS: TestSynchMutex
[...many lines...]
PASS: TestClientRdpFile
PASS: TestClientChannels
PASS: TestClientCmdLine
DURATION: 7
END: /usr/lib/freerdp3/ptest
2025-12-23T11:37
STOP: ptest-runner
TOTAL: 1 FAIL: 0

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Gyorgy Sarvari 2025-12-24 21:39:13 +01:00 committed by Khem Raj
parent 325928e2ab
commit 199a6a2266
No known key found for this signature in database
GPG Key ID: BB053355919D3314
3 changed files with 60 additions and 2 deletions

View File

@ -17,6 +17,7 @@ PTESTS_FAST_META_OE = "\
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'dbus-broker', '', d)} \
duktape \
exiv2 \
freerdp3 \
fuse3 \
function2 \
fwupd \

View File

@ -0,0 +1,2 @@
#!/bin/sh
ctest | sed 's/\*\*\*/ /g' | awk '/Test +#/{gsub(/Passed/,"PASS"); gsub(/Failed/,"FAIL"); gsub(/Skipped/,"SKIP"); print $6": "$4; fflush();}'

View File

@ -4,11 +4,13 @@ LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
DEPENDS = "openssl libusb1 uriparser cairo icu pkcs11-helper zlib jpeg json-c"
RDEPENDS:${PN}-ptest += "cmake coreutils"
inherit pkgconfig cmake
inherit pkgconfig cmake ptest
SRCREV = "b8e790a02ede8dd64ff7177fb9027d1844e66bb6"
SRC_URI = "git://github.com/FreeRDP/FreeRDP.git;branch=master;protocol=https;tag=${PV}"
SRC_URI = "git://github.com/FreeRDP/FreeRDP.git;branch=master;protocol=https;tag=${PV} \
file://run-ptest"
CVE_PRODUCT = "freerdp"
@ -17,6 +19,7 @@ PACKAGECONFIG ??= " \
${@bb.utils.filter('DISTRO_FEATURES', 'pam pulseaudio wayland x11', d)} \
${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'ffmpeg', '', d)} \
gstreamer cups pcsc \
${@bb.utils.contains('PTEST_ENABLED', '1', 'test', '', d)} \
"
EXTRA_OECMAKE = " \
@ -54,12 +57,64 @@ PACKAGECONFIG[opencl] = "-DWITH_OPENCL=ON,-DWITH_OPENCL=OFF,virtual/libopencl1"
PACKAGECONFIG[lame] = "-DWITH_LAME=ON,-DWITH_LAME=OFF,lame"
PACKAGECONFIG[faad] = "-DWITH_FAAD=ON,-DWITH_FAAD=OFF,faad2"
PACKAGECONFIG[faac] = "-DWITH_FAAC=ON,-DWITH_FAAC=OFF,faac"
PACKAGECONFIG[test] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF"
do_configure:prepend() {
sed -i 's|TEST_SOURCE_DIR="\${CMAKE_CURRENT_SOURCE_DIR}"|TEST_SOURCE_DIR="${PTEST_PATH}/test"|' ${S}/client/common/test/CMakeLists.txt
sed -i 's|\${CMAKE_SOURCE_DIR}|${PTEST_PATH}|' ${S}/winpr/libwinpr/clipboard/test/CMakeLists.txt
sed -i 's|="\${CMAKE_CURRENT_SOURCE_DIR}|="${PTEST_PATH}/test|' ${S}/winpr/libwinpr/utils/test/CMakeLists.txt
sed -i 's|="\${CMAKE_CURRENT_BINARY_DIR}|="${PTEST_PATH}/test|' ${S}/winpr/libwinpr/utils/test/CMakeLists.txt
sed -i 's|="\${CMAKE_CURRENT_SOURCE_DIR}|="${PTEST_PATH}/test|' ${S}/libfreerdp/codec/test/CMakeLists.txt
sed -i 's|="\${CMAKE_CURRENT_BINARY_DIR}|="${PTEST_PATH}/test|' ${S}/libfreerdp/codec/test/CMakeLists.txt
}
do_configure:append() {
sed -i -e 's|${WORKDIR}||g' ${B}/include/freerdp/buildflags.h
sed -i -e 's|${WORKDIR}||g' ${B}/winpr/include/winpr/buildflags.h
}
do_install_ptest() {
install -d ${D}${PTEST_PATH}/test
# main CTestTestfile.cmake file
cp ${B}/CTestTestfile.cmake ${D}${PTEST_PATH}
# the actual test executables
cp -r ${B}/Testing ${D}${PTEST_PATH}
# test data
cp ${S}/winpr/libwinpr/utils/test/*bmp ${D}${PTEST_PATH}/test/
cp ${S}/libfreerdp/codec/test/*bmp ${D}${PTEST_PATH}/test/
cp -r ${S}/client/common/test/* ${D}${PTEST_PATH}/test/
cp -r ${S}/resources ${D}${PTEST_PATH}
cp -r ${S}/libfreerdp/codec/test/planar ${D}${PTEST_PATH}/test/
cp -r ${S}/libfreerdp/codec/test/interleaved ${D}${PTEST_PATH}/test/
cd ${B}
# the test definitions, how to execute the tests
find . -name CTestTestfile.cmake -exec install -Dm 0644 {} ${D}${PTEST_PATH}/{} \;
for testfile in $(find ${D}${PTEST_PATH} -name CTestTestfile.cmake); do
# these are comments only, containing ${S} and ${B}, at the top of each file
sed -i "s,Source directory: ${S},<source_dir>," $testfile
sed -i "s,Build directory: ${B},<build_dir>," $testfile
# change the ${B} to ${PTEST_PATH}, so the files will be searches at the correct place
sed -i "s,${B}/Testing,${PTEST_PATH}/Testing,g" $testfile
# These add some extra traceability info to the tests, to pair them with CMakeLists.txt files,
# containing ${B}.
# They are not needed for test execution, just remove the whole line.
sed -i "s,set_tests_properties.*_BACKTRACE_TRIPLES.*,," $testfile
done
# This is not part of the tests it is just in the same folder, and requires Python to be installed.
# Just remove it.
rm ${D}${PTEST_PATH}/resources/conv_to_ewm_prop.py
# This particular test requires openh264, which is part of meta-multimedia layer.
# Since it is not a dependency of meta-oe, comment this test out.
sed -i 's/add_test(TestFreeRDPCodecH264/#add_test(TestFreeRDPCodecH264/' ${D}${PTEST_PATH}/libfreerdp/codec/test/CTestTestfile.cmake
}
PACKAGES =+ "${PN}-proxy-plugins"
FILES:${PN}-proxy-plugins += "${libdir}/${BPN}/proxy/*.so*"