Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp239585rdb; Thu, 22 Feb 2024 02:04:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWgzTQp9aqcZwbFphSskMOcEv9WpOUitzvBe6/oGR5L7zF7dZIlLox6nFy5E2VcBKaSmOrpf8/qsmD5E4iU0Qgw1bU6t3lyk1tT3NjkJw== X-Google-Smtp-Source: AGHT+IFIxnl6aBxE9W3mzPjHdaMQuTboX1pMivMZMKMyTeEf6/poy6ynSUSjYqBnSb09N4/t0pjt X-Received: by 2002:a17:906:c2d0:b0:a3e:5856:9b03 with SMTP id ch16-20020a170906c2d000b00a3e58569b03mr12428214ejb.18.1708596281166; Thu, 22 Feb 2024 02:04:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708596281; cv=pass; d=google.com; s=arc-20160816; b=rHafWOGBM5n7pr6kbag583F6bLfMvHgmCqASjwn1lKEt/b4odLSMSjZVUhxKBGl0iW VGnciyWDKW+N9TLbxXElWA+I7DBTSp3wdNROXVgI+w/9/MuDRLEmmaZ/aJgtH4IDoltv gqiwZ0unIg1uh9i8sXVi53s/RUbjD7IXVZzhocvG99yTDOcjyvKB8o7FPIuIoP89kk8D eAu/I0NDm7Pba+rRNbDEaXdqq+9i9twwvlLf7phOGklvqvNOgszLgV2zVA2/ChfTP2WE iRhn2FMI7jstlzaiyXY1cDXl4gVyx5MDVv23eF+fRm7feUj5ZClmd2KdOHOo87AVT1go azyg== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76288-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id nc37-20020a1709071c2500b00a3eca0705c0si3341790ejc.5.2024.02.22.02.04.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 02:04:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76288-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76288-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E412D1F25F1B for ; Thu, 22 Feb 2024 10:04:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DAFD3A1C6; Thu, 22 Feb 2024 10:04:21 +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 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. 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(-) -- 2.43.2