freerdp: add ptest support

The test suite takes about 50s to execute.

Sample output:

root@qemux86-64:~# ptest-runner
START: ptest-runner
2026-01-22T12:58
BEGIN: /usr/lib/freerdp/ptest
PASS: TestClient TestClientRdpFile
PASS: TestClient TestClientChannels
PASS: TestClient TestClientCmdLine
[...many lines...]
PASS: TestWtsApi TestWtsApiSessionNotification
PASS: TestWtsApi TestWtsApiShutdownSystem
PASS: TestWtsApi TestWtsApiWaitSystemEvent
DURATION: 48
END: /usr/lib/freerdp/ptest
2026-01-22T12:59
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 2026-01-22 14:12:25 +01:00 committed by Khem Raj
parent b7bd06e9b4
commit 7c65b0bccb
No known key found for this signature in database
GPG Key ID: BB053355919D3314
3 changed files with 107 additions and 1 deletions

View File

@ -72,6 +72,7 @@ PTESTS_FAST_META_OE:remove:riscv32 = "botan nodejs oprofile"
PTESTS_SLOW_META_OE = "\
c-ares \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'freerdp', '', d)} \
fftw \
libusb-compat \
mariadb \

View File

@ -0,0 +1,85 @@
#!/bin/sh
#The key is the test binary name, and the value is the list of arguments to
#use with the given binary. Each argument is a testcase to execute.
#These test cases were determined by running the actual test binary
#which lists all available test cases. Couldn't find a way to just simply
#run all. Also, BusyBox seems to have no associative array support, so
#plain variables are used with eval.
TestAsn="TestAsn1Module TestAsn1Encoder TestAsn1Decoder TestAsn1Encode TestAsn1Decode TestAsn1String \
TestAsn1Integer TestAsn1Compare TestAsn1BerEnc TestAsn1BerDec TestAsn1DerEnc TestAsn1DerDec"
TestClient="TestClientRdpFile TestClientChannels TestClientCmdLine"
TestClipboard="TestClipboardFormats"
TestCommon="TestCommonAssistance"
TestCore="TestVersion TestSettings"
TestCredUI="TestCredUIParseUserName TestCredUIConfirmCredentials TestCredUIPromptForCredentials TestCredUICmdLinePromptForCredentials"
TestCrt="TestTypes TestFormatSpecifiers TestAlignment TestString TestUnicodeConversion"
TestCrypto="TestCryptoHash TestCryptoRand TestCryptoCipher TestCryptoProtectData TestCryptoProtectMemory TestCryptoCertEnumCertificatesInStore"
TestDsParse="TestDsMakeSpn TestDsCrackNames"
TestEnvironment="TestEnvironmentGetEnvironmentStrings TestEnvironmentSetEnvironmentVariable TestEnvironmentMergeEnvironmentStrings TestEnvironmentGetSetEB"
TestError="TestErrorSetLastError"
TestFile="TestFileCreateFile TestFileDeleteFile TestFileReadFile TestSetFileAttributes TestFileWriteFile \
TestFilePatternMatch TestFileFindFirstFile TestFileFindFirstFileEx TestFileFindNextFile TestFileGetStdHandle"
TestFreeRDPCodec="TestFreeRDPRegion TestFreeRDPCodecMppc TestFreeRDPCodecNCrush TestFreeRDPCodecXCrush \
TestFreeRDPCodecZGfx TestFreeRDPCodecPlanar TestFreeRDPCodecClear TestFreeRDPCodecInterleaved \
TestFreeRDPCodecProgressive TestFreeRDPCodecRemoteFX"
TestFreeRDPCrypto="TestKnownHosts TestBase64 Test_x509_cert_info"
TestFreeRDPUtils="TestRingBuffer"
TestGdi="TestGdiRop3 TestGdiLine TestGdiRegion TestGdiRect TestGdiBitBlt TestGdiCreate TestGdiEllipse TestGdiClip"
TestInterlocked="TestInterlockedAccess TestInterlockedSList TestInterlockedDList"
TestIo="TestIoDevice TestIoGetOverlappedResult"
TestLibrary="TestLibraryLoadLibrary TestLibraryGetProcAddress TestLibraryGetModuleFileName"
TestLocale="TestLocaleFormatMessage"
TestMemory="TestMemoryCreateFileMapping"
TestNt="TestNtCreateFile TestNtCurrentTeb"
TestPath="TestPathCchAddBackslash TestPathCchRemoveBackslash TestPathCchAddBackslashEx TestPathCchRemoveBackslashEx \
TestPathCchAddExtension TestPathCchAppend TestPathCchAppendEx TestPathCchCanonicalize TestPathCchCanonicalizeEx \
TestPathAllocCanonicalize TestPathCchCombine TestPathCchCombineEx TestPathAllocCombine TestPathCchFindExtension \
TestPathCchRenameExtension TestPathCchRemoveExtension TestPathCchIsRoot TestPathIsUNCEx TestPathCchSkipRoot \
TestPathCchStripToRoot TestPathCchStripPrefix TestPathCchRemoveFileSpec TestPathShell TestPathMakePath"
TestPipe="TestPipeCreatePipe TestPipeCreateNamedPipe TestPipeCreateNamedPipeOverlapped"
TestPool="TestPoolIO TestPoolSynch TestPoolThread TestPoolTimer TestPoolWork"
TestPrimitives="TestPrimitivesAdd TestPrimitivesAlphaComp TestPrimitivesAndOr TestPrimitivesColors TestPrimitivesCopy \
TestPrimitivesSet TestPrimitivesShift TestPrimitivesSign TestPrimitivesYUV TestPrimitivesYCbCr TestPrimitivesYCoCg"
TestRdTk="TestRdTkNinePatch"
TestSecurity="TestSecurityToken"
TestSmartCard="TestSmartCardListReaders"
TestSspi="TestQuerySecurityPackageInfo TestEnumerateSecurityPackages TestInitializeSecurityContext TestAcquireCredentialsHandle TestCredSSP TestNTLM"
TestSynch="TestSynchInit TestSynchEvent TestSynchMutex TestSynchBarrier TestSynchCritical TestSynchSemaphore \
TestSynchThread TestSynchMultipleThreads TestSynchTimerQueue TestSynchWaitableTimer TestSynchWaitableTimerAPC TestSynchAPC"
TestSysInfo="TestGetNativeSystemInfo TestCPUFeatures TestGetComputerName TestSystemTime TestLocalTime"
TestThread="TestThreadCommandLineToArgv TestThreadCreateProcess TestThreadExitThread"
TestWinPR="TestIntrinsics TestTypes"
TestWinPRUtils="TestIni TestVersion TestImage TestBipBuffer TestBacktrace TestQueue TestPrint TestPubSub TestStream \
TestBitStream TestArrayList TestLinkedList TestListDictionary TestCmdLine TestWLog TestWLogCallback TestHashTable \
TestBufferPool TestStreamPool TestMessageQueue TestMessagePipe"
TestWnd="TestWndCreateWindowEx TestWndWmCopyData"
TestWtsApi="TestWtsApiEnumerateProcesses TestWtsApiEnumerateSessions TestWtsApiQuerySessionInformation \
TestWtsApiSessionNotification TestWtsApiShutdownSystem TestWtsApiWaitSystemEvent"
run_test(){
binary=$1
tcs=$(eval "echo \$${binary}")
if [ -z "$tcs" -o "$tcs" = ".so" ]; then
return
fi
EXTRA_ARG=""
if [ "$binary" = "TestFile" ]; then
# This testcase needs an extra argument. TestFileArea is a folder
# where some test files are used by this test.
EXTRA_ARG="TestFileArea"
fi
for tc in $tcs; do
./$binary $tc $EXTRA_ARG > ../${binary}_${tc}.out 2>&1 && echo PASS: $binary $tc || echo FAIL: $binary $tc
done
}
cd Testing
for testbin in *; do
run_test $testbin
done

