From patchwork Sun Mar 22 22:03:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 6067841 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 01C5ABF90F for ; Sun, 22 Mar 2015 22:00:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1695F2022D for ; Sun, 22 Mar 2015 22:00:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 13E412024F for ; Sun, 22 Mar 2015 22:00:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE4576E3ED; Sun, 22 Mar 2015 15:00:50 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 26E706E3DF for ; Sun, 22 Mar 2015 15:00:48 -0700 (PDT) Received: by wgs2 with SMTP id 2so24976901wgs.1 for ; Sun, 22 Mar 2015 15:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xJcvaSHXKQBYh7gcIDRFvLwAE+QytnYwVRVxht/ERfU=; b=WEzhvSNx+fRqWhJpM5pdG48rlBGZVDQE3zDgHmljLZk/9FkfE1Wgs52B9LUMoZxOqO Q8soIOvOj3WTCfVoNqU+RJ+/Bzf2SWTENzmyaQETuGPetESS2no57T805MxrERwzy3Hv rXbsysKurXFzb5hvDME9tUjk3Ok6WasvAuJFU2lfHt8eL0+/rrHba96RBC+y+nRiWl3g cvXYrkruPeGvPso0Yz2ydOJ1Ajnn3qOLYVWn3wli9mqQJTqb9fsjL+Bm56RAUxjkSft4 kkASHP+I9Lsyz4Ee4c0+a28sGFN3l/BqXpFNCHn1OByyIHCWWILuAQcJFyPJzaDrSkMH 5Q1Q== X-Received: by 10.194.60.77 with SMTP id f13mr182136097wjr.105.1427061647629; Sun, 22 Mar 2015 15:00:47 -0700 (PDT) Received: from arch-x220.localdomain (cpc12-croy20-2-0-cust52.croy.cable.virginm.net. [82.44.54.53]) by mx.google.com with ESMTPSA id dq8sm8281654wib.9.2015.03.22.15.00.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Mar 2015 15:00:47 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 7/9] tests/random: return non-zero on test failure Date: Sun, 22 Mar 2015 22:03:43 +0000 Message-Id: <1427061825-27470-8-git-send-email-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.3.1 In-Reply-To: <1427061825-27470-1-git-send-email-emil.l.velikov@gmail.com> References: <1427061825-27470-1-git-send-email-emil.l.velikov@gmail.com> Cc: emil.l.velikov@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 ... and wire it up to make check Signed-off-by: Emil Velikov --- tests/Makefile.am | 6 +++--- tests/random.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 9b13b2e..0603241 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,15 +29,15 @@ LDADD = $(top_builddir)/libdrm.la check_PROGRAMS = \ dristat \ - drmstat \ - random + drmstat if HAVE_NOUVEAU SUBDIRS += nouveau endif TESTS = \ - hash + hash \ + random if HAVE_LIBUDEV diff --git a/tests/random.c b/tests/random.c index 6dc8386..6af7d33 100644 --- a/tests/random.c +++ b/tests/random.c @@ -107,15 +107,17 @@ int main(void) { RandomState *state; int i; + int ret; unsigned long rand; state = drmRandomCreate(1); for (i = 0; i < 10000; i++) { rand = drmRandom(state); } + ret = rand - state->check; printf("After 10000 iterations: %lu (%lu expected): %s\n", rand, state->check, - rand - state->check ? "*INCORRECT*" : "CORRECT"); + ret ? "*INCORRECT*" : "CORRECT"); drmRandomDestroy(state); printf("Checking periods...\n"); @@ -123,5 +125,5 @@ int main(void) check_period(2); check_period(31415926); - return 0; + return ret; }