Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3683680pxa; Sun, 9 Aug 2020 08:15:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMEVlyobXk/d128KLUGyh23rzihOKWqqHSqImPipiS00eA9/pXYKQQNESjc4hp/X20PGoM X-Received: by 2002:a05:6402:1591:: with SMTP id c17mr17825543edv.240.1596986120373; Sun, 09 Aug 2020 08:15:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596986120; cv=none; d=google.com; s=arc-20160816; b=UkQ8LSn6YlYVrSzoLQMdH/CGcGcK8YZC+NbCJZa7aHu7qqEHG2u1cwp21g7yDCky8I vFBjQDo2k/qibdUtI4f11NgKPxIXAAZpynb8I2giv/i3NSTxgu5/iPbSuceXXMG7TIdT fbI3+NclYVuZIPkJA4ol/0qR12L+zg3c0Ph1RInNcJ3g27uZFi22lQdrVqO6XTOJXUL6 Pk97yajKbqxv2v1oF5705dRLypvp9c44fSyj8uVVqd6SaDsnHBRzhd1Oh8KgwbdBTZyj Gn5WROZIHzLchK8EHMxVOqaf4CCioiqlkKqyT+l+Ae/ZwcW4pq/NOukHWvP0q+XudY1d OMKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3U1YVfZ3/r+GTB6gjCpbjGoBmp0JEystLJz/+YctVAQ=; b=XqR6rrkRKnx6jPmdZC1fMnKIsTWgT+7FS24PeG5h6tdas+iBa0fpgz2JkSeYuKTKoe GWb8IjE8Y88AYpE86daswGtAIaqCSQfGTM9QrW7es9FmTGcCBc1HNEDfXFEfpKAI2dxu 7ZYkflSSzCnAQCWbjVhn6q0LSglMzmEhs8yhVKIXIp+ZC7j4kTkTP4TFYSd2rEPQSsT+ hztNJ4ptrBcyG8ew53gLNqpIM5eNWYbixhlVPYjvntp04bJeWlb3q5WXuuCpOR8xSHO+ 1W1Qfl62Nm6epRniiwcH+NCginHwymotJefvraEUzkgpTeZrr4diaka7A9TWh6uK7gua wRPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P3+JpB+W; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b31si9784431edf.456.2020.08.09.08.14.57; Sun, 09 Aug 2020 08:15:20 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P3+JpB+W; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726321AbgHIPLb (ORCPT + 99 others); Sun, 9 Aug 2020 11:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726070AbgHIPLa (ORCPT ); Sun, 9 Aug 2020 11:11:30 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2A4C061756; Sun, 9 Aug 2020 08:11:30 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id d22so3799557pfn.5; Sun, 09 Aug 2020 08:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3U1YVfZ3/r+GTB6gjCpbjGoBmp0JEystLJz/+YctVAQ=; b=P3+JpB+WUDWhDsCjxZF/OtdUOVzHJ2RM0GUjGZgEfAuODBqdcetEXFytsyhvGwl6iG 7jpquCJudc/UWaMo2r5UmytWUIad6p4gl3MgSZ76uY6+ZLepknpkIuMk05vC5NXY8bPB aC51eq5rPnX+oKQxQH9bBrJ7br6kkKvzPrY1zrguhbxJBaCCzEOxZhf+TL2ai/FxeTej lkQtf9a6iELZuOC21MKzCS3UaPmm8sopmJRzp1OwN//Bvrzol9XQfo6i7epSZuTZhZrZ utgbV1GnmdNimoiQ9LjVflso8qd9fYitfT2WG8XjtGrF4f97ADt1xHf0swQ9yDq+clP3 4FLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3U1YVfZ3/r+GTB6gjCpbjGoBmp0JEystLJz/+YctVAQ=; b=O18pH8w2GBQEJCIUj27eDROwtu001Z+ylN7rbHPHtrZAidqD2e+Bpe9qMulxZ0Ja9g FyDRJSrDbegnQCJkjqOC+Q8ZkQUDoNh3mn6o6lSnQsJEwWSInlpku8KPHBNKXqJwzUf2 zypBuhMFLwH3P4YKVEEEVUlixEygMSg0uV7XkUj5fBjMXPptEv1QYbMMlIUFnnCJaeyF xgvYihScRTwQ3nLKxbtmV3NKHCfTXVmQ3d75fOx2DAMYEES2uKQijyfMVehiU2M8xnzz 0W2aQQDPhCwqHqpu+dlED203A0vLZN+kNV1shkk5qimsjzNtY7rzTGumhn4N+6QCegBD xABg== X-Gm-Message-State: AOAM531lTs5P6SKiSfzgdfVDc/2jin97FV3Zxx9Wxp+DrYk4rvN4a2KW HINFMa5DWXxsu5wAybotd9s= X-Received: by 2002:a62:2e45:: with SMTP id u66mr22488619pfu.121.1596985889720; Sun, 09 Aug 2020 08:11:29 -0700 (PDT) Received: from [192.168.86.81] ([49.206.15.28]) by smtp.gmail.com with ESMTPSA id w82sm19869911pff.7.2020.08.09.08.11.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Aug 2020 08:11:29 -0700 (PDT) Subject: Re: [PATCH] lib: Convert test_hexdump.c to KUnit To: Andy Shevchenko Cc: brendanhiggins@google.com, skhan@linuxfoundation.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org References: <20200806094440.14962-1-98.arpi@gmail.com> <20200806100540.GE3703480@smile.fi.intel.com> From: Arpitha Raghunandan <98.arpi@gmail.com> Message-ID: Date: Sun, 9 Aug 2020 20:41:24 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200806100540.GE3703480@smile.fi.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/08/20 3:35 pm, Andy Shevchenko wrote: > On Thu, Aug 06, 2020 at 03:14:40PM +0530, Arpitha Raghunandan wrote: >> Converts test lib/test_hexdump.c to KUnit. >> More information about KUnit can be found at >> https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html. >> KUnit provides a common framework for unit tests in the kernel. > > ... > >> - if (memcmp(test, real, TEST_HEXDUMP_BUF_SIZE)) { >> - pr_err("Len: %zu row: %d group: %d\n", len, rowsize, groupsize); >> - pr_err("Result: '%s'\n", real); >> - pr_err("Expect: '%s'\n", test); >> - failed_tests++; >> - } >> + KUNIT_EXPECT_EQ(kunittest, 0, memcmp(test, real, TEST_HEXDUMP_BUF_SIZE)); > > > Ah, can you explain how user will see now what is being expected and what is in > reality in the buffer? I'm not gonna accept such changes without showing in > explicitly that user is not going to suffer of this change. > I have sent another patch replacing KUNIT_EXPECT_EQ() with KUNIT_EXPECT_EQ_MSG() and KUNIT_EXPECT_NE() with KUNIT_EXPECT_NE_MSG(). These methods log what is being expected and what is in reality in the buffer in case of test failure similar to the original test.