From patchwork Wed Dec 17 16:45:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Wood X-Patchwork-Id: 5507971 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 B190F9F1CD for ; Wed, 17 Dec 2014 16:46:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F48920A28 for ; Wed, 17 Dec 2014 16:46:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8E56920A30 for ; Wed, 17 Dec 2014 16:46:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D5246E960; Wed, 17 Dec 2014 08:46:00 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 381F46E960 for ; Wed, 17 Dec 2014 08:45:57 -0800 (PST) Received: by mail-wi0-f177.google.com with SMTP id l15so16763611wiw.16 for ; Wed, 17 Dec 2014 08:45:56 -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=wUPUYeAnFWNuUYZBvhbseqYLfwx7MYD/fCVTu7iY0qk=; b=kB4OCuooOp8QDHNM2j+OZEmLBHpOUMZDncGjviCLIgnztHc1DwGeGHo5YSgnd0+D0m OzRYfPiqxop8mSNqmIIk4uts2Vbqi6mj1mbRYlOa/QKNb7R6TViyShmbnuGp6j6cm3Oh izVS+an6UxJw3osEwW2KU0Ti5OHMOlLEptX3xflBbm1Q2mSKAs0Ga2eXfIncw9I23fcy 3yyKpWc20nleTli9Wm8r+v35/g+4cQypuXJPMmRFG5m3LcdaXq0L8577s/a/DqGEdDNR paIFy8ftKWPY6ZaKuPsKm94BjocbR02gFwHNnw9NIySXrPxNy3tukD0AkSqu6WL+YFr1 feYw== X-Gm-Message-State: ALoCoQmmuipd3sOIZ0TzDOnmUh/JlXGF69KwkmbuwRIuYoKQJjJxH1E8/e7ct3b0LvZ+5c9Z9dz4 X-Received: by 10.194.62.144 with SMTP id y16mr74326073wjr.117.1418834756485; Wed, 17 Dec 2014 08:45:56 -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.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Dec 2014 08:45:55 -0800 (PST) From: Thomas Wood To: intel-gfx@lists.freedesktop.org Date: Wed, 17 Dec 2014 16:45:47 +0000 Message-Id: <1418834747-5598-5-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 5/5] lib: print a message when receiving a handled signal 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 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/igt_core.c b/lib/igt_core.c index 925d78c..1307fa8 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -366,6 +366,7 @@ static void low_mem_killer_disable(bool disable) } #define write_log_msg(x) write(STDERR_FILENO, x, strlen(x)) +#define write_log_char(x) write(STDERR_FILENO, &x, 1) static void clear_log(void) { uint8_t i; @@ -439,6 +440,24 @@ static void common_exit_handler(int sig) * called. */ assert(sig != 0 || igt_exit_called); + if (sig) { + int sigtmp; + char c; + int start = 1; + + write_log_msg("--- Received signal "); + + /* write out the signal number, in a signal safe manner */ + sigtmp = sig; + for (sigtmp = sig; sigtmp > 10; sigtmp /= 10) + start *= 10; + for (; start != 0; start /= 10) { + c = '0' + (sig / start) % 10; + write_log_char(c); + } + write_log_msg("\n"); + } + /* write the log out to a file if a signal was received or a simple * test failed (tests with subtests write the log after the subtest * failure) */