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 58BBF4608D; Wed, 15 Jan 2025 16:43:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D7E1140298; Wed, 15 Jan 2025 16:43:47 +0100 (CET) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by mails.dpdk.org (Postfix) with ESMTP id 194DC4003C for ; Wed, 15 Jan 2025 16:43:46 +0100 (CET) Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b9bc648736so584728885a.1 for ; Wed, 15 Jan 2025 07:43:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1736955825; x=1737560625; darn=dpdk.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; bh=B+4yHXD/+uJHPR1lkbAsTm8nmuMIg+GdnlvHrXe6fY8=; b=CZ9ZhipqHOPK5OHdu9++s3+YLkxji++U32lBowZ2LctWBmQ4RaV7JIwfWBeqouo/37 FjKwHQBy2A/p+9R5Be03nfu9KzYxKT/hs1VANfyqyjm1e8twvXpZs0ZorFIuU2MC1M7z HWhHlMF/cwjvcZVdLCYLPSogrVndCzP6aGX0Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736955825; x=1737560625; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B+4yHXD/+uJHPR1lkbAsTm8nmuMIg+GdnlvHrXe6fY8=; b=nJN+d39caLXInTcFoNivuyJa+mftzBc/AE34flMDpD2ebsPP8N8dvwXpiftJbpDJZD 4pKoTM2HFuc2YPPohaIxZXnteh7I19OMXAGAisMGes3bDVtRQ7tC5K+f8o6buh8kqFuG UIqU8GJWhRfeFqO1Y6WUHjZ1a7JwHIvLspz8C7SGmAK0jPuTuv7HR/gQ9ZDuwOsouBoz mDRkDcDz0gqQvi/OiYb9MLQ9sk7i9QWOPR0fROE4zsRVlKP4TBAEdREk1IDlO0sPwyEY CM7gs5Ke9CgFL+dl6CbpnT/kS8hHL64A3ByzCmb1LRjOs1w4GXkJi3dK8USdS55wOZva lv+Q== X-Gm-Message-State: AOJu0Ywn72RXvZ5/opNnMkV98h5rBdqVsm3qf2894zREPs8i8YYoi9Qw XkyN9P5PTTz/P/fvVXO6Bl6bvARIBeP70+H96VgPzNw3VLoN2lkZMKVIuUidJlE= X-Gm-Gg: ASbGncv8czvIAUguRq3GG8qqmQULPS6OQfgH6XCBUK2j7LAWmz5HFcP1TwA+eBHMp8r H1fgucn/rpCtQjgK6cgBE63GLmwKoAZ8lXP5hD6xlwXsECie4eorQpIhpDlcCCO1ekBjtAzi6BU yShn9IijD1jUcN5LODtHm5URfdQBLJlxkSC3jA5qRf8XD2mxXKo/MlCV4Xe1th+8Sz3dLY40m7s KO6GLE+lCD35eeK+LJ09TAMrEvejGPvqJXCsYOU+B02e+55JzIBcC163BiFgCFEO/BF47cUJXdX WoHfWSXqMkQDZRK9/tulIo/4hNs= X-Google-Smtp-Source: AGHT+IFEvvrYGY2QpMag+/BkzkgnQ8E/T6ms2GbK234INn9HCJxT4AAIvNcbFQJz38G4cwyzy9R9DA== X-Received: by 2002:a05:620a:29cc:b0:7b6:dd7a:9716 with SMTP id af79cd13be357-7bcd96e5ed9mr4746248885a.10.1736955825384; Wed, 15 Jan 2025 07:43:45 -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-7bce3503263sm733570485a.72.2025.01.15.07.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 07:43:45 -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 v2] dts: fix pass rate edge case in results json Date: Wed, 15 Jan 2025 10:43:45 -0500 Message-ID: <20250115154345.23790-1-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250113215230.13942-1-dmarx@iol.unh.edu> References: <20250113215230.13942-1-dmarx@iol.unh.edu> 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 | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dts/framework/test_result.py b/dts/framework/test_result.py index ba7c1c9804..45fc2e8241 100644 --- a/dts/framework/test_result.py +++ b/dts/framework/test_result.py @@ -324,13 +324,10 @@ 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 + ) + return {"PASS_RATE": test_run_summary[Result.PASS.name] * 100.0 / max(cases_not_skipped, 1)} class DTSResult(BaseResult): -- 2.44.0