Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp871775ybg; Fri, 18 Oct 2019 08:35:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqy86OxXsTHFgGX5u4LyYVD1Dp8Bzgj1bonuuBkX+tKPsOT33k/b9btcBb++UpzsYTAV/YVU X-Received: by 2002:a17:906:d8c3:: with SMTP id re3mr9232897ejb.167.1571412959619; Fri, 18 Oct 2019 08:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571412959; cv=none; d=google.com; s=arc-20160816; b=OeIXQ2hi4xjJZ8d89J8LmXkqSE5x+gpwQfFJUxNx+E5asaByYRkuub52ja/McXkkWt cy7m3j9Bkb5Ao2Rr1q/KfJIHBxSn6wdO9nYIgh4VFNkb3Dv9xzCdW7B+AgW/AxXpryNo CiAHcn18ZLj2rSXsZMskm0Ummuz9PNjTzidSfqEtS4fZRR4ypZr+7GbVNAdvK9LkW0MR 4vw08G8Ta/KD+LPHOPb5vXETl6aQMQpNPHAleiGKpHz9jGdZ8BhPWOkkoRcJSpePp8o/ E8/Hwpo/zmLGgh701RQ9J7ft5FJamTsDqepwtgHBfnMrMnvhHPvb5Ed74pJwmYVYUMny l3TQ== 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=PWe2Hwibw1RL5x5ZBuTcBPb0IpDLRAeGrtivkEDqIgSiht1JocYqmObF6b4lURCHsl Tqio24N6yZM7AckdcavJ3fpYQmOzZymCiciK0txRBMQYPsFbpPcpazVewuZ4l4M8VAG7 8rQenZmcCv0qVzySe8Vkgodvvr2DFhUxhIEWtm6ya4EZFD/71gZOOcGLZnAHIF9pOkCI Wp352n8CHzgortqph3bdMqP7YSf4zv3vmbQZ9H/hTdQSbpP9ZACcs3qpM9XRB/JXyRxy WylIc+SZ8s0CpcByrLc6U5l2PhbmvCGi7p5R6WZn/BGsOhvvwz0awBlb+UK00r+BMK5e kd/w== 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 b8si4313753edc.231.2019.10.18.08.35.36; Fri, 18 Oct 2019 08:35:59 -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 S2409265AbfJQK7s (ORCPT + 99 others); Thu, 17 Oct 2019 06:59:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51034 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409234AbfJQK7n (ORCPT ); Thu, 17 Oct 2019 06:59:43 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E163B10C092E; Thu, 17 Oct 2019 10:59:42 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99D7D5D713; Thu, 17 Oct 2019 10:59:40 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Stephane Eranian , Jin Yao , Alexey Budankov Subject: [PATCH 08/10] libperf: Keep count of failed tests Date: Thu, 17 Oct 2019 12:59:16 +0200 Message-Id: <20191017105918.20873-9-jolsa@kernel.org> In-Reply-To: <20191017105918.20873-1-jolsa@kernel.org> References: <20191017105918.20873-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Thu, 17 Oct 2019 10:59:43 +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