From patchwork Thu Feb 22 10:04:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maciej Wieczor-Retman X-Patchwork-Id: 20781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp149330dyb; Thu, 22 Feb 2024 02:04:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV9XO8EyjOsphBwkGymckPffGe8xXM7iTlqwtoLu9tLykmR5QoS9PFHl92v6XexyZKWhkmN+4coljhV/7zb37XB9JzWxg== X-Google-Smtp-Source: AGHT+IFZzC6JDvSJ6k8cs9B8rnLk4+R1qN2kXQ3glQQmZKtFx7B6hm7qoYoNRqVl1Su6OzPnrzMT X-Received: by 2002:a05:622a:1048:b0:42e:28a6:2760 with SMTP id f8-20020a05622a104800b0042e28a62760mr8414659qte.43.1708596292936; Thu, 22 Feb 2024 02:04:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708596292; cv=pass; d=google.com; s=arc-20160816; b=dx93VKPAP/gw8gPsmWTTdgb7QPrpOwcjP5xeLdkz8yPx2/lFBLAi7NvUli/Bx1hxvq zqSyIGt8o6+BMDXmMCPvp9PA46DI+hsmTnSEW2/nfQyoNRdOTDlJxG/Ie0YT3gCU9fbn uT5ZAUiO0kDouLjrJ948CIzw8yVShWhYtz00TWLm2w9HWICJZOvAvvJG4u8Qodn+EO+V R6vvXdM8jNFHL6QvvKFn5ToatcOF/Mmi+tqBBIyu6YXsvQMxhOzpE17c3U7I6lKUYgCx 9FG/f3Oa9Z3277DjOjPoQVAoYIeY6TU4++QUFt/FwVs88A37awCMgc8Wb12EH9QZ2Sf6 YNNQ== 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=vk51La7Zz/Ds1lS5qE0uTPFO/o9owqCOmYaulhOXr6g=; fh=fnwFv1nS+x8hI9pZ0wUR4YbmriHn0jk42nwaadNtlEo=; b=Mtb5v9ZM0c8+CFbKTbru/fqjqoK0B66bSZVNmpswboocOpuJuDCX8lPC8p09q2R70n njedPmcjracYMCU9VXoysVKGjP3nLq0n7pPriQbAXToaoOMCso+aByecz5lMtbEWTOaB igENP05gmRoeQ4t4vCvpXLgwb/S2SeFMnEBHS54/zWD+59OxOmVTCeLeeE640VktrGEL ExmesFLJJe1XuJk0ec5vLZZa7QSPycykZ5ANVf7m6Mo3Nm9XbcIqjsNoSAbpVmJ6A1db v5xDvFsRjEJEQWmPs8nU4HQY+hUssuQXlQ0u7PtA/fGdIdCu2f0T6fBm4LCI9AeQv/Xm VoLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IIKWXmLS; 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-76288-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76288-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v35-20020a05622a18a300b0042e4fa976c6si621260qtc.365.2024.02.22.02.04.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:04:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76288-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IIKWXmLS; 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-76288-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76288-ouuuleilei=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 979C81C235EC for ; Thu, 22 Feb 2024 10:04:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E6633C06B; Thu, 22 Feb 2024 10:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IIKWXmLS" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 BDB1C1799E; Thu, 22 Feb 2024 10:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708596260; cv=none; b=V9C9kLKP4LV/FmgsCHq/RrBydPhNPuzkpe9sKIKzWQrSleBxJ3Igs5TKWXBGrTFQ1KVPs1CX1DglrrllStodFRaAG4cf75rt9kXq/Kmt5s1s56mWKU7N+zRyHPrEp9fBY5xj6Clz83Ej7booIIIXiRs5XWUd25cKJ5oQQEZuBZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708596260; c=relaxed/simple; bh=mFZJs3BNxqZD9cGaYuH+MQZFDULSQkw1Nio/NpslbwA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=N3s2zhRIQ4pPIPKlfFVAjnKtlapAFfaTs3DL8XDcDuuAPlhFynEsfPIWGw1qOeXE1Ku2lQoIHfEiP7yMIWiSCKmsK3QcK0hP604nlJVgLhWH2AL3QeQKui5AIcW4Jhf0Qu5nuC0x5Ta0p04guKftBEOcYcy3u7aNW71e3l1CNnc= 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=IIKWXmLS; arc=none smtp.client-ip=198.175.65.21 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=1708596259; x=1740132259; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=mFZJs3BNxqZD9cGaYuH+MQZFDULSQkw1Nio/NpslbwA=; b=IIKWXmLS5OSUIbVqws1USm9svKPJRouFLVPSsfBSzYsI2CbP/4xPhNyo ZXqPO0js41aCTRjljIfsgWU2jC44Xi8PaVskYEkzrJZ2e4BfmmPPSR2Kd 76q33WH/bkiUJ548cCllpR4YP6wb/gh21T3bxt4UMJmIns+adam/UCBJ2 qfByiiYCyV3eKUY+yoJixVO0OvKcoQUVYqRd/E3DN6UdMRNSuStaLNfmH zQWBro4UCPDGYW1S0q7bAH803ClnJF6fCv760rrCZMaNDCWn9HsbDLCUj aIs6RsMWZ+iWN7S+ntH7nvzk57R1DaIwk2+9WfOMHolQuzfOlkdP7uAzg A==; X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="2726872" X-IronPort-AV: E=Sophos;i="6.06,177,1705392000"; d="scan'208";a="2726872" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 02:04:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="913493583" X-IronPort-AV: E=Sophos;i="6.06,177,1705392000"; d="scan'208";a="913493583" Received: from ksulimow-mobl1.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.23.120]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 02:04:13 -0800 From: Maciej Wieczor-Retman To: reinette.chatre@intel.com, fenghua.yu@intel.com, shuah@kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v2 0/3] selftests/resctrl: Simplify test cleanup functions Date: Thu, 22 Feb 2024 11:04:03 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791593066232550805 X-GMAIL-MSGID: 1791593066232550805 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. 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/ 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 +++------ tools/testing/selftests/resctrl/resctrl_tests.c | 16 +++++----------- tools/testing/selftests/resctrl/resctrl_val.c | 6 ++++-- 7 files changed, 23 insertions(+), 36 deletions(-)