Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1759831rbb; Mon, 26 Feb 2024 23:21:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVq765hGkF7uwvNHNkAn4OoESnnagALXNBPl3IojsbIZaFQ5+12HxTi/HfnNThK4AlDNEDXl17QcGfB9c7sqlhnoymLps58/9v2CK9QXA== X-Google-Smtp-Source: AGHT+IFK6A/xu3WiegB02fliBaNbCAQcoL9ru3rFbRX1l8porwz/Of5EyY3I2XMO/bI4K40NEtVE X-Received: by 2002:a05:622a:1989:b0:42e:616e:e2a0 with SMTP id u9-20020a05622a198900b0042e616ee2a0mr10557788qtc.3.1709018501194; Mon, 26 Feb 2024 23:21:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709018501; cv=pass; d=google.com; s=arc-20160816; b=E7Vhrba96T4tOdTOIqrixI+OwKvHCz47gqPvusQykwookNmpj/KdUly6sWEWAwM0bR sj8zfxL8cX71xo+Cc+IM9Fm3llEO4AfmmNIvdtK5TEXXeDus48X0plE8dbOLMxLKk1/A Dbh2jIs9RkrvoF8ij7AojbqvvNf2zuUQChd1v/9ZaZUbUV91JdhHVPMOSe8Ehjy2nLOy ZQNEx1bQepS/94QqwaiqEQ2VlUv64tPpv8QtbFcbQm50c9CoUwzCftyIRio62EtN1o28 kQb3q6ouhgrxpicMThWJAG/wBktS9p6of5M9lZnDF2Kx5UOligKpBASpZiR9hH5w2QvY 3Pgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=85WV47SfWyLMoKKhzh6lzk8YAM5R146LUr3WPI0vPWI=; fh=kWka3uyEXJOxpv/BDQtf/hDS0AwGQKuLUMsUkyhClmw=; b=i9x6teRuKoLISJado7zDVkjscz6nQFvgNg0QX9M9WMO7U0vkMXdAwW9w+uhjJ7vZfm oj3dPDxOJepzEmk8/5HX41pruHIOB/lCacU4zNlnyUxo1aBRqs5qngZSqNwyk0GzbjPO R8QhHfkE22z+qOUkE1tw6cVpqYi6793CJhdqH2XXMuQqaTIPHpzM34CyqeZluKnQHLv0 /Ytd3JWnLtkFdtW6+I8E5HCEVzkN2od8u3ISHiHz+LNmHGaUQFsE+8nTVDZuOZfdpQEE rLG3nd4efeh5+KbJ9BEWLtk1vOpKTqEi6pDhzMBf2yS3RUXPHbI6GRjnnsPUFq2CMzJP tVtQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JsJCR3SD; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g11-20020ac85d4b000000b0042e876ed778si3984216qtx.735.2024.02.26.23.21.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 23:21:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JsJCR3SD; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82793-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2BF821C21D87 for ; Tue, 27 Feb 2024 07:21:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E189B54BC8; Tue, 27 Feb 2024 07:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JsJCR3SD" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11BF654773; Tue, 27 Feb 2024 07:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709018483; cv=none; b=PbcTF9pS/FhEQe27Wb5Wb0BQ9oaKcN3QFxKjVnFufYRZFiCF01u+YqBrIkBe1pvuKxHa+c8gUaTD+kRJKOF+aukYbHkZwj6TMuN9py0OUbDe6g1zDcBLi1M0C71npeEq5sWDAJXc6V3iDEQhqYDCGDydB6cFRbdYZtscWWA7Pyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709018483; c=relaxed/simple; bh=eyHnjXu7WGSZ0UNxWS23nd5JkzfMeoOXZM66Ci71oNQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=P2dga96eYdGLshQH0aWBtumOjtL9gLOL5Sl1Qi7Rqo7SL7lH7A7K/wBCMT+aOlfRs3h87Eqmsv7SCpiyY9Gpl8Hrakqkqn81wiJ+ukorv7k1khPz/TG2d/6+HPRIbYTL72rTn1RQC+Q8gqbzYQke3pQ1TQdNpRokabPFvPxEe8c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JsJCR3SD; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709018482; x=1740554482; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eyHnjXu7WGSZ0UNxWS23nd5JkzfMeoOXZM66Ci71oNQ=; b=JsJCR3SDxQxIogO7VviZrkshmlkTMC+Iq3HzYf0IHVp7RVCfe/UZ6iUK nJZjHFqGay4Z/gBwEvv498Ux3Rwm+HjepuS07DEwfM6lgrFXYjJDjGptn LKb+Ho1gLbdv9gXRuz0kT+nX8AjvCgBxggmH6yIpYdXnV4REZORCH/3Qp xWqAgqE9z6bjdqycbI+1hxz1spHw69iu7LFxi+ffjP2UxWpI/H2b2apwS G6LhNbOvh1GNdut7HsMS8+RHP2JK1fOVnR7rx358F8Ihjk1go7/r+40Vu lHESyc+1uxhuCMM90ttw0bQTKmngFkM7fgxjHpFsozj7kdbY6zVRnJilp g==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="14785185" X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="14785185" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 23:21:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="11722547" Received: from lzaleski-mobl.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.4.236]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 23:21:18 -0800 From: Maciej Wieczor-Retman To: reinette.chatre@intel.com, fenghua.yu@intel.com, shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v5 0/3] selftests/resctrl: Simplify test cleanup functions Date: Tue, 27 Feb 2024 08:21:00 +0100 Message-ID: X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cleaning up after tests is implemented separately for individual tests and called at the end of each test execution. Since these functions are very similar and a more generalized test framework was introduced a function pointer in the resctrl_test struct can be used to reduce the amount of function calls. These functions are also all called in the ctrl-c handler because the handler isn't aware which test is currently running. Since the handler is implemented with a sigaction no function parameters can be passed there but information about what test is currently running can be passed with a global variable. Series applies cleanly on top of kselftests/next. Changelog v5: - Rebase onto kselftests/next. - Add Reinette's reviewed-by tag. Changelog v4: - Check current_test pointer and reset it in signal unregistering. - Move cleanup call to test_cleanup function. Changelog v3: - Make current_test static. - Add callback NULL check to the ctrl-c handler. Changelog v2: - Make current_test a const pointer limited in scope to resctrl_val file. - Remove tests_cleanup from resctrl.h. - Cleanup 'goto out' path and labels in individual test functions. Older versions of this series: [v1] https://lore.kernel.org/all/cover.1708434017.git.maciej.wieczor-retman@intel.com/ [v2] https://lore.kernel.org/all/cover.1708596015.git.maciej.wieczor-retman@intel.com/ [v3] https://lore.kernel.org/all/cover.1708599491.git.maciej.wieczor-retman@intel.com/ [v4] https://lore.kernel.org/all/cover.1708949785.git.maciej.wieczor-retman@intel.com/ Maciej Wieczor-Retman (3): selftests/resctrl: Add cleanup function to test framework selftests/resctrl: Simplify cleanup in ctrl-c handler selftests/resctrl: Move cleanups out of individual tests tools/testing/selftests/resctrl/cat_test.c | 8 +++----- tools/testing/selftests/resctrl/cmt_test.c | 4 ++-- tools/testing/selftests/resctrl/mba_test.c | 8 +++----- tools/testing/selftests/resctrl/mbm_test.c | 8 +++----- tools/testing/selftests/resctrl/resctrl.h | 9 +++------ .../testing/selftests/resctrl/resctrl_tests.c | 20 +++++++------------ tools/testing/selftests/resctrl/resctrl_val.c | 8 ++++++-- 7 files changed, 27 insertions(+), 38 deletions(-) -- 2.43.2