From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 84B4A80275 for ; Mon, 31 Aug 2026 22:53:04 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 67VMpmeT031050; Tue, 1 Sep 2026 01:51:49 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67VMpmeT031050 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="QfsKnq1E" Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 67VMpf0M031025 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 1 Sep 2026 01:51:41 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 67VMpf0M031025 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-490a767c7dcso28300425e9.2 for ; Mon, 31 Aug 2026 15:51:41 -0700 (PDT) X-Gm-Message-State: AFuF++n5xnW0rpL5V1fb9sWv8sHi5jHvFeER07T+alqVhrFHUgRSQzTa iysp6RODB+Cw25aeIo3dZ6oHOaxTUbfKGQtcMKTUhMz1vpCtIpa6NhHCnlrV962z0vvl2U2/5Cb r2PmOJYc/Jm9IaDtSEXQ6VvZolBpLpsfO5k1nW64LK1zgxTmCqQ8CiA== X-Gm-Gg: AR+sD11pRRjKYk2hwgqNhjMGfC9mlKVgshB4t/01VIL8WELBxYQKqKiRoThzHBc38Ys Kea8UbDeJgwPCQfRacfN1T8+jmjb4U1SClAPjaJHOLCjWVz0Merc6nDuen2WXcK/t7rNsWu4wTN zRhsT98fNCttsKFhlcrXIOH43Mq63Jimjva21XL7CIAgN8oXF+LJIajVQQDKeei5TqfRq2ZMZx1 d13n0/WuDpd2eF3uORjsjEiaZIa/k49EIP8jra1TTk+tqoZ0vHHP/X7pjZuP6y6T3C191o7C8RE G5gct2b/+v5K/50BcOvXlx3hkF4r/FRO7K6cEmSq/7OOS27i5qRyFnub0yGRp/IDsWY8HJj3mjx pjUjQy4lldwI1KivHk+zifkHB X-Received: by 2002:a05:600c:8107:b0:49c:d26a:cf70 with SMTP id 5b1f17b1804b1-49cd26ad005mr255636275e9.15.1788216700751; Mon, 31 Aug 2026 15:51:40 -0700 (PDT) X-Received: by 2002:a05:600c:8107:b0:49c:d26a:cf70 with SMTP id 5b1f17b1804b1-49cd26ad005mr255635795e9.15.1788216700302; Mon, 31 Aug 2026 15:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1788216700; cv=none; d=google.com; s=arc-20260327; b=injxdf+Ekf/b82fGKwESYH6zb9mNdA/YP+gLzgKzjKFECFvphu6ZVGlxM2GKK6Tx6d 9TQAS34bpvFZEaMFMOWRHnWgHY4eiPIpJa6AnrDp7hSdIU5rwUSVKYYcptmvhMmVu6/J gT2H6j+QE8lomyrkqDbWsOH49bmuW9KDIE/aoMG0SjHtb5ySAHwdo/MMPd5gcWwAQyI9 M8RkZK9Yg2h6vHmP+WwoXZAcDhHU/ay149URekyOH90a6U0Dj/4vzPA+z3fkUCsC+a0C AF3gFgRK/Ftc3ziS2ZTcBw7PxNBbl9oebdaQ15RYUcwImFZEZ6uSIGL+nT5UoV78F7xr +U7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=pHbTQfRabmI5IIfPETqWLibhzhWcMgSbINTWnLlWqgQ=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=ba49ZCoNoJptbPcYsAahsCUfjkuElQMufIcomYpJNwCSsjqyScqA5NUNeSdF93GZ2A asMTB8uToVDlAOL6Q5Id+E6yC/J69YUq1AgsBdQAgqAzTtmdIfPMd2Ykw7msN9Q5womE XAmNVWCqWZ6ipzt3G26ZGlkvRpixKgpDBjhexwlqwMydMMSyRzLD0Gpce6TMy8RkVvsf 0kmvk8sPLaBRGJpruf693Na9rNMGp+9euD6N2aizOkdZNTrZPNA7ly4i+5IBo8VpjZeN 2W/dCvFpHtXQNMXsqm/sCaOLjT/biX0AHzC2SPfhRh7hlQOxObR1FfGfbBEWvjNSrM2L GSQg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=QfsKnq1E; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48442d71bccsi728816f8f.191.2026.08.31.15.51.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2026 15:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=QfsKnq1E; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=pHbTQfRabmI5IIfPETqWLibhzhWcMgSbINTWnLlWqgQ=; b=QfsKnq1E6n1H jgj+1TgRLhM7FuGEt0Jx7jk5Uq0LC2mF51IV1Zj/YASs4eQxjWzGSzXRzkfUyj1jB9+7Kcywy+40x Eg94gcRiIEE4J8flofxxOyCclSRa4T0SXXPvCjK2bidMFPPg1KhhtxgPN81GgxXt3KYO/b3r2T5PR ou4x9RUN0aiQGHPxuEyZWOzHTYFY6ng3SEi35CnX82ssLUBKd9KyDIj0VOYZM2y9/AEo9oNzyqm3b zWZ7aCSbQzMlhSR2EKe3HQ+wBeSxsIu18vsQyMhzIaKPxFcmulftBATXcZLopUuszj/yUa7Ipn0N3 HatFNRRvX6nxZt8isMUQaw==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1x1AoT-009n0b-0l; Tue, 01 Sep 2026 00:51:31 +0200 From: Eva Kurchatova To: khorenko@virtuozzo.com Date: Tue, 1 Sep 2026 01:50:53 +0300 Message-ID: <20260831225137.1642608-3-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260831225137.1642608-1-eva.kurchatova@virtuozzo.com> References: <20260831225137.1642608-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH vz10 3/4] selftests: net: py: report a refused environment as a skip X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org A KsftSkipEx or KsftXfailEx raised outside ksft_run(), which is where an environment check belongs, reaches the interpreter and is printed as a traceback with exit status 1. A test that only wanted to say that this machine cannot run it is then reported as a failure. Install an excepthook that turns those two into the "1..0 # SKIP" or XFAIL line the runner expects and exits with the skip status. https://virtuozzo.atlassian.net/browse/VSTOR-139651 Feature: fix selftests Signed-off-by: Eva Kurchatova --- tools/testing/selftests/net/lib/py/ksft.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py index 61287c203b6e..332f8c105512 100644 --- a/tools/testing/selftests/net/lib/py/ksft.py +++ b/tools/testing/selftests/net/lib/py/ksft.py @@ -10,6 +10,8 @@ import traceback from .consts import KSFT_MAIN_NAME from .utils import global_defer_queue +KSFT_SKIP = 4 + KSFT_RESULT = None KSFT_RESULT_ALL = True KSFT_DISRUPTIVE = True @@ -278,3 +280,28 @@ def ksft_run(cases=None, globs=None, case_pfx=None, args=()): def ksft_exit(): global KSFT_RESULT_ALL sys.exit(0 if KSFT_RESULT_ALL else 1) + + +def _ksft_no_tests_ran(comment): + print("TAP version 13") + print("1..0 # " + comment) + sys.exit(KSFT_SKIP) + + +def _ksft_excepthook(exc_type, exc_value, tb): + """ + A test whose environment refuses it, e.g. one that needs a real + device and is handed netdevsim, raises while the environment is + being built, before there is a ksft_run() to catch anything. The + traceback that then leaves main() is reported as a failed test, + although the test never ran. Say what happened and exit the way + the kselftest runner expects for a test that did not run. + """ + if issubclass(exc_type, KsftSkipEx): + _ksft_no_tests_ran("SKIP " + str(exc_value)) + if issubclass(exc_type, KsftXfailEx): + _ksft_no_tests_ran("XFAIL " + str(exc_value)) + sys.__excepthook__(exc_type, exc_value, tb) + + +sys.excepthook = _ksft_excepthook -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel