Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp917548ybe; Fri, 13 Sep 2019 08:18:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxn4ldCtclQUQa38far4HZQVlHAQjLD2WEp9vEdiZPhcb6Ks11eJPHiDZYR8JUwduBWuxiD X-Received: by 2002:aa7:d414:: with SMTP id z20mr22409473edq.208.1568387907332; Fri, 13 Sep 2019 08:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568387907; cv=none; d=google.com; s=arc-20160816; b=gKzaszWymvEM095wjhAPg7EkNCB9T1Flt/yUFY679vJ1DV6pJeRbnyafF5iUPuDHw/ 53d9pxB8DzvtkBh9o1jo57C6i39FpXy8FXxE/QA2QpOiHLW6IkZ9sDfg+jMAkzKvcpHY ONoXgUDyN1Fmq4Rfr4RMsU/a0BEleeah9hfPOJhOXkApzjB8x91YJGokIMrhqn1vYMES Fc2EF+Boof4leiyqqLmWx5vd3AyshYK2B94VWKaThOCTXoId+uWhQkrZh4N6mESmleto RDsxNy6c78TMizRRA9qvA8/Sm99E2n3qzqlkbrT+Ue5s9zvZ2c0Hb/sibNuar0MjWCKG 2Tmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rSQLJjtRm5spnnWbYeHkZHs5AGbR/XLNErxkLr0nWqM=; b=v6T78LqPb40tOC3evrom+uMMK1NcMfzTY3HLG4MXCAaif73oa6ak+IqCJxM83OGyXi PftptcrtSDSvhIuwUCz/gv469LWkXZI5covp9f4jY6BBBnaEL8jWYISnXWWj6B2hV/7f ldgAPvW8WusuOsN7H3C4kPnPfAG2NiauIyxSWwAhoJxiPZ1yf48iEFvHIUEH8ShBdmKR sW/KnM3yQTiB+4+4eKmTt68p/MU6gy8jiUQSX9uOxTR5fC+pbfoCjtZnAOsVxrMxvTuD EdWqFgttKASnNSBVrkBaiWMVo93Whd4ckWm6IN2BdzkF8hDItKxIpvqJ7iwYlgXvzBC4 0p+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k15si9570830ejd.212.2019.09.13.08.18.03; Fri, 13 Sep 2019 08:18:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403873AbfIMN0u (ORCPT + 99 others); Fri, 13 Sep 2019 09:26:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42896 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403858AbfIMN0r (ORCPT ); Fri, 13 Sep 2019 09:26:47 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A4ED89AC7; Fri, 13 Sep 2019 13:26:47 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 768FD5C1D4; Fri, 13 Sep 2019 13:26:45 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 71/73] libperf: Keep count of failed tests Date: Fri, 13 Sep 2019 15:23:53 +0200 Message-Id: <20190913132355.21634-72-jolsa@kernel.org> In-Reply-To: <20190913132355.21634-1-jolsa@kernel.org> References: <20190913132355.21634-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 13 Sep 2019 13:26:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Keeping the count of failed tests, so we get better output with failures, like: # make tests ... running static: - running test-cpumap.c...OK - running test-threadmap.c...OK - running test-evlist.c...FAILED test-evlist.c:53 failed to create evsel2 FAILED test-evlist.c:163 failed to create evsel2 FAILED test-evlist.c:287 failed count FAILED (3) - running test-evsel.c...OK running dynamic: - running test-cpumap.c...OK - running test-threadmap.c...OK - running test-evlist.c...FAILED test-evlist.c:53 failed to create evsel2 FAILED test-evlist.c:163 failed to create evsel2 FAILED test-evlist.c:287 failed count FAILED (3) - running test-evsel.c...OK ... Link: http://lkml.kernel.org/n/tip-wi78jndi8ymzw7dq11mwxsld@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/lib/include/internal/tests.h | 20 +++++++++++++++++--- tools/perf/lib/tests/test-cpumap.c | 2 +- tools/perf/lib/tests/test-evlist.c | 2 +- tools/perf/lib/tests/test-evsel.c | 2 +- tools/perf/lib/tests/test-threadmap.c | 2 +- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/tools/perf/lib/include/internal/tests.h b/tools/perf/lib/include/internal/tests.h index b7a20cd24ee1..2093e8868a67 100644 --- a/tools/perf/lib/include/internal/tests.h +++ b/tools/perf/lib/include/internal/tests.h @@ -4,14 +4,28 @@ #include -#define __T_START fprintf(stdout, "- running %s...", __FILE__) -#define __T_OK fprintf(stdout, "OK\n") -#define __T_FAIL fprintf(stdout, "FAIL\n") +int tests_failed; + +#define __T_START \ +do { \ + fprintf(stdout, "- running %s...", __FILE__); \ + fflush(NULL); \ + tests_failed = 0; \ +} while (0) + +#define __T_END \ +do { \ + if (tests_failed) \ + fprintf(stdout, " FAILED (%d)\n", tests_failed); \ + else \ + fprintf(stdout, "OK\n"); \ +} while (0) #define __T(text, cond) \ do { \ if (!(cond)) { \ fprintf(stderr, "FAILED %s:%d %s\n", __FILE__, __LINE__, text); \ + tests_failed++; \ return -1; \ } \ } while (0) diff --git a/tools/perf/lib/tests/test-cpumap.c b/tools/perf/lib/tests/test-cpumap.c index 4224d6f213f8..d28306710104 100644 --- a/tools/perf/lib/tests/test-cpumap.c +++ b/tools/perf/lib/tests/test-cpumap.c @@ -24,6 +24,6 @@ int main(int argc, char **argv) perf_cpu_map__put(cpus); perf_cpu_map__put(cpus); - __T_OK; + __T_END; return 0; } diff --git a/tools/perf/lib/tests/test-evlist.c b/tools/perf/lib/tests/test-evlist.c index 2b7271130223..80906e04ab0c 100644 --- a/tools/perf/lib/tests/test-evlist.c +++ b/tools/perf/lib/tests/test-evlist.c @@ -407,6 +407,6 @@ int main(int argc, char **argv) test_mmap_thread(); test_mmap_cpus(); - __T_OK; + __T_END; return 0; } diff --git a/tools/perf/lib/tests/test-evsel.c b/tools/perf/lib/tests/test-evsel.c index 64d2257a93cb..1c9c4ec94e59 100644 --- a/tools/perf/lib/tests/test-evsel.c +++ b/tools/perf/lib/tests/test-evsel.c @@ -128,6 +128,6 @@ int main(int argc, char **argv) test_stat_thread(); test_stat_thread_enable(); - __T_OK; + __T_END; return 0; } diff --git a/tools/perf/lib/tests/test-threadmap.c b/tools/perf/lib/tests/test-threadmap.c index 9b72c43c8c59..7366bdbf4adf 100644 --- a/tools/perf/lib/tests/test-threadmap.c +++ b/tools/perf/lib/tests/test-threadmap.c @@ -24,6 +24,6 @@ int main(int argc, char **argv) perf_thread_map__put(threads); perf_thread_map__put(threads); - __T_OK; + __T_END; return 0; } -- 2.21.0