Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1690373pxj; Wed, 19 May 2021 11:32:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFlzmp5t5sg2PhzqNqm+j+g1qWIxomjPy4cKvoJO39OC5u09MjE+mTcmFmIpw2b92UTSz3 X-Received: by 2002:a17:906:7c9:: with SMTP id m9mr533134ejc.98.1621449171770; Wed, 19 May 2021 11:32:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621449171; cv=none; d=google.com; s=arc-20160816; b=BRSIGpowf55iniieufthCWJ0hpV6WZc83DPWD8cPBvjqThfT0SUC3h/rVGgvzIZ8qG Xbk939aLFVq7fGkf0u2htUSs9Po38aAllTlTH3D9xj9omM/YARRG5vbs7NdwSBM7JrRv IjtknfgrvjCCQK4Lhp5VaroCtDoSIgCwkHU+2uoH3HLLGWvy/HdHo7QxEN0jHBCGqekN EytPON7C6Frt+1ebMlJLtSf6V88kGH1l24yh+5LrsLcQXt9NP5lm0wIbw8kGcYa4cdnx 1f9zKn71BIjfmkgyL1PHMd/ggBmeBqCE9p+iofrkIBzoyOIlxr2kEUFDv1DfNZB2vyVy xWqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=t+oFYBcfn5eRDxSt1ZE6czbhyY/KIUy85I9VfCH9rcQ=; b=LE+5NylZ57kYhOMPYo6eieixM/TmsC66mWu0AI+SERygk/XRnzdPVApbCITdRCdNQI iPXexkZPcbNTLFcuvD2C32W21QMjx5FJLXZtqCFn9bliAri3XoKytf+ali4nhlfDZf8s +2j8hns/sch2iDU07OmvPQ8d7tSL5Fh9LaloOL1GTLOk+VnEtSt19mHtKXwvSCS6Y5gS 074g2ayEkpIOYqVYdYMgJ99v0KB9ILcaQZU+KkMmw04XHfHsN2zi6huthGoQusfEZz+8 fpsHqjbPvxd3NV903HBBqZLGbgjiU4llBfWA/fFnI+RdlJx29MGq3vMO/6btcJUgr1WI E0rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch13si302659ejb.305.2021.05.19.11.32.27; Wed, 19 May 2021 11:32:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352019AbhERUIh (ORCPT + 99 others); Tue, 18 May 2021 16:08:37 -0400 Received: from mga17.intel.com ([192.55.52.151]:15798 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232377AbhERUIg (ORCPT ); Tue, 18 May 2021 16:08:36 -0400 IronPort-SDR: 28vornXhaiRvCI6fNyQbmQzCB5gLsLlgEvpTe1Zcm72MMAWryOcHtjNqV1L9NUItrMUAg2SYwN TNi4TAUAfhqw== X-IronPort-AV: E=McAfee;i="6200,9189,9988"; a="181086085" X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="181086085" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 13:07:18 -0700 IronPort-SDR: 8q7naH9q2EARr2Rc3CCYtIkYtCRSsVB8z+M4OQIkW3EPg5koHNgJqDne4Wg2bQpZ9IoJgUaNbo q6Cri0sDs4vQ== X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="439268002" Received: from rchatre-mobl3.amr.corp.intel.com (HELO [10.212.164.215]) ([10.212.164.215]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 13:07:17 -0700 Subject: Re: [PATCH v5 2/2] selftests/sgx: Migrate to kselftest harness To: Jarkko Sakkinen Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-sgx@vger.kernel.org, Dave Hansen , linux-kernel@vger.kernel.org References: <20210512215323.420639-1-jarkko@kernel.org> <20210512215323.420639-2-jarkko@kernel.org> <3b920525-694c-a8e4-93f5-7b1a3f9ad009@intel.com> From: Reinette Chatre Message-ID: <16d7588e-a44c-90c1-44be-3a9cca1dc913@intel.com> Date: Tue, 18 May 2021 13:07:16 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jarkko, On 5/18/2021 12:57 PM, Jarkko Sakkinen wrote: > On Tue, May 18, 2021 at 08:49:00PM +0300, Jarkko Sakkinen wrote: >> On Mon, May 17, 2021 at 10:03:42AM -0700, Reinette Chatre wrote: >>> Hi Jarkko, >>> >>> On 5/12/2021 2:53 PM, Jarkko Sakkinen wrote: >>>> Migrate to kselftest harness. Use a fixture test with enclave initialized >>>> and de-initialized for each of the existing three tests, in other words: >>>> >>>> 1. One FIXTURE() for managing the enclave life-cycle. >>>> 2. Three TEST_F()'s, one for each test case. >>>> >>>> This gives a leaps better reporting than before. Here's an example >>>> transcript: >>>> >>>> TAP version 13 >>>> 1..3 >>>> >>>> ok 1 enclave.unclobbered_vdso >>>> >>>> ok 2 enclave.clobbered_vdso >>>> >>>> ok 3 enclave.clobbered_vdso_and_user_function >>>> >>>> Signed-off-by: Jarkko Sakkinen >>>> --- >>>> >>>> v5: >>>> * Use TH_LOG() for printing enclave address ranges instead of printf(), >>>> based on Reinette's remark. >>> >>> Thank you for considering my feedback. The motivation for my comment was to >>> consider how this test output will be parsed. If these tests will have their >>> output parsed by automated systems then it needs to conform to the TAP13 >>> format as supported by kselftest. >>> >>> In your latest version the output printed during a successful test has been >>> changed, using TH_LOG() as you noted. From what I can tell this is the only >>> output addressed - failing tests continue to print error messages (perror, >>> fprintf) without consideration of how they will be parsed. My apologies, I >>> am not a kselftest expert to know what the best way for this integration is. >>> >>> Reinette >> >> It's a valid question, yes. >> >> The problem is that only main.c can use kselftest macros because >> kselftest_harness.h pulls >> >> static int test_harness_run(int __attribute__((unused)) argc, >> char __attribute__((unused)) **argv) >> >> which will not end up having a call site (because there's no >> "TEST_HARNESS_MAIN"). >> >> The whole logging thing in kselftest harness is a bit ambiguous. >> Namely: >> >> 1. There's a macro TH_LOG() defined in kselftest_harness.h, which >> "internally" uses fprintf(). >> 2. There's an inline function ksft_print_msg() in kselftest.h >> using vsprintf(). >> >> To add to that, kselftest_harness.h internally prints by using >> ksft_print_msg(), and provides TH_LOG(), which does not use >> ksft_print_msg(). >> >> I don't really get the logic in all this. > > I tried to split TH_LOG() as separate entity but it's not possible, as the > macros access a static variable called '_metadata'. > > I'm not exactly sure how to proceed from this, if we want to make logging > consistent. > > I would personally suggest to leave the error messages intact in load.c, > because there is no way to make them consistent, except by removing them. It is not clear to me why ksft_print_msg() cannot be used but an alternative to it may be to just prefix all existing diagnostic messages with "# ". Reinette