From patchwork Tue Sep 29 23:54:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 54284 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 9064B23009 for ; Tue, 29 Sep 2015 23:57:48 +0000 (UTC) Received: by labjc2 with SMTP id jc2sf3959405lab.1 for ; Tue, 29 Sep 2015 16:57:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=4yTAPSSBNmmP4rZsZ+zg2n7acj5bCs9i4hJq2WvnYC8=; b=PwmikeY7Ev2dVWG5vJIQFCtrVde8ZrLnTxhk9/+qieiw8nisjhPqT8c9sxpY4LhPXY vFUKTxzhZi5c+2M0JM9PrE4chLIj+Okooa8UA9Fe8IL0X/FQBYy/PW1iYy2jKp25VZ18 id3lSDjLTJspj8QF2j3ClHroRGmYaWbA6Z5PbQBqdMpDyABe7RiKfciXJybkU8O/o0t6 45jy9gqq/Vn6trVFALU8qKn4xj0daXwBEtWFN+tIOGu/rvh9OooyRFkdMmtP19adagts 4Ygv9A4rHVRRdPpeXuFn7Uo6hc0hR/xUtQLZSuDowbU978tPDS8qkINMu1KP4DJFjPdv HkvQ== X-Gm-Message-State: ALoCoQmIUVFHsFcWK/jLAKfA4yIHdyYCWcHQURp7EJDuQIYudJ8xYS2VYGBsEJ4MF4vseUbm6qFy X-Received: by 10.112.12.132 with SMTP id y4mr85044lbb.0.1443571066791; Tue, 29 Sep 2015 16:57:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.8.137 with SMTP id dk9ls3504lad.80.gmail; Tue, 29 Sep 2015 16:57:46 -0700 (PDT) X-Received: by 10.112.184.196 with SMTP id ew4mr182427lbc.17.1443571066510; Tue, 29 Sep 2015 16:57:46 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id m1si12135752lfg.133.2015.09.29.16.57.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2015 16:57:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by labzv5 with SMTP id zv5so27339301lab.1 for ; Tue, 29 Sep 2015 16:57:46 -0700 (PDT) X-Received: by 10.25.19.21 with SMTP id j21mr122147lfi.106.1443571066064; Tue, 29 Sep 2015 16:57:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2430172lbq; Tue, 29 Sep 2015 16:57:45 -0700 (PDT) X-Received: by 10.194.114.104 with SMTP id jf8mr734154wjb.155.1443571065151; Tue, 29 Sep 2015 16:57:45 -0700 (PDT) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id e11si32832401wjs.28.2015.09.29.16.57.44 (version=TLSv1 cipher=AES128-SHA bits=128/128); Tue, 29 Sep 2015 16:57:45 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t8TNss8S030923; Tue, 29 Sep 2015 19:54:55 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t8TNsrcp031931 for ; Tue, 29 Sep 2015 19:54:53 -0400 Received: from colepc.redhat.com (ovpn-113-60.phx2.redhat.com [10.3.113.60]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8TNsqbl032756; Tue, 29 Sep 2015 19:54:53 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 29 Sep 2015 19:54:50 -0400 Message-Id: <35387d821292c29717cd1e2bf5256c7c3cfd932b.1443570869.git.crobinso@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] testutils: Add coloring to verbose PASS/FAILED output X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: crobinso@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Helps to visually track down test failures if debugging the test suite. The colors match what 'make check' does for pass/fail/skip --- tests/testutils.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index 89026c6..bd4ff73 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -91,6 +91,11 @@ bool virtTestOOMActive(void) return testOOMActive; } +static int virtTestUseTerminalColors(void) +{ + return isatty(STDIN_FILENO); +} + static unsigned int virTestGetFlag(const char *name) { @@ -217,11 +222,20 @@ virtTestRun(const char *title, if (virTestGetVerbose()) { if (ret == 0) - fprintf(stderr, "OK\n"); + if (virtTestUseTerminalColors()) + fprintf(stderr, "\e[32mOK\e[0m\n"); /* green */ + else + fprintf(stderr, "OK\n"); else if (ret == EXIT_AM_SKIP) - fprintf(stderr, "SKIP\n"); + if (virtTestUseTerminalColors()) + fprintf(stderr, "\e[34m\e[1mSKIP\e[0m\n"); /* bold blue */ + else + fprintf(stderr, "SKIP\n"); else - fprintf(stderr, "FAILED\n"); + if (virtTestUseTerminalColors()) + fprintf(stderr, "\e[31m\e[1mFAILED\e[0m\n"); /* bold red */ + else + fprintf(stderr, "FAILED\n"); } else { if (testCounter != 1 && !((testCounter-1) % 40)) {