mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-11-12 15:31:03 +00:00
sdbus-c++: Fix flaky integration tests on slow machines
sdbus-c++-integration-tests fails intermittently in the ptest image on
qemuarm64 (qemu TCG, no KVM) when the build host is busy running other
testimage tasks:
- CallsMethodWithLargeArgument sends ~30 MB in one method call with the
default 25 second D-Bus timeout. That takes 13-16 s on an idle qemu
and 40-50 s under load, so it fails with
org.freedesktop.DBus.Error.Timeout. Use a 120 second timeout.
- ThrowsTimeoutErrorWhen{Method,ClientSideAsyncMethod}TimesOut require
the timeout error within 50 ms; under load it took up to 57 ms.
Allow 500 ms, still well below the 1 s operation the tests time out.
With both patches, 10 repeats of the integration tests under heavy
host and guest CPU contention pass; without them 4 of 10 failed.
AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
3 files changed
+94
No files matched your search
+40
@@ -0,0 +1,40 @@
|
||||
From 1c000e89c9a1ebe914ef8a581de7a2fbab629fd9 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 31 Oct 2026 10:45:54 -0700
|
||||
Subject: [PATCH 1/2] tests: Use a longer timeout for the large argument method
|
||||
call
|
||||
|
||||
CallsMethodWithLargeArgument sends a map of 400000 strings (about 30 MB)
|
||||
in one synchronous method call with the default 25 second D-Bus method
|
||||
call timeout. Marshalling, transferring and unmarshalling that much data
|
||||
takes 13-16 seconds on an idle emulated (qemu TCG) aarch64 machine and
|
||||
more than 40 seconds when the host is busy, so the test fails with
|
||||
org.freedesktop.DBus.Error.Timeout.
|
||||
|
||||
Call the method with an explicit 120 second timeout instead.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
tests/integrationtests/DBusMethodsTests.cpp | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/integrationtests/DBusMethodsTests.cpp b/tests/integrationtests/DBusMethodsTests.cpp
|
||||
index 345cf4e..3066317 100644
|
||||
--- a/tests/integrationtests/DBusMethodsTests.cpp
|
||||
+++ b/tests/integrationtests/DBusMethodsTests.cpp
|
||||
@@ -309,7 +309,12 @@ TYPED_TEST(SdbusTestObject, CallsMethodWithLargeArgument)
|
||||
//totalSize += sizeof(int) + collection[i].size();
|
||||
}
|
||||
//printf("Sending large message with collection of size %zu bytes\n", totalSize);
|
||||
- this->m_proxy->sendLargeMessage(collection);
|
||||
+ // Marshalling and transferring ~30 MB takes long on slow (e.g. emulated) machines,
|
||||
+ // so don't let the call run into the default 25s method call timeout
|
||||
+ this->m_proxy->getProxy().callMethod("sendLargeMessage")
|
||||
+ .onInterface("org.sdbuscpp.integrationtests")
|
||||
+ .withTimeout(120s)
|
||||
+ .withArguments(collection);
|
||||
}
|
||||
|
||||
TYPED_TEST(SdbusTestObject, CanSendCallsAndReceiveRepliesWithLargeData)
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
From 623714493ba8144b38be6157f55e32acb0e51021 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sat, 31 Oct 2026 11:37:50 -0700
|
||||
Subject: [PATCH 2/2] tests: Relax the measured timeout bound in timeout tests
|
||||
|
||||
ThrowsTimeoutErrorWhenMethodTimesOut and
|
||||
ThrowsTimeoutErrorWhenClientSideAsyncMethodTimesOut call a method that
|
||||
takes 1 second with a 1 microsecond timeout, and then assert that the
|
||||
timeout error arrived within 50 ms. On an emulated (qemu TCG) aarch64
|
||||
machine with a busy host this takes longer, e.g.
|
||||
|
||||
Value of: measuredTimeout
|
||||
Expected: is <= 0.05s
|
||||
Actual: 0.0567641s
|
||||
|
||||
Allow 500 ms instead. That is still well below the 1 second the operation
|
||||
takes, so the tests still check that the client side timeout fired.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
tests/integrationtests/DBusAsyncMethodsTests.cpp | 2 +-
|
||||
tests/integrationtests/DBusMethodsTests.cpp | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/integrationtests/DBusAsyncMethodsTests.cpp b/tests/integrationtests/DBusAsyncMethodsTests.cpp
|
||||
index 14942ba..ea05c3e 100644
|
||||
--- a/tests/integrationtests/DBusAsyncMethodsTests.cpp
|
||||
+++ b/tests/integrationtests/DBusAsyncMethodsTests.cpp
|
||||
@@ -82,7 +82,7 @@ TYPED_TEST(AsyncSdbusTestObject, ThrowsTimeoutErrorWhenClientSideAsyncMethodTime
|
||||
ASSERT_THAT(e.getName(), AnyOf("org.freedesktop.DBus.Error.Timeout", "org.freedesktop.DBus.Error.NoReply"));
|
||||
ASSERT_THAT(e.getMessage(), AnyOf("Connection timed out", "Method call timed out"));
|
||||
auto measuredTimeout = std::chrono::steady_clock::now() - start;
|
||||
- ASSERT_THAT(measuredTimeout, Le(50ms));
|
||||
+ ASSERT_THAT(measuredTimeout, Le(500ms)); // Well below the 1s operation time, with headroom for slow (e.g. emulated) machines
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
diff --git a/tests/integrationtests/DBusMethodsTests.cpp b/tests/integrationtests/DBusMethodsTests.cpp
|
||||
index 3066317..695d797 100644
|
||||
--- a/tests/integrationtests/DBusMethodsTests.cpp
|
||||
+++ b/tests/integrationtests/DBusMethodsTests.cpp
|
||||
@@ -197,7 +197,7 @@ TYPED_TEST(SdbusTestObject, ThrowsTimeoutErrorWhenMethodTimesOut)
|
||||
ASSERT_THAT(e.getName(), AnyOf("org.freedesktop.DBus.Error.Timeout", "org.freedesktop.DBus.Error.NoReply"));
|
||||
ASSERT_THAT(e.getMessage(), AnyOf("Connection timed out", "Operation timed out", "Method call timed out"));
|
||||
auto measuredTimeout = std::chrono::steady_clock::now() - start;
|
||||
- ASSERT_THAT(measuredTimeout, Le(50ms));
|
||||
+ ASSERT_THAT(measuredTimeout, Le(500ms)); // Well below the 1s operation time, with headroom for slow (e.g. emulated) machines
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
@@ -19,6 +19,8 @@ DEPENDS += "expat"
|
||||
SRCREV = "ca073434d2c03c2b619f7e23f285cebbf32c7e46"
|
||||
SRC_URI = "git://github.com/Kistler-Group/sdbus-cpp.git;protocol=https;branch=master;tag=v${PV} \
|
||||
file://0001-test-Fix-error-factory-test-for-musl-libc-compatibil.patch \
|
||||
file://0002-tests-Use-a-longer-timeout-for-the-large-argument-me.patch \
|
||||
file://0003-tests-Relax-the-measured-timeout-bound-in-timeout-te.patch \
|
||||
file://run-ptest"
|
||||
|
||||
EXTRA_OECMAKE = "-DSDBUSCPP_BUILD_CODEGEN=OFF \
|
||||
|
||||
Reference in new issue
Block a user