Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3954675pxb; Tue, 2 Nov 2021 01:14:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4b7lLe/n5ALbTUQ8//nyrmmKhax8mgqaL+StGxRkJAoz6fd6SaS0IghKaqrlQKFNrfHej X-Received: by 2002:a17:907:86aa:: with SMTP id qa42mr2765401ejc.358.1635840854853; Tue, 02 Nov 2021 01:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635840854; cv=none; d=google.com; s=arc-20160816; b=samad1S8QpdPsA2nlRId8QZ17moe76LitLU1T5t5t29Oj9v15WJJHMi9xauDgaPLps z2qrR2tTliBj1O80nwLVTunh8aHGWUQXV3dgYUohrUFLtjZrhfVf4eT2Ymh7kOnD7ywN HrUVhIiyJLabWcSujHR8HNECsnzT9r5QicsUYtjWkoyG5PjVkB6phE5ovFJ4brzoiNC/ x6BsaQQ66HbDH2DpGHYuWu/izVH2bHWnmjEkIISj1BaBqUbZd+7//cGyfN68E20+1tG/ 6LrTok4YpA6xK2Os/dttUNm6mP+DlIiupZMV9wy7N7RLlHwPWnZcFfOdQWYEnzXOCAS6 vkjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=PonNbMWoqThkAKEBfztMgFnpTF3vsFT/dHecSBkyWI0=; b=gRFC4TCJivSEgvT10p4piMbGtxxMbmWMXmQzeCYHQ+Gu73bQaG9MDbyzDGt8RJn0kf MlnO4BpcmFch5N3GNu4lcjLSq+mKDWdkqxWnSsm5i8ikBpuw1LVa/QnzwYN+ZvkZxSHq Pb2OqqdEl3hty6KWEEcFw2TxV/ag1wC9NdGs37uEynqPVeGKeUE0wgiEl5l0ozNKqvnS kf1zISSasE36MmJJnV/fqlWT8JsM0nAHer1z7zJ7G3tc1Hko5ryLDP0s/IlP+VNtO45h IHktXpe5DfdLE5+0QbMKKTkkY0gHv8Ijh4TM69L8nEj92ctqX60k7T1dWULAVod1a+zr CcHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=G5eBfID8; 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 qw34si14214093ejc.778.2021.11.02.01.13.51; Tue, 02 Nov 2021 01:14:14 -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=20210112 header.b=G5eBfID8; 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 S230321AbhKBIOa (ORCPT + 99 others); Tue, 2 Nov 2021 04:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbhKBIO3 (ORCPT ); Tue, 2 Nov 2021 04:14:29 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C54E2C061714; Tue, 2 Nov 2021 01:11:54 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id m14so20012552edd.0; Tue, 02 Nov 2021 01:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PonNbMWoqThkAKEBfztMgFnpTF3vsFT/dHecSBkyWI0=; b=G5eBfID8eDolsskr72EFJJyuW1FqdaP9+vW7iFdqD31D2MZcp4lLKFX0QcnO56DJfd gWRXDcJkJAXblAPxVXTzIhjm8cDntvdRKc94B3jSuTKA7KsAJ2ztrwZ9SBh9+cNHGNn1 lBwyOzGVC7PBTIirSJR81c+KqYu6WNNLmES3BpuWGdYgXCSMs6RbkP3zNPLsndMbHsx0 jtQj5tTiaWhl7hshASMOrrNvIaQwpl1sUimgNKaOxkeovwG1d3Yvzg5zVWTvwiBwZWIl 7H5eB/eU61KGSc7N38duQz3PUIsjzP7cjH7wiE5fCVOVZZWKCwB5zsxqU+HnjPFxVBmF NJGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PonNbMWoqThkAKEBfztMgFnpTF3vsFT/dHecSBkyWI0=; b=ukNUG0Q4Jncy+B3T/loxH8/py83SJAM9Rqyu2Nc685EaO8xYpE4n8tLGRfBK/KmGAF dB3chlAxbXnM7YVLw2FExtWQcwcpcMDulm2xu+f0fbPwXSOUXqzgDWbvzVpVsZazI7+G NLGEXiBmPoJPIJvZshduLnrnV7zphVkXsTb6H9K4DlpzMxQXACOR2lpXdWvOmOQx4uCp n8shf/IODbIVvQCy3q9Ls9hwxf/WUxZwkSX2qUdbiYJ3yrRQXpKHwd525Zbc2bZ09J4B hBn/tUU4/nycyY989/u5AiQFStZ5GaOWtspzDEO9m52mV5qMd+NRzp38UKQMst/SmR/i 6Ghg== X-Gm-Message-State: AOAM531go7mokCAv0NFYDKS+MfMpGBUXrKXjsJq+uqC63/4EXXgAV4FN m4O+Hxka/3cvOokVOWGSDxKdeVhxu7zxMNUnniiveTW/EGQ= X-Received: by 2002:a17:906:1707:: with SMTP id c7mr42515219eje.377.1635840712655; Tue, 02 Nov 2021 01:11:52 -0700 (PDT) MIME-Version: 1.0 References: <20211102073300.13376-1-andriy.tryshnivskyy@opensynergy.com> In-Reply-To: <20211102073300.13376-1-andriy.tryshnivskyy@opensynergy.com> From: Andy Shevchenko Date: Tue, 2 Nov 2021 10:11:16 +0200 Message-ID: Subject: Re: [PATCH v7 3/3] iio: test: Add test for IIO_VAL_INT_64. To: Andriy Tryshnivskyy Cc: Vasyl.Vavrychuk@opensynergy.com, jbhayana@google.com, Jonathan Cameron , Lars-Peter Clausen , linux-iio , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 2, 2021 at 9:33 AM Andriy Tryshnivskyy wrote: > Now it's good with format, but you have missed the commit message. > Signed-off-by: Andriy Tryshnivskyy ... > +static void iio_test_iio_format_value_integer_64(struct kunit *test) > +{ > + char *buf = kunit_kmalloc(test, PAGE_SIZE, GFP_KERNEL); Shouldn't this be checked against NULL? > + s64 value; > + int values[2]; > + int ret; Reversed xmas tree ordering? > + value = 24; > + values[0] = lower_32_bits(value); > + values[1] = upper_32_bits(value); > + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values); ARRAY_SIZE()? > + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "24\n"); > + > + value = -24; > + values[0] = lower_32_bits(value); > + values[1] = upper_32_bits(value); > + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values); > + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "-24\n"); > + > + value = 0; > + values[0] = lower_32_bits(value); > + values[1] = upper_32_bits(value); > + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values); > + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "0\n"); > + > + value = 4294967295; Is this UINT_MAX? > + values[0] = lower_32_bits(value); > + values[1] = upper_32_bits(value); > + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values); > + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "4294967295\n"); > + value = -4294967295; Is this -UINT_MAX? > + values[0] = lower_32_bits(value); > + values[1] = upper_32_bits(value); > + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values); > + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "-4294967295\n"); > + > + value = LLONG_MAX; > + values[0] = lower_32_bits(value); > + values[1] = upper_32_bits(value); > + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values); > + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "9223372036854775807\n"); > + > + value = LLONG_MIN; > + values[0] = lower_32_bits(value); > + values[1] = upper_32_bits(value); > + ret = iio_format_value(buf, IIO_VAL_INT_64, 2, values); > + IIO_TEST_FORMAT_EXPECT_EQ(test, buf, ret, "-9223372036854775808\n"); > +} -- With Best Regards, Andy Shevchenko