View File

@ -8,13 +8,16 @@ SECTION = "net"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
inherit pkgconfig cmake gitpkgv
inherit pkgconfig cmake gitpkgv ptest
RDEPENDS:${PN}-ptest += "coreutils pcsc-lite-lib"
PE = "1"
PKGV = "${GITPKGVTAG}"
SRCREV = "efa899d3deb8595a29fabb2a2251722f9d7e0d7f"
SRC_URI = "git://github.com/FreeRDP/FreeRDP.git;branch=stable-2.0;protocol=https \
file://run-ptest \
file://winpr-makecert-Build-with-install-RPATH.patch \
file://0001-Fixed-compilation-warnings.patch \
file://0001-Fix-const-qualifier-error.patch \
@ -37,6 +40,7 @@ EXTRA_OECMAKE += " \
PACKAGECONFIG ??= " \
${@bb.utils.filter('DISTRO_FEATURES', 'directfb pam pulseaudio wayland x11', d)}\
${@bb.utils.contains('PTEST_ENABLED', '1', 'test', '', d)} \
alsa gstreamer cups pcsc server \
"
@ -51,6 +55,7 @@ PACKAGECONFIG[gstreamer] = "-DWITH_GSTREAMER_1_0=ON,-DWITH_GSTREAMER_1_0=OFF,gst
PACKAGECONFIG[cups] = "-DWITH_CUPS=ON,-DWITH_CUPS=OFF,cups"
PACKAGECONFIG[server] = "-DWITH_SERVER=ON,-DWITH_SERVER=OFF"
PACKAGECONFIG[alsa] = "-DWITH_ALSA=ON,-DWITH_ALSA=OFF,alsa-lib"
PACKAGECONFIG[test] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF"
PACKAGES =+ "libfreerdp"
@ -59,6 +64,12 @@ FILES:libfreerdp = "${libdir}/lib*${SOLIBS}"
PACKAGES_DYNAMIC += "^libfreerdp-plugin-.*"
do_configure:prepend() {
sed -i 's,CMAKE_CURRENT_SOURCE_DIR,"${PTEST_PATH}/test_data",' ${S}/libfreerdp/codec/test/TestFreeRDPCodecProgressive.c
sed -i 's,\${CMAKE_CURRENT_SOURCE_DIR},"${PTEST_PATH}/test_data",' ${S}/libfreerdp/crypto/test/CMakeLists.txt
sed -i 's,\${CMAKE_CURRENT_SOURCE_DIR},${PTEST_PATH}/test_data,' ${S}/winpr/libwinpr/utils/test/CMakeLists.txt
}
do_configure:append() {
sed -i -e 's|${WORKDIR}||g' ${B}/buildflags.h
}
@ -70,6 +81,15 @@ do_install:append () {
rm -rf ${D}${libdir}/freerdp
}
do_install_ptest() {
install -d ${D}${PTEST_PATH}/test_data
cp -r ${B}/Testing ${D}${PTEST_PATH}
install -m 0644 ${S}/libfreerdp/codec/test/progressive.bmp ${D}${PTEST_PATH}/test_data/
install -m 0644 ${S}/libfreerdp/crypto/test/Test_x509_cert_info.pem ${D}${PTEST_PATH}/test_data/
install -m 0644 ${S}/winpr/libwinpr/utils/test/lodepng_32bit.png ${D}${PTEST_PATH}/test_data/
install -m 0644 ${S}/winpr/libwinpr/utils/test/lodepng_32bit.bmp ${D}${PTEST_PATH}/test_data/
}
python populate_packages:prepend () {
freerdp_root = d.expand('${libdir}/freerdp')