Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4255703ybg; Mon, 8 Jun 2020 03:14:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi0T981d/W+WmcJr5Cq4ozVb0eLBoHLGWIEbbC02N+WotPWOYXar7pR75EtLdmKvS/7trS X-Received: by 2002:a17:906:7b54:: with SMTP id n20mr1738228ejo.144.1591611272324; Mon, 08 Jun 2020 03:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591611272; cv=none; d=google.com; s=arc-20160816; b=Wy+6yF79ir6M1yxEd8ZgoPW/d6d2IlaRZ5AbYEUNekOZehGtPT6VPlpCBHId7lWvMf UCpxXIceCtStQJLrPxV9qEi0ZlxP/8vzg4jNjBuIpK8KQOoZX8FjtMoXdNV4+xFhDdAv ts6OJZlYEU4KLfg/fNl2YGPJaILxJagnjA9ccFhb180InZmtbzb7YRXsx6eY2zxNJJqV vYZKpEU/39d7fZUjqWpPHT9iTeG2D8tOGSjVNBQY3lRUc9YSGncvkCNGhrCffgNYgMQk rkw7GvW4Thb3uMIheqCd+0uqCwgTA8bIrfsGp3caS3LRn8p7MbKytyXR74bqyelWCjAv XQmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=9MO1Ku/2FiWL+7O3UeKwwzcP+hAwUyoPq8W8WrbOGks=; b=p4Qf7UpfjhmKGXxdlx+oqKAzlFtAKxN+D3UpPgQtDM0mxphLxG9G4udqk+zag6v1o9 4OcKaSXQkErlbJgtY/o2CWZS5uFpm92ry85WJF5kV+nkZq6uYkPPUdJR8Fr2VLcfJcfN klM5jEPWm4QHGskMg6jt+7qqr6jY0k+xd1jtymMEW0J6rGV3jm9pGqJFMWTsc3UYp52p rHpMXEnuWgE4SGiWFWQbOlef1xGKT53nlzmvpEPxL+irSFX6k3dMDaAltK+uIhLS+X2M UXn97ecaJ1JazRCcnrIfutD7xbq6UIsetSkp4xDE9TwD7F9lF3Q2nR90IDhnovkpsmBs TyjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gq19si7188763ejb.682.2020.06.08.03.14.09; Mon, 08 Jun 2020 03:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729315AbgFHKMO (ORCPT + 99 others); Mon, 8 Jun 2020 06:12:14 -0400 Received: from mga02.intel.com ([134.134.136.20]:57438 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729263AbgFHKMO (ORCPT ); Mon, 8 Jun 2020 06:12:14 -0400 IronPort-SDR: 8XXPHiXJ4APnkYu4HYloBud3rEKQcKSRMy/8ZJJCa9fhrIpD6AN2k6mal03HhLkMg2zjjGmDac mqKr/2FPWcPg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2020 03:12:13 -0700 IronPort-SDR: MXs4wO83ExVqUxCoPxfVRY2GhEmOL1kIlUgZh/1ItA0uOtVAWiI84uOiFYvXph5vvT71F8gzZx 1A4HuBQ4AnIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,487,1583222400"; d="scan'208";a="258657785" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga007.fm.intel.com with ESMTP; 08 Jun 2020 03:12:11 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jiElK-00BeLy-Gr; Mon, 08 Jun 2020 13:12:14 +0300 Date: Mon, 8 Jun 2020 13:12:14 +0300 From: Andy Shevchenko To: Stefano Brivio Cc: Andrew Morton , Yury Norov , Rasmus Villemoes , Pablo Neira Ayuso , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] lib: Add test for bitmap_cut() Message-ID: <20200608101214.GE2428291@smile.fi.intel.com> References: <3e3ab7a4756df2ecf8fb012f16c375d4cd714552.1591606281.git.sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e3ab7a4756df2ecf8fb012f16c375d4cd714552.1591606281.git.sbrivio@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 08, 2020 at 11:13:29AM +0200, Stefano Brivio wrote: > Based on an original patch by Yury Norov: introduce a test for > bitmap_cut() that also makes sure functionality is as described for > partially overlapping src and dst. > Co-authored-by: Yury Norov Co-developed-by (and it requires Yury's SoB as well). > Signed-off-by: Stefano Brivio ... > +static struct test_bitmap_cut test_cut[] = { > + { 0, 0, 8, { 0x0000000aUL, }, { 0x0000000aUL, }, }, > + { 0, 0, 32, { 0xdadadeadUL, }, { 0xdadadeadUL, }, }, > + { 0, 3, 8, { 0x000000aaUL, }, { 0x00000015UL, }, }, > + { 3, 3, 8, { 0x000000aaUL, }, { 0x00000012UL, }, }, > + { 0, 1, 32, { 0xa5a5a5a5UL, }, { 0x52d2d2d2UL, }, }, > + { 0, 8, 32, { 0xdeadc0deUL, }, { 0x00deadc0UL, }, }, > + { 1, 1, 32, { 0x5a5a5a5aUL, }, { 0x2d2d2d2cUL, }, }, > + { 0, 15, 32, { 0xa5a5a5a5UL, }, { 0x00014b4bUL, }, }, > + { 0, 16, 32, { 0xa5a5a5a5UL, }, { 0x0000a5a5UL, }, }, > + { 15, 15, 32, { 0xa5a5a5a5UL, }, { 0x000125a5UL, }, }, > + { 15, 16, 32, { 0xa5a5a5a5UL, }, { 0x0000a5a5UL, }, }, > + { 16, 15, 32, { 0xa5a5a5a5UL, }, { 0x0001a5a5UL, }, }, > + > + { BITS_PER_LONG, BITS_PER_LONG, BITS_PER_LONG, > + { 0xa5a5a5a5UL, 0xa5a5a5a5UL, }, > + { 0xa5a5a5a5UL, 0xa5a5a5a5UL, }, > + }, > + { 1, BITS_PER_LONG - 1, BITS_PER_LONG, > + { 0xa5a5a5a5UL, 0xa5a5a5a5UL, }, > + { 0x00000001UL, 0x00000001UL, }, > + }, > + > + { 0, BITS_PER_LONG * 2, BITS_PER_LONG * 2 + 1, > + { 0xa5a5a5a5UL, 0x00000001UL, 0x00000001UL, 0x00000001UL }, Perhaps leave comma as well? > + { 0x00000001UL, }, > + }, > + { 16, BITS_PER_LONG * 2 + 1, BITS_PER_LONG * 2 + 1 + 16, > + { 0x0000ffffUL, 0x5a5a5a5aUL, 0x5a5a5a5aUL, 0x5a5a5a5aUL }, Ditto. > + { 0x2d2dffffUL, }, > + }, > +}; > + > +static void __init test_bitmap_cut(void) > +{ > + unsigned long b[4], *in = &b[1], *out = &b[0]; /* Partial overlap */ > + int i; > + > + for (i = 0; i < ARRAY_SIZE(test_cut); i++) { > + struct test_bitmap_cut *t = &test_cut[i]; > + > + memcpy(in, t->in, sizeof(t->in)); > + > + bitmap_cut(out, in, t->first, t->cut, t->nbits); > + if (!bitmap_equal(out, t->expected, t->nbits)) { > + pr_err("bitmap_cut failed: expected %*pb, got %*pb\n", > + t->nbits, t->expected, t->nbits, out); > + } Perhaps if (bitmap_equal(...)) continue; ... ? > + } > +} -- With Best Regards, Andy Shevchenko