Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1916736pxb; Thu, 16 Sep 2021 20:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/Oj1e6qTIh3NhyTq+b0RH6e8xYW6oPI204epuHA9jV3MZB1nol6sMm/YYpDMiX+KElGFu X-Received: by 2002:a17:907:d09:: with SMTP id gn9mr9858774ejc.447.1631848228334; Thu, 16 Sep 2021 20:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631848228; cv=none; d=google.com; s=arc-20160816; b=BXvlnW3TzmpJFrjxkgyJ10FoqHlArBls0X+9LlWgV9C1/FVnFoQfS4fBXSZNQZpnFc zVLKaGSGmoe0CVxVU2svhSFnn2gG5kvxoIC3tXqALgEur3FKdQdumByLewF8y0WHLh8W hgcwkGX+8ODQ6ovRLoYhHD5CQz2VkqQVtr2G5Z91QBH+OqpFD72r8ktMCO6c7CqtcqR7 +PGWnlCuGGtJi4W9mpqzbsiXV6cqR7IbBbI2SXdRVaYrCFcrFHTqRTsQnCwOzHfI6g7t XyKoSYBuRf6x3+oyqrBveihbsvy+bt68mRN6VudzD5c/ncDngrcC9XZZNcMO5koVNo4e 1jlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cRO3hpYzznTDMMK/Sk1xTlbTraInalJfUePX8m0mEvU=; b=uu8OJq/MfUeHk+pd0I0lqxEjw6xzGjoUK37m8nEEnQYdM9kk1N8NX+hjWggR1r9s+I Kc5zd+OElxXWbxUb7u63A23GqQolJq0QHUi4j6NlLQ/WIUSDYuVLnyI0F+V2PSSkymxo UiwhlkyOHD9SlNRsZgeHj05xgy3faR//pN5YxKzARix+FSTqlfKqrkIKqs1T6Qy+ErJZ SX/BIxEHnifHCTdzSEyBJU8WkLVTKBEP2M9EBh7iUgY2R0bxHgHop8YDN+Pt45lbK24o EdPLiLGNioSnNc4qhAwutAaHU/uoN1tYmgQyXZ7LkG1fk4h0rc2MYnTmCl6Skzl2Yyhw /M6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aIWFZA9H; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si5977826ejh.638.2021.09.16.20.10.04; Thu, 16 Sep 2021 20:10:28 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aIWFZA9H; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347644AbhIPR21 (ORCPT + 99 others); Thu, 16 Sep 2021 13:28:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:51644 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346306AbhIPQ4o (ORCPT ); Thu, 16 Sep 2021 12:56:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0CB1D61ABD; Thu, 16 Sep 2021 16:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809872; bh=fXUm+1P8jqrO3JjwbNQzdbjMaWrfv6nz8zqrQTyzUZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aIWFZA9HmBrIZivJaVSHznfTB+qpb6JlkRrsDLa0x7EJrC3gcNKxEZSr8UslOjmPw 4KVVtZwa66KwrJ8+ls74yNKEETSsj0rAYEnz5bb3cq7e6Tq3pienZZx9q/C+b+vXnE Qs19/IELdSLnvkapk9XT+eyZ8etGrIWuqCYmsFE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yucong Sun , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.13 282/380] selftests/bpf: Correctly display subtest skip status Date: Thu, 16 Sep 2021 18:00:39 +0200 Message-Id: <20210916155813.676508978@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yucong Sun [ Upstream commit f667d1d66760fcb27aee6c9964eefde39a464afe ] In skip_account(), test->skip_cnt is set to 0 at the end, this makes next print statement never display SKIP status for the subtest. This patch moves the accounting logic after the print statement, fixing the issue. This patch also added SKIP status display for normal tests. Signed-off-by: Yucong Sun Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20210817044732.3263066-3-fallentree@fb.com Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_progs.c | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 6396932b97e2..9ed13187136c 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -148,18 +148,18 @@ void test__end_subtest() struct prog_test_def *test = env.test; int sub_error_cnt = test->error_cnt - test->old_error_cnt; - if (sub_error_cnt) - env.fail_cnt++; - else if (test->skip_cnt == 0) - env.sub_succ_cnt++; - skip_account(); - dump_test_log(test, sub_error_cnt); fprintf(env.stdout, "#%d/%d %s:%s\n", test->test_num, test->subtest_num, test->subtest_name, sub_error_cnt ? "FAIL" : (test->skip_cnt ? "SKIP" : "OK")); + if (sub_error_cnt) + env.fail_cnt++; + else if (test->skip_cnt == 0) + env.sub_succ_cnt++; + skip_account(); + free(test->subtest_name); test->subtest_name = NULL; } @@ -783,17 +783,18 @@ int main(int argc, char **argv) test__end_subtest(); test->tested = true; - if (test->error_cnt) - env.fail_cnt++; - else - env.succ_cnt++; - skip_account(); dump_test_log(test, test->error_cnt); fprintf(env.stdout, "#%d %s:%s\n", test->test_num, test->test_name, - test->error_cnt ? "FAIL" : "OK"); + test->error_cnt ? "FAIL" : (test->skip_cnt ? "SKIP" : "OK")); + + if (test->error_cnt) + env.fail_cnt++; + else + env.succ_cnt++; + skip_account(); reset_affinity(); restore_netns(); -- 2.30.2