From patchwork Fri May 26 17:15:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Vesely X-Patchwork-Id: 9750879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA94A60209 for ; Fri, 26 May 2017 17:15:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC9A52624A for ; Fri, 26 May 2017 17:15:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C18232838F; Fri, 26 May 2017 17:15:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5AD1C2624A for ; Fri, 26 May 2017 17:15:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC6446EE01; Fri, 26 May 2017 17:15:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x242.google.com (mail-qk0-x242.google.com [IPv6:2607:f8b0:400d:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id E945C6EE01 for ; Fri, 26 May 2017 17:15:31 +0000 (UTC) Received: by mail-qk0-x242.google.com with SMTP id k74so1925524qke.2 for ; Fri, 26 May 2017 10:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scarletmail-rutgers-edu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id; bh=J3AdQgw/lM6MrZHn4x0zlp14HRtSLIE2IHZMmmLzoME=; b=aa0HighfmCiT60zwOrV3XO1//tlB4D8rzetvhV6Zw71hLox2NaU++WltHlTNqwOd8C bNcbH8yCTtFUxSILU6jhywtCPBUs91GNuJGfpdEPxtGgyiNL/8jmyCPq3DiwXPXM3URz NJaCV39aHminecWMIbQPlgWqAB1+P+EOOWbTZZk1tuekkGabgicXO2eSieDLq9G6tbhg s7L2htW5t+g2FrlwUasVa+h88yfs4X7pPNC1mEAnGcnPKd2MUQ93EIVNCAs6weEFEFPw 2+JsEbru/IW1e5+OUX25qjjxvc9GMxXij+6QEmgXV0WFilS3hyw0NrAKgQkeBKYsacWG kfwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=J3AdQgw/lM6MrZHn4x0zlp14HRtSLIE2IHZMmmLzoME=; b=sFIooGfnLRslQEJVolx1RoblEws7nH5dv23MXGx16K90XoRrioyvQBjS2ezfVybRRs gSYKB6NbvCr60NPWCNUKgHxyvUKqBHmj/Ve/Ov0QlfyZvV/fo3Xeim7Cu2ntt11RIADr H3+k2HqA/efc9RYN8q6mx6lzpiWJTIGYnQWM3Doo90sjfQxKFBocSx+Ff21LjFb4tOS+ ZDV7s/XVDHV8mdU8Xbc+AD0G+COV2XClsduEtkghNZQx0a0tgf/Kt6/nT0rYELLDd9kZ X2TcMDr71zXYL3mqUlOcQvTwd8Rd82JqMWh+/X0av0G8+Id7O6x1tGeLhyvmwkbekCaE g5Fw== X-Gm-Message-State: AODbwcDgeJ6rU0uBSmeGf0BSroXa3D1SOKYVFxli9IzU2GJGHY02PqCW BvMZ7RnOKCvcz243uazp0A== X-Received: by 10.55.198.20 with SMTP id b20mr3096205qkj.224.1495818930880; Fri, 26 May 2017 10:15:30 -0700 (PDT) Received: from adriatix.rutgers.edu (pool-128-6-37-254.nat.rutgers.edu. [128.6.37.254]) by smtp.gmail.com with ESMTPSA id v185sm833207qkb.58.2017.05.26.10.15.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 May 2017 10:15:30 -0700 (PDT) From: Jan Vesely To: dri-devel@lists.freedesktop.org, Emil Velikov Subject: [PATCH libdrm 1/1] drmsltest: Check expected neighbours Date: Fri, 26 May 2017 13:15:29 -0400 Message-Id: <20170526171529.5627-1-jan.vesely@rutgers.edu> X-Mailer: git-send-email 2.9.4 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-Virus-Scanned: ClamAV using ClamSMTP This test cements behaviour set in 3b2ee2b5bfc0d68525fee936e51297a9b6c629f1 drmSL: Fix neighbor lookup (2015-02-27) Signed-off-by: Jan Vesely --- tests/drmsl.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/drmsl.c b/tests/drmsl.c index d0ac0ef..d1b59a8 100644 --- a/tests/drmsl.c +++ b/tests/drmsl.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);