Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1289916rbb; Mon, 26 Feb 2024 05:05:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+eXS6vXoOpkyQWauqw7qLDqne25MGpFn7FkCBOn/r3HLFvcS1h67vRNKgZ1Kttjz2HOF2ytm17b+zIEt+XMaff1+Io6ZJ2AY59Amdhg== X-Google-Smtp-Source: AGHT+IEwzPVe2Vu1cLIPfNQKQpyCEC0AIQ7Zq5XEcJhwICFHllMoeeO0AosrtxuGyRARJR6yy/vR X-Received: by 2002:a17:903:1c6:b0:1dc:84ab:95d with SMTP id e6-20020a17090301c600b001dc84ab095dmr7300563plh.45.1708952745655; Mon, 26 Feb 2024 05:05:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708952745; cv=pass; d=google.com; s=arc-20160816; b=JIF3S2S24A6YRKJfQew5HXqwo650czspPH5C3ClKv/D4ltdNk6+NDHe6hHetGyx2z9 djWrTxg3qm71DUS78YUl6vyRWwerNnU3HgcxBiiQwm5AAUOAN6/LjQIiytQDgP0amwEv rBdELi9wKpneK/BRe4ApsjNYwwr59F78E7l0QPaoX4VDmuN9RFtu7PjCZQT0PUIsljst n6CpelDd9N10WWRzgqzkFG51tZJKMIPb3zczCIa5pLIKY44SiquR08P9baCiNAkljq8b +6oVDUrI4LVrSaXnlRuP6fir22FJ+eQq7aQV7yd77qnrXg1luBvch3nZ5BkJDaDRrFHP qYqA== 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=Ec8FKPnUyzITq9VeaeD2rfUTeS7+8tE2NSlAzvpfTEw=; fh=UsV2dAY3Iy+dsMaOcCk3di16VMJXPJMH8Li/p22HnD0=; b=LX5DFUJMq4e/mezP95pgP/1D67A+etBeJ+N/IB1eK5g2StBUIfLqzaFXGZ8xcH7H9i CC/LcMCK8hlF5AUpK4Cnkv/h5wifzhQW03hrVnJb9VUwY8Zd7KbNbiB8v2ViEkf72U5S iDLSlMqaNywhQF6P8PcO5oMPuDps6obztyh05dJe/a7lHVK46A03KOeHNVtvamRpx4gK OLdc8eUt/4Ii5eCeF1Oh3hME/44D/v4Cj3smyF3s7iVx/DuuiH4xCcK8a0u1RcAxRrvn 2+5ZyXLqSg0jqxEPbankvzTmk3FD7SBbwjKCHuqXOsES4FPii35Kej4hHMg4uY+4iDS1 2YfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ayEeBOHd; 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-81439-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81439-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n17-20020a170903111100b001dc652e9d71si3520407plh.206.2024.02.26.05.05.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 05:05:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81439-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ayEeBOHd; 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-81439-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81439-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C39F287107 for ; Mon, 26 Feb 2024 13:05:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD7B680042; Mon, 26 Feb 2024 13:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ayEeBOHd" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 1D8B84F888; Mon, 26 Feb 2024 13:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708952740; cv=none; b=oEihh2bW3GiGpyBcejeZAamBmNsJH1EACeCVM7QXqr/fHW2xOCriBDsJOIhHm4q6wBpqUE0911o8fNFtysnREiMb5cICmNAt/TA2KsqNnk/umzFaUCVKQwH70S10vxng6yTkyImEWgxXcHxO0bPtMXxt08M5QAPVjak8spkz008= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708952740; c=relaxed/simple; bh=Qs7NWvysjXV5VOP+DYiXYxHczsg5xn86YV7OT/OGLRk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EnAW/WBxNcSTxhN8W6Fqx7ef0/YpW4jE+ycSx2SbwGFbG68J4MZlobQc2QEnPnYssKAIlqeixpMt0bFgE16NtgZe37SQr6h91a8F8ISrzhhHirPGyafDQ/C8M5otLEnGJT5WqhuP5CcTZ2USdhRxASeP+myXGRhar3hdWUHTfJk= 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=ayEeBOHd; arc=none smtp.client-ip=192.198.163.18 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=1708952738; x=1740488738; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Qs7NWvysjXV5VOP+DYiXYxHczsg5xn86YV7OT/OGLRk=; b=ayEeBOHd2CNMg9saXdQTR3ZX/+dl35A+996MwKeAlkJWIoor0qFYvwdh 1SboeG/kJO+V9swVPMMK2HtP0ioeFmEX798bnI67VlezPWbOpQP1I78x2 oonBWex1WvnHS1i1FmQxEBdqMbjw/biO/yaNhIpUX6vudCSspmo5Lpsdp lqLwPfatB8HPebk06o7hs2cOAE/7XsknFXpIwOcQ1ucrPH/HQ4BvOQ3eh iqvDsNIhktZYu5et+/+kz6J6qHSWz61Gsqe8SXD2uSK9vx80KN1sihCXA yN5jIujjbS08tj83bF3fRwFS7KGjTz0B7vjVZieuDtLZe3s0lT5+k7gzW Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="3102530" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="3102530" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 05:05:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="37668537" Received: from pkwiatko-mobl.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.23.220]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 05:05:33 -0800 From: Maciej Wieczor-Retman To: shuah@kernel.org, reinette.chatre@intel.com, fenghua.yu@intel.com Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 0/3] selftests/resctrl: Simplify test cleanup functions Date: Mon, 26 Feb 2024 14:05:22 +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 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/ 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