From patchwork Sun Dec 6 01:03:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 107520 Received: from mail-dy1-f175.google.com (mail-dy1-f175.google.com [74.125.82.175]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.492.1796519026660618831 for ; Sat, 05 Dec 2026 17:03:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20260707 header.b=u2PcWeWc; spf=pass (domain: gmail.com, ip: 74.125.82.175, mailfrom: raj.khem@gmail.com) Received: by mail-dy1-f175.google.com with SMTP id 5a478bee46e88-33fb4680717so1121892eec.1 for ; Sat, 05 Dec 2026 17:03:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796519026; x=1797123826; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=4n4CkC4D8jyipn8YuPGFRQ0p2fA/5Q0aq0N+JsiMIY4=; b=u2PcWeWcaZzhhHb/RbRVB9UP1azQpixWkkA+RU+PIi0D4Gl8VbYEOpUpiRuo/PoJIR DO62hatGKcYJ20NAh0iQUT8fYupfx5i31OvYD90XIvt1TOmmn/mnQwSU0kr1IdyJkiT/ uD9zm61D/KYzygvGe8LLNhZSuzBzsSQukWCTC8r92spFMu6hywUcZI1Yvo/ykk8yR/yI hZZJg2xEZtaOR9R3KtLe4s/BZdsv1CrBen1n9GC4Jy6ACtGYDa+QUXYXbimgZqNQBbXF D6fbURcMSf0ITDcKnlNts0a/7ezP7qzkFCjTNnQeoJHnrPBiQSLcZwZy/2q5BGO1oFsL hrCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796519026; x=1797123826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=4n4CkC4D8jyipn8YuPGFRQ0p2fA/5Q0aq0N+JsiMIY4=; b=wkto+7ha16uNDUwqeZWcyxn4xKEjDE2UuIN2C7ae/XFQcgOKFMA2U+SXJLXhEnZWQH eB4IT/GD7CLMsPc8Fshn6RKckm2CESwo6LkRvk/kRn0BO3UgXbXUfXcpoF8871Jh4f9o dFYL46Y0t0kvhIqNAHkgSyql0wU6bfsquRRP5IFKhPCQls82vKGCN+25FI+P2h+5yKAg 19bH3tLKtLv2A7n1daUFN/SfxGITC5afUZ7pL8EpTf8zwqo9zXojp4gcNREL+ZZgNn4T x6t+nlMTtKYgRfa8GplXkAZNNSibopC61sNgggTT2T37voCGd30q0jE0DAqitgDDMY5V sCeQ== X-Gm-Message-State: APuU4Z8h/fGjQoTlnEvOrOym+5imz7RY46MpuMLsLppcMRqKi/AupSbW rvt5biz0y6iBKjOonu70v07TtcqqxILQ4XU7jko7IP8TjBlgQb/qiSabMrpAn0TRXGYGjg== X-Gm-Gg: AZFdTZfbkLzn6e1JFmoMv0XNHkXb2xZ0Xg8dsgiX8vaGOFjnEbHUtayDTxaC+V8EmSP Lf4pdTKf4Fk4mKASawphJL43lKNshjIIG3yf4CwrIGvO1YPrDEJBmBqawX6X2ljMiCHuepr4y9v s/hKg8Mia86o7yNdxy+2oEbdO17sLVpNiQG9KVS1tVvxF8pza7nhyy/5zvuq5PuaaEQDbqEaF+l n9QWdQF5fzSfwAdwCYH+yuZl9QiABnetNB8HxlQtj+WkBpatQmgv/iPq4c1URuMuz45hHXXnEe3 8ua4STakyhk64Mv+05f7YbEP3XLNUoyHndcsqTROz5jRT63uuOynbm8Zo8L9S6xtQH8MmBC45Wm DS0qrMKM+65lOCbc89dL8jDFGm2655w83KjpXw695uSzHK7SXn6hp7Pke4yPMttOeKiD94khUis 4M28Ze7UVEBA7YEb+q4sNeryYJuybo9s6/UurlTEbTL4Q6o63vgpId0s36MPgYyuGpPSRFVt4IH zWxeCwbRZiXeAMN08yBSuOxJFS380XJ4psIbsWDZgr6LfhZebc+BonOFzcWbXHsh8ULguSLAmV4 AQ4h9JqP9RwBquACzLDotw7Fixl/+A9Bx7Vk3Km4wIQsJiTgr2Lcvwu8ysdsZAIWN8PxMHT4g1+ 0VQXPvB3SPrvWzskUn2K9kQAoEovu3of9JAE9CndY68DwqbanumqiqlGqX2+dYM7pqrTnzG2QkV Qd93mGCUsd+OgrDZJaHTaaxRPmQAuEMRbUpwcRFe1ZuJouls7tYY1vs9KKknY2CxjGH6fNhhPdH ZGgivfB1LPzKIWe3ptB4E1OaOKUGDT/QmoxTBOiZtoSku8OqUvZEG6i6a6f8oOK4wycZXXwC5KF vXmR X-Received: by 2002:a05:693c:63cf:b0:387:4b50:f0e7 with SMTP id 5a478bee46e88-3875217d870mr6571934eec.32.1796519025626; Sat, 05 Dec 2026 17:03:45 -0800 (PST) Return-Path: Received: from apollo.tail3ccdd3.ts.net ([147.160.63.35]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3875226fa94sm22980313eec.29.2026.12.05.17.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2026 17:03:45 -0800 (PST) From: Khem Raj X-Google-Original-From: Khem Raj To: openembedded-devel@lists.openembedded.org Cc: Khem Raj Subject: [meta-python][PATCH v2] python3-yappi: Fix a flaky gevent ptest Date: Sat, 5 Dec 2026 17:03:43 -0800 Message-ID: <20261206010343.1254178-1-khem.raj@oss.qualcomm.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261205080524.1026093-1-khem.raj@oss.qualcomm.com> References: <20261205080524.1026093-1-khem.raj@oss.qualcomm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Sun, 06 Dec 2026 01:03:49 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-devel/message/134116 test_context_cbks_reset_to_default expects the worker thread, which burns 50ms of CPU, to sort before the main thread by total time. On a loaded QEMU guest the main thread can use more than that while gevent creates its hub, which swaps the order and fails the test. Look the stats up by thread id instead. Signed-off-by: Khem Raj --- v2: Upstream-Status is now Submitted [https://github.com/sumerc/yappi/pull/224] ...ts-Look-up-thread-stats-by-thread-id.patch | 49 +++++++++++++++++++ .../python/python3-yappi_1.7.7.bb | 1 + 2 files changed, 50 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-yappi/0004-tests-Look-up-thread-stats-by-thread-id.patch diff --git a/meta-python/recipes-devtools/python/python3-yappi/0004-tests-Look-up-thread-stats-by-thread-id.patch b/meta-python/recipes-devtools/python/python3-yappi/0004-tests-Look-up-thread-stats-by-thread-id.patch new file mode 100644 index 0000000000..bd2ef59ecd --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-yappi/0004-tests-Look-up-thread-stats-by-thread-id.patch @@ -0,0 +1,49 @@ +From 11b7485d904da0fe2c5f3dc9bc71285a99b57f05 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 4 Dec 2026 18:30:56 -0800 +Subject: [PATCH] tests: Look up thread stats by thread id in + test_context_cbks_reset_to_default + +The test assumed ThreadA, which burns 50ms of CPU, sorts before the main +thread by ttot. The main thread also accumulates CPU time while gevent +creates its hub for the greenlet, and on a slow or loaded machine (e.g. +a QEMU guest) that can exceed 50ms, swapping the order: + + AssertionError: 140529029749696 != 140528074962624 + +Match the stats to threads by tid instead of relying on the sort order. + +Upstream-Status: Submitted [https://github.com/sumerc/yappi/pull/224] + +Signed-off-by: Khem Raj +--- + tests/test_gevent.py | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/tests/test_gevent.py b/tests/test_gevent.py +index ed9e6ae..882d51a 100644 +--- a/tests/test_gevent.py ++++ b/tests/test_gevent.py +@@ -151,13 +151,18 @@ class TestAPI(GeventTest): + len(tstats), 2, "Incorrect number of contexts captured" + ) + +- # First stat should be of threadA since it is sorted by ttot +- statsA = tstats[0] ++ # Look the stats up by thread id: the main thread can use more CPU ++ # than threadA (e.g. while gevent creates its hub), so the ttot ++ # order is not fixed. ++ stats = {s.tid: s for s in tstats} ++ main_thread = threading.current_thread() ++ self.assertEqual(set(stats), {t.ident, main_thread.ident}) ++ ++ statsA = stats[t.ident] + self.assertEqual(statsA.tid, t.ident) + self.assertEqual(statsA.name, t.__class__.__name__) + +- statsMain = tstats[1] +- main_thread = threading.current_thread() ++ statsMain = stats[main_thread.ident] + self.assertEqual(statsMain.tid, main_thread.ident) + self.assertEqual(statsMain.name, main_thread.__class__.__name__) + diff --git a/meta-python/recipes-devtools/python/python3-yappi_1.7.7.bb b/meta-python/recipes-devtools/python/python3-yappi_1.7.7.bb index 9a0a38b9bc..8c4546fe76 100644 --- a/meta-python/recipes-devtools/python/python3-yappi_1.7.7.bb +++ b/meta-python/recipes-devtools/python/python3-yappi_1.7.7.bb @@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=71c208c9a4fd864385eb69ad4caa3bee" SRC_URI = "git://github.com/sumerc/yappi.git;protocol=https;branch=master;tag=v${PV} \ file://0002-Fix-import-of-tests.utils-to-enable-pytest.patch \ file://0003-Detect-suspended-coroutines-on-Python-3.15-and-newer.patch \ + file://0004-tests-Look-up-thread-stats-by-thread-id.patch \ " SRCREV = "d6593ea0bce0a13c65bd44511c3cee858b5985e8" UPSTREAM_CHECK_GITTAGREGEX = "^v(?P\d+(\.\d+)+)$"