From patchwork Fri Mar 20 22:10:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Vesely X-Patchwork-Id: 6061301 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C6EAF9F399 for ; Fri, 20 Mar 2015 22:10:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0854F20522 for ; Fri, 20 Mar 2015 22:10:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0F60C204D1 for ; Fri, 20 Mar 2015 22:10:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9E7D6E3C2; Fri, 20 Mar 2015 15:10:31 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f175.google.com (mail-qc0-f175.google.com [209.85.216.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 40F3D6E3B6 for ; Fri, 20 Mar 2015 15:10:31 -0700 (PDT) Received: by qcay5 with SMTP id y5so14943534qca.1 for ; Fri, 20 Mar 2015 15:10:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Qax24jaWGvIKLhssATDrweKk/d0lOgyLP0SfIJDp/fI=; b=M89Q9cfOoyyoM9DJylana8zaxgTf5N6M9BHx4uVrYpbWKcq56+QdIsmNZ1XuLd3sEp 0LjQFvNszT6+NFFHSy6+9fpss+20DmwXeYNsjG4bFnDaU2zNxm2rxsnz0fHfBjJuDHh4 og0B6aYpdtHI/NgwwG6+vjOgZqnLfMGAHWA2Vf74EZm1QSEHd3DW/H0lCe27BeL6sGVc GCwd2SRHxxN9Vbnd9JNIvNlBV+VBhXNiVVYRG0VQh0Qssa/F4LTLOdnwVpRmg0MB/d0o oxStdNbs+3HLIFd0zz2nkMZSdSSitmluhcZCNNw/fSmf5Ny/l4hkkLf3rhnyaadgY3kf NMQw== X-Gm-Message-State: ALoCoQn0ZrHUozG0iaopbXJb/zbZPUsEM4P04NmZgz1aTUiJXbf6JuT7ftJuRr5B67MAHWxYzKOX X-Received: by 10.140.236.140 with SMTP id h134mr109563888qhc.87.1426889430828; Fri, 20 Mar 2015 15:10:30 -0700 (PDT) Received: from adriatix.rutgers.edu ([198.151.130.140]) by mx.google.com with ESMTPSA id b69sm3928946qka.11.2015.03.20.15.10.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Mar 2015 15:10:30 -0700 (PDT) From: Jan Vesely To: dri-devel@lists.freedesktop.org, Emil Velikov Subject: [PATCH libdrm 3/4] drmsltest: Check expected neighbours Date: Fri, 20 Mar 2015 18:10:27 -0400 Message-Id: <1426889428-4847-3-git-send-email-jan.vesely@rutgers.edu> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1426889428-4847-1-git-send-email-jan.vesely@rutgers.edu> References: <1426889428-4847-1-git-send-email-jan.vesely@rutgers.edu> 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.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: Jan Vesely --- tests/drmsltest.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/drmsltest.c b/tests/drmsltest.c index d193008..d871fbf 100644 --- a/tests/drmsltest.c +++ b/tests/drmsltest.c @@ -106,7 +106,9 @@ static double do_time(int size, int iter) return usec; } -static void print_neighbors(void *list, unsigned long key) +static void print_neighbors(void *list, unsigned long key, + unsigned long expected_prev, + unsigned long expected_next) { unsigned long prev_key = 0; unsigned long next_key = 0; @@ -119,6 +121,16 @@ static void print_neighbors(void *list, unsigned long key) &next_key, &next_value); printf("Neighbors of %5lu: %d %5lu %5lu\n", key, retval, prev_key, next_key); + if (prev_key != expected_prev) { + fprintf(stderr, "Unexpected neighbor: %5lu. Expected: %5lu\n", + prev_key, expected_prev); + exit(1); + } + if (next_key != expected_next) { + fprintf(stderr, "Unexpected neighbor: %5lu. Expected: %5lu\n", + next_key, expected_next); + exit(1); + } } int main(void) @@ -138,13 +150,13 @@ int main(void) print(list); printf("\n==============================\n\n"); - print_neighbors(list, 0); - print_neighbors(list, 50); - print_neighbors(list, 51); - print_neighbors(list, 123); - print_neighbors(list, 200); - print_neighbors(list, 213); - print_neighbors(list, 256); + print_neighbors(list, 0, 0, 50); + print_neighbors(list, 50, 0, 50); + print_neighbors(list, 51, 50, 123); + print_neighbors(list, 123, 50, 123); + print_neighbors(list, 200, 123, 213); + print_neighbors(list, 213, 123, 213); + print_neighbors(list, 256, 213, 256); printf("\n==============================\n\n"); drmSLDelete(list, 50);