The tests take about 50s to execute on my machine.

Signed-off-by: Gyorgy Sarvari <[email protected]>
---
 .../recipes-support/freerdp/freerdp/run-ptest | 66 +++++++++++++++++++
 .../recipes-support/freerdp/freerdp_2.6.1.bb  | 24 ++++++-
 2 files changed, 89 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/freerdp/freerdp/run-ptest

diff --git a/meta-oe/recipes-support/freerdp/freerdp/run-ptest 
b/meta-oe/recipes-support/freerdp/freerdp/run-ptest
new file mode 100644
index 0000000000..5a765cadf0
--- /dev/null
+++ b/meta-oe/recipes-support/freerdp/freerdp/run-ptest
@@ -0,0 +1,66 @@
+#!/bin/sh
+#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(){
+  tc=$(eval "echo \$${1}")
+  if [ -z "$tc" -o "$tc" = ".so" ]; then
+     return
+  fi
+  
+  EXTRA_ARG=""
+  if [ "$1" = "TestFile" ]; then
+    # this testcase needs an extra argument
+    EXTRA_ARG="TestFileArea"
+  fi
+  
+  for t in $tc; do
+    ./$1 $t $EXTRA_ARG > ../${1}_${t}.out && echo PASS: $1 $t || echo FAIL: $1 
$t
+  done
+}
+
+
+cd Testing
+
+for testbin in *; do
+  run_test $testbin
+done
diff --git a/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb 
b/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb
index 205f7b0cd7..5122a2d057 100644
--- a/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb
+++ b/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb
@@ -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 = "658a72980f6e93241d927c46cfa664bf2547b8b1"
 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://CVE-2022-39316.patch \
            file://CVE-2022-39318-39319.patch \
@@ -43,6 +46,7 @@ EXTRA_OECMAKE += " \
 
 PACKAGECONFIG ??= " \
     ${@bb.utils.filter('DISTRO_FEATURES', 'directfb pam pulseaudio wayland 
x11', d)}\
+    ${@bb.utils.contains('PTEST_ENABLED', '1', 'test', '', d)} \
     gstreamer cups pcsc \
 "
 
@@ -55,6 +59,7 @@ PACKAGECONFIG[pcsc] = 
"-DWITH_PCSC=ON,-DWITH_PCSC=OFF,pcsc-lite"
 PACKAGECONFIG[pulseaudio] = 
"-DWITH_PULSEAUDIO=ON,-DWITH_PULSEAUDIO=OFF,pulseaudio"
 PACKAGECONFIG[gstreamer] = 
"-DWITH_GSTREAMER_1_0=ON,-DWITH_GSTREAMER_1_0=OFF,gstreamer1.0 
gstreamer1.0-plugins-base"
 PACKAGECONFIG[cups] = "-DWITH_CUPS=ON,-DWITH_CUPS=OFF,cups"
+PACKAGECONFIG[test] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF"
 
 PACKAGES =+ "libfreerdp"
 
@@ -63,6 +68,14 @@ FILES:libfreerdp = "${libdir}/lib*${SOLIBS}"
 
 PACKAGES_DYNAMIC += "^libfreerdp-plugin-.*"
 
+do_configure:prepend() {
+    if ${@bb.utils.contains('PTEST_ENABLED', '1', 'true', 'false', d)}; then
+        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
+    fi
+}
+
 # we will need winpr-makecert to generate TLS certificates
 do_install:append () {
     install -d ${D}${bindir}
@@ -71,6 +84,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')
 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#123725): 
https://lists.openembedded.org/g/openembedded-devel/message/123725
Mute This Topic: https://lists.openembedded.org/mt/117395639/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to