Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4186600pxf; Tue, 30 Mar 2021 01:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR35hjAUeXBJQTtUGNNXYhaAKpsVL3EPP3S5qfUZzBzWdrRaNoWJJnWch/fmhWzZHRym04 X-Received: by 2002:a05:6402:5113:: with SMTP id m19mr32919159edd.78.1617091890523; Tue, 30 Mar 2021 01:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617091890; cv=none; d=google.com; s=arc-20160816; b=VEPCGXHg0FPAar/AaSY3/33Fr9B8LtPwHpuskMJVP9hgr2jABIREiP8YWWAnzrU975 9DnHEwfm2flNCnmYCC9QyDojLY4aDW2GSdOTMXa1XLp5MFuS5Im25vw+m0IsRfpZhMtg IIz+nQKL86UuOy7/UfHxEyq6DKsCpfxge7rzvehHBJjHaF4M+0ocC2hSDeOwxyIpXThL MIquprm0oMQ9ujoksehovn23G1606/3Ny34nHvSXKFnuB5cDqMzmgEFfwvNB3c8XJ0C8 hvMWTDXb3g+FAUlMevbHDELMKSSWYy99aIHn8rnfS1ucE+RJoZ0K0cQk/htBwT82yQad t48w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=SamUNfsmCeVOYW5zf6V2oMsa/WQU/1fO5VJTYGVh1c8=; b=jLIL2WdLkdJCx8Ra+lT0SDKqWUfibnDXjOk3/vqqQsK/CJcn+VtoEa8Hhgof7Gtx14 8xbOjKz3wqKuDNkQXGb4IsqYzQqwRzB/4KgTT4C9nLftDIqCDwJn1PIloEfDq6fDP7xm vNK5inddAei98uArW6tmUqWkGwiR3gXJk0wFEsU+ulR53kLQX1QfSMzQs8EgYpnAqmzy YJ7htlzAzJDMtclllyjo4Bacwd0RC6zBcpwk5Jky9XN9fITzZFJYPRcPOIm+7miOHn9Q L3R2Hn59tsWu//kFO4W7u/ZHPnU853IFCxH2Q251u+d67CB88Pdd06Is1bc9YnzCFrJF /kvQ== 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si14354618ejp.143.2021.03.30.01.11.07; Tue, 30 Mar 2021 01:11:30 -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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231663AbhC3IJ4 (ORCPT + 99 others); Tue, 30 Mar 2021 04:09:56 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14960 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231404AbhC3IJR (ORCPT ); Tue, 30 Mar 2021 04:09:17 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F8hqy600DzyNJ8; Tue, 30 Mar 2021 16:07:10 +0800 (CST) Received: from DESKTOP-TMVL5KK.china.huawei.com (10.174.187.128) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Tue, 30 Mar 2021 16:09:04 +0800 From: Yanan Wang To: Paolo Bonzini , Andrew Jones , , , CC: Ben Gardon , Sean Christopherson , Vitaly Kuznetsov , Peter Xu , "Ingo Molnar" , Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo , Arnd Bergmann , Michael Kerrisk , Thomas Gleixner , , , Yanan Wang Subject: [PATCH v6 04/10] KVM: selftests: Print the errno besides error-string in TEST_ASSERT Date: Tue, 30 Mar 2021 16:08:50 +0800 Message-ID: <20210330080856.14940-5-wangyanan55@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20210330080856.14940-1-wangyanan55@huawei.com> References: <20210330080856.14940-1-wangyanan55@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.128] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Print the errno besides error-string in TEST_ASSERT in the format of "errno=%d - %s" will explicitly indicate that the string is an error information. Besides, the errno is easier to be used for debugging than the error-string. Suggested-by: Andrew Jones Signed-off-by: Yanan Wang Reviewed-by: Andrew Jones --- tools/testing/selftests/kvm/lib/assert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/assert.c b/tools/testing/selftests/kvm/lib/assert.c index 5ebbd0d6b472..71ade6100fd3 100644 --- a/tools/testing/selftests/kvm/lib/assert.c +++ b/tools/testing/selftests/kvm/lib/assert.c @@ -71,9 +71,9 @@ test_assert(bool exp, const char *exp_str, fprintf(stderr, "==== Test Assertion Failure ====\n" " %s:%u: %s\n" - " pid=%d tid=%d - %s\n", + " pid=%d tid=%d errno=%d - %s\n", file, line, exp_str, getpid(), _gettid(), - strerror(errno)); + errno, strerror(errno)); test_dump_stack(); if (fmt) { fputs(" ", stderr); -- 2.19.1