From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 655C246075; Mon, 13 Jan 2025 22:52:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0196A4025D; Mon, 13 Jan 2025 22:52:32 +0100 (CET) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by mails.dpdk.org (Postfix) with ESMTP id 0078B4025A for ; Mon, 13 Jan 2025 22:52:30 +0100 (CET) Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7b700c13edaso266153085a.3 for ; Mon, 13 Jan 2025 13:52:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1736805150; x=1737409950; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JsvtGnZk/Qj43cJlrCVOwEJ5NETk2Kdvs5cAO9iBLNc=; b=c4OkeSI58zNl9owXA55hBCzNY5Om20MMjrQG9DjyKnPu/9V0Kp42uFu2QsZ0lQxZRK Q+PCeENPe0wEgUbCnj9Jum5u0B2GHU3ek7qklFhaX7AgSYR6nk8Pz2TI6g7UZs4yaUzk dvf3k6iZ9vzMOtMrAldyGrk+DRTy0J164F4As= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736805150; x=1737409950; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JsvtGnZk/Qj43cJlrCVOwEJ5NETk2Kdvs5cAO9iBLNc=; b=fP7dkJk15bfKc4H1JelE0Qrun2hqx74NNBHj2PSlqBCSwptsVNdO3Z8e7zZZHNvUn9 xZo/92kl2czxHohjFNLHZhxOETA8chz7h1R7iGCRMWi8Ipe5La3chwvdt5KvFwT72B2S Cj3C7FHku3w4Y4jevwLs5KRCSoQ7Ps38CKVi5er3tdzMHnbI+YU3i3hxeueUn9pA9uK8 NRPjqfbQXfcoIP5CkJMkHwd5LJ5oMvARg5ZE+tzUg+ZyIzxP57Fqt0/ieuAOFTD1ZfaX xD49X8DqC5C34gsJJOWlc4pumsvMZnrW66Ay6lkN/sio3G5RFqAUwTBMxMKE0SX1e8jN orTA== X-Gm-Message-State: AOJu0YwQdBkhjE36i/8CId5itCPiHddLm1T05cKfAHLBke9gaJMOsosS sps8olnMJEnMOLc60aNLVctdJYM53viP6RZ/79GQbS0GMBiG3DuI4k60ygWoNgg= X-Gm-Gg: ASbGncsI+7earNSJMUDg+aY3XFUN30QWSkm4q8Y4c5DSyxXJaXFy/JF4j4jZrw8iqeh 5FOzXMrwLb+4HSnLOvG38twaD58RHs5t66jlvrNWmdU2c+sTOwk0D65cLvWtrqhIQA7OenOZfAc Y/aQYH7ZNIjArs3S//v32IiGQCGBt87sNWdih9rz2EMCPRzMe/MicTW+LRlQMPEZIaNWSlnGbN8 jhBWYs6Hf6WY+p+zmQJZIOu1h/5DFLwJEj7bLGZPXZ6PIFylFwB28efJa59iQqWL+gGgvVrZ6S9 a4sE6FIvLPIl4+eZVjoVVqBDXCI= X-Google-Smtp-Source: AGHT+IFi2FyaMvlYeERrA91p0H3sWimh57S9PHMrYhLp29lJW8ZiTmEUiXBezSLbjUOoDDHrqv6nYg== X-Received: by 2002:a05:620a:4624:b0:7b6:cfab:9883 with SMTP id af79cd13be357-7bcd96e8a7cmr3361879285a.8.1736805150248; Mon, 13 Jan 2025 13:52:30 -0800 (PST) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7bce324736esm532766785a.27.2025.01.13.13.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 13:52:29 -0800 (PST) From: Dean Marx To: probb@iol.unh.edu, npratte@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v1] dts: fix pass rate edge case in results json Date: Mon, 13 Jan 2025 16:52:30 -0500 Message-ID: <20250113215230.13942-1-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add condition to results.json pass rate generation method which returns 0 as the pass rate when the suite is skipped, rather than causing a divide by 0 error. Fixes: 9f8a257235ac ("dts: improve test run result statistics") Signed-off-by: Dean Marx --- dts/framework/test_result.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py index ba7c1c9804..aed20981b2 100644 --- a/dts/framework/test_result.py +++ b/dts/framework/test_result.py @@ -324,13 +324,15 @@ def generate_pass_rate_dict(self, test_run_summary) -> dict[str, float]: Returns: A dictionary with the PASS/FAIL ratio of all test cases. """ - return { - "PASS_RATE": ( - float(test_run_summary[Result.PASS.name]) - * 100 - / sum(test_run_summary[result.name] for result in Result if result != Result.SKIP) - ) - } + cases_not_skipped = sum( + test_run_summary[result.name] for result in Result if result != Result.SKIP + ) + if cases_not_skipped == 0: + return {"PASS_RATE": 0.0} + else: + return { + "PASS_RATE": (float(test_run_summary[Result.PASS.name]) * 100 / cases_not_skipped) + } class DTSResult(BaseResult): -- 2.44.0