Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1835282rdb; Wed, 31 Jan 2024 10:24:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvMmLvzPsAI4BgiTqfgE8VQEj44V2r/SJiFpN09Nl7DEjl0P7YXF+o6SjFo9PRLdqH8sxJ X-Received: by 2002:a17:90a:d90c:b0:295:f997:5382 with SMTP id c12-20020a17090ad90c00b00295f9975382mr1546118pjv.4.1706725499560; Wed, 31 Jan 2024 10:24:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706725499; cv=pass; d=google.com; s=arc-20160816; b=hCjXd5VOEDeLw92cHnPOB9cOwHF2FmnZ5JeETCasC30Q3G31vK+UvMqeRUPoLdcFPP CP35MuzVBtvBz34gEFq1iA8qayzi33i6k+VMlaWCeVrqrjMFjhxjMFw3Eqm96lqXA20R +XN6/8r7McdzrkrfeAw89nBLsQbsy1SJeI/eumYLrV/WtBb4nJ3b5AGmCdmpWJhXC8It IDFD2o3mwZ46oeOmAyBCBhKxaswwEh/XYeMnHo7G4UayVvbYCjq2cfFxTfwqWsjq7qQf +WnIhbF/kj59+mFFa01bmOGhDGhybj55ImlJr0/Hee7nBZmPmZXXatg0P61ksbpWnTmp YFcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=AWtBUByTB6W5dwMCGIZY/2moh4Mh6s3giRPk15N5Io8=; fh=3e5dZGp7P7phlwx1V6p2R8GmIOgcDOqGO5QBkGe/QSs=; b=bu0Ve5fzepFqdbgA42g7Wsj76E5wQIHIArl9oq5vyCP/M+RxOWbzO+w+mN7MLuLmP8 ncmW7DdaZ56ocxV7hx1F5agLxz7gP8oZ4m1JpvkLapT+XZ421kRzSzrPhGVLNtgmvV21 574835i3KM4v4YGiZxjvlkakTWHeL9CUSom91PM2WO6YyC40yjrVhxNG0lqZehFo2OwL cIHe/WlPG6QhAmx6TGxOzC8yIvFx1506oeQdLvsP1IulbYW8oUzccMFV0ePggbpqaG4G LfQiKxeH2eHFamWic3j+lL1gWlu/9KN0SrkgRjFE0EyVPf4Z0n1uM2MfDIt6C/vKjmrh GYIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hQeIH0ar; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46398-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCWzdETmZjh2HXPhehGURVBiMkRFKyM/jQ0u5YcHf2fp04HqvfyOC5u2HGq5vY3Vd4wV6oaSN/qS10FO5I0ayE+0MTIqL/pc0+ryHA4PFg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c12-20020a170903234c00b001d917fa8be8si3404050plh.257.2024.01.31.10.24.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 10:24:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hQeIH0ar; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-46398-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46398-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 23EDDB22C2C for ; Wed, 31 Jan 2024 12:05:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B514D7690F; Wed, 31 Jan 2024 12:05:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hQeIH0ar" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 36646768FA; Wed, 31 Jan 2024 12:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706702708; cv=none; b=cbXyy9W8/UJkpUugCDcABSeDA7qIJd9MjO6t3n7qPzmkdq/+F4X2YpU+bZ64qSJK7tYotw0j2bL+plwWmxV2zcf4bCXbyrKGTvXJnxux0Few4B37Lx4Ubh3PEcFTrnpRFPHU+mxZHd75tA8qCdK0w1EXzECjZXPpPPpATBfXcPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706702708; c=relaxed/simple; bh=C4+J0LK2uGlnop8N8+yJQ1nCoUA+KOAPfCeSlARfKYU=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=Tq1pWmB0msIhR+Y6Rdz200JY+QeTzabtA/Su5R97imUkNsA6nKepbR7B5M8SE21X97tzjFdhYv8LTB7UG3YWARiahYloOw49KeMJnJEtggBT8QCYBjMcbantp7AgJz4q8aAsfcSJyvVCQYpSFs9GDLxqqv0WHHWh+erOjsFnkrs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hQeIH0ar; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706702707; x=1738238707; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=C4+J0LK2uGlnop8N8+yJQ1nCoUA+KOAPfCeSlARfKYU=; b=hQeIH0arMlLFVtsHsLx6Ucc9MDMfnXm3etK2rSlN0Afh6si4iyt6zkAa SFDkrvSWoz539x5SSjGv4ciXzCLvJ76kNUPOFZ2U7RsNs1dMYRG9SZ601 bKf7K+A+/zAO2PZkb2hiulELLttQKR1BBxk21SaVvQcTuapOJuosxSa2I YUzK6YgWZ+m7kMexxpHmNTSLlCgWXBZtJlo93R3IYozywk2eG20kZQr+u OnIKrPxdppBWAo12Ulov+zUQ4YlOIFrcMzGIF/+DEHMbHiSWQMTcLuKkN LP3XPUA35foO9cva2oW5XDFcziY8Aqdc6t9DDXkZ4O9Hu7vsL6QihYCCB w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="10965154" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="10965154" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 04:05:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="738074974" X-IronPort-AV: E=Sophos;i="6.05,231,1701158400"; d="scan'208";a="738074974" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.246.35.167]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 04:05:01 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Wed, 31 Jan 2024 14:04:57 +0200 (EET) To: Maciej Wieczor-Retman cc: Reinette Chatre , fenghua.yu@intel.com, shuah@kernel.org, LKML , linux-kselftest@vger.kernel.org Subject: Re: [PATCH v3 2/5] selftests/resctrl: Add helpers for the non-contiguous test In-Reply-To: Message-ID: <6259e494-bab3-0aeb-0bf6-e4e384f8f0b0@linux.intel.com> References: <85b1efc3ddd698b3ac81aa72a6dc987ee17da3e2.1706180726.git.maciej.wieczor-retman@intel.com> <611fd2b6-d9ec-42f0-9711-b1398fc02842@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323328-1725428063-1706702697=:1077" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1725428063-1706702697=:1077 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 31 Jan 2024, Maciej Wieczor-Retman wrote: > On 2024-01-26 at 10:58:04 -0800, Reinette Chatre wrote: > >On 1/25/2024 4:14 AM, Ilpo J=E4rvinen wrote: > >> On Thu, 25 Jan 2024, Maciej Wieczor-Retman wrote: > > > >>> +=09fp =3D fopen(file_path, "r"); > >>> +=09if (!fp) { > >>> +=09=09snprintf(reason, sizeof(reason), "Error in opening %s file\n",= filename); > >>> +=09=09ksft_perror(reason); > >>=20 > >> Was this the conclusion of the kstf_perror() discussion with Reinette?= I=20 > >> expected a bit different outcome when I stopped following it... > >>=20 > >> In any case, it would be nice though if ksft_perror() (or some kselfte= st.h=20 > >> function yet to be added with a different name) would accept full prin= tf=20 > >> interface and just add the errno string into the end of the string so = one=20 > >> would not need to build constructs like this at all. > >>=20 > >> It will require a bit of macro trickery into kselftest.h. I don't know= how=20 > >> it should handle the case where somebody just passes a char pointer to= it,=20 > >> not a string literal, but I guess it would just throw an error while= =20 > >> compiling if somebody tries to do that as the macro string literal=20 > >> concatenation could not build useful/compilable token. > >>=20 > >> It would make these prints informative enough to become actually usefu= l=20 > >> without needed to resort to preparing the string in advance which seem= s > >> to be required almost every single case with the current interface. > > > >I think this can be accomplished with a new: > >=09void ksft_vprint_msg(const char *msg, va_list args) > > > >... but ksft_perror() does conform to perror() and I expect that having = one > >support variable number of arguments while the other does to cause confu= sion. > > > >To support variable number of arguments with errno I'd propose just to u= se > >ksft_print_msg() with strerror(errno), errno as the arguments (or even %= m > >that that errno handling within ksft_print_msg() aims to support). This = does > >indeed seem to be the custom in other tests. >=20 > Does something like this look okay? >=20 > =09fp =3D fopen(file_path, "r"); > =09if (!fp) { > =09=09ksft_print_msg("Error in opening %s\n: %m\n", file_path); > =09=09return -1; > =09} >=20 > The '%m' seems to work fine but doesn't print errno's number code. Do you= want > me to add errno after '%m' so it is the same as ksft_perror()? I looked t= hrough > some other tests where '%m' is used, and only few ones add errno with '%d= '. I think %m is enough. --=20 i. --8323328-1725428063-1706702697=:1077--