From patchwork Wed Dec 17 16:45:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 5507961 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4C5DC9F1CD for ; Wed, 17 Dec 2014 16:46:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B377820A2B for ; Wed, 17 Dec 2014 16:46:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EF65120A2C for ; Wed, 17 Dec 2014 16:45:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 321C86E95E; Wed, 17 Dec 2014 08:45:57 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 08BF46E960 for ; Wed, 17 Dec 2014 08:45:56 -0800 (PST) Received: by mail-wi0-f172.google.com with SMTP id n3so16359645wiv.17 for ; Wed, 17 Dec 2014 08:45:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=MWopXZ77Exh0PcsUn//BxFbaRxvXLKKzIihfgsRK/+w=; b=XOqfpu7TuxINRdIuZEkE9/EgCDX4yMmZ8FlbKUe/RJdQfEPISoSHK440+sO7wAkmNo 7QLH37tjshRd+wBMFaYTqp1sNnZxXJPp5ipG/0bxQfKncQ6f2wYr58j2VMKQPQWeMMct 8GCQiv5szyvNqRt/1k840G49y8aLSq0WPR1LcrbZxhXTye7WKfnlAjeD6lxbOTntsKOw m9bFZm06UKkf9xBJi9vYNjnGDuIL0hZ1vATN7OcNtzvXHE3okZ76lpZVdm/BatdLq69N lAF8xwnoquhAXks8Ek1iI3meWwPPOGXWFvZ7+ZFWtjMtiRu4eLoSgDKv7W6iyawD+A2T yRdQ== X-Gm-Message-State: ALoCoQl+dF+1614tk2E62YmjCbroPGC/mHEvMc75Gbic9Nkn9EkhSkIQ/uRbTB5yT1s/ZhJ9kfgF X-Received: by 10.180.90.133 with SMTP id bw5mr16518884wib.50.1418834755397; Wed, 17 Dec 2014 08:45:55 -0800 (PST) Received: from pistachio.icx.intel.com ([83.217.123.106]) by mx.google.com with ESMTPSA id ec2sm6762267wib.23.2014.12.17.08.45.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Dec 2014 08:45:54 -0800 (PST) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Wed, 17 Dec 2014 16:45:46 +0000 Message-Id: <1418834747-5598-4-git-send-email-thomas.wood@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1418834747-5598-1-git-send-email-thomas.wood@intel.com> References: <1418834747-5598-1-git-send-email-thomas.wood@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 4/5] lib: clear log buffer after writing it out or starting a new subtest X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Thomas Wood --- lib/igt_core.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/igt_core.c b/lib/igt_core.c index b98cb41..925d78c 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -366,6 +366,23 @@ static void low_mem_killer_disable(bool disable) } #define write_log_msg(x) write(STDERR_FILENO, x, strlen(x)) +static void clear_log(void) +{ + uint8_t i; + + pthread_mutex_lock(&log_buffer_mutex); + + i = 0; + do { + free(log_buffer.entries[i]); + log_buffer.entries[i] = NULL; + i++; + } while (i != 0); + log_buffer.start = 0; + log_buffer.end = 0; + + pthread_mutex_unlock(&log_buffer_mutex); +} /* this function must be safe to be called inside a signal handler */ static void write_log(void) @@ -409,6 +426,8 @@ static void write_log(void) write_log_msg("--- Log End\n"); pthread_mutex_unlock(&log_buffer_mutex); + + clear_log(); } bool igt_exit_called; @@ -761,6 +780,8 @@ bool __igt_run_subtest(const char *subtest_name) return false; } + clear_log(); + kmsg(KERN_INFO "%s: starting subtest %s\n", command_str, subtest_name); gettime(&subtest_time);