Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4262083ybp; Mon, 7 Oct 2019 05:58:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLAbPoRQ6dzop3E9uXcRVYtUkn6Mcz20uG+G1lLkbpGM/tx3vDfmZj2+D7etQH2234dlF+ X-Received: by 2002:a17:906:7f05:: with SMTP id d5mr15921634ejr.313.1570453114088; Mon, 07 Oct 2019 05:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570453114; cv=none; d=google.com; s=arc-20160816; b=0qL39JupptF0fWGpRZmtABEnlyTM2qt2klZ3U/jYn3uziTeO2Iiq0yj3UvkIYcACI1 IycVk8CawdoehUp8s99e6gHthxF3Y2UdvbN86urffMtKOBnRbqd7+tdV6fWyPQ/yXZrI IQvW18LT+nsNYc9c11vOtgbb01ouqp8HccUgwpfsgmoNRq1IYlUfeOt1NblimD8BGu9i oeFqbItlpRwEiRZ1qQFbuXgEXSkv6g8qVMv/bX65vEeXP6Wwe5szXnO9hLkGreWBP2R4 ufsukSQMt0ssnu/CPMUnlJb9fn+hkBQfB2A/R9L8OS/2zNYGmIJ2GbumS4z64TObVddA Y+3g== 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=Xbrf5c8CGSC+Qf9W4W3+W37HkJzmVyRrIvN50zs/ENI=; b=FMjGiyv1/xmn6txhjeZ7BwwJTYEXr3aSJYWjAplZ36gaGt2kIsxTkHyWnzW9V/y3Tw 64xCpiiGIK0pqUmSqkaxTTp/iTQOPHK2pMYQjPxOfovEMhYrih142gtbvRxTyJABsZZ9 oHenDdhd981JHY3NLPgNJAYj51pSl7ppcJvn3cVUZFm9SHUXInXj3+wXikQa6qN7BC4a 0GnUv7gsvVWaekTs87Ax5ESBCybl8Q9rKrIp2jsCnOoV9k6/Y2nHlP4t5aV7B0XWUTyt tfY1ty/Oj0Tp9sU7MBaNevcQNCcp1skUuP8kRPVXo9JctFavWQgalb9TFv0gEw3CBXkQ m5fw== 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 p16si6965487ejj.360.2019.10.07.05.58.10; Mon, 07 Oct 2019 05:58:34 -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 S1728528AbfJGMzI (ORCPT + 99 others); Mon, 7 Oct 2019 08:55:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56054 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728506AbfJGMzH (ORCPT ); Mon, 7 Oct 2019 08:55:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07ED2806A50; Mon, 7 Oct 2019 12:55:07 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 523C15D9CC; Mon, 7 Oct 2019 12:55:05 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 34/36] libperf: Keep count of failed tests Date: Mon, 7 Oct 2019 14:53:42 +0200 Message-Id: <20191007125344.14268-35-jolsa@kernel.org> In-Reply-To: <20191007125344.14268-1-jolsa@kernel.org> References: <20191007125344.14268-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Mon, 07 Oct 2019 12:55:07 +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 aa34c20df07e..c8d45091e7c2 100644 --- a/tools/perf/lib/tests/test-cpumap.c +++ b/tools/perf/lib/tests/test-cpumap.c @@ -26,6 +26,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 d8c52ebfa53a..9a80c310ac0f 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 1b6c4285ac2b..135722ac965b 100644 --- a/tools/perf/lib/tests/test-evsel.c +++ b/tools/perf/lib/tests/test-evsel.c @@ -130,6 +130,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 8c5f47247d9e..7dc4d6fbedde 100644 --- a/tools/perf/lib/tests/test-threadmap.c +++ b/tools/perf/lib/tests/test-threadmap.c @@ -26,6 +26,